GithubHelp home page GithubHelp logo

tibber-energy's Introduction

Tibber-energy api

Tibber dynamic energy api

This sketch is almost completely generated by https://chat.openai.com/chat

This is an Arduino sketch that connects to the Tibber API using GraphQL to retrieve data about the energy consumption of a Tibber user's home. The sketch uses the ESP8266WiFi library to connect to a Wi-Fi network and the WiFiClientSecure library to make secure HTTP requests to the Tibber API.

The sketch defines several constants at the beginning, including the Wi-Fi network SSID and password, the Tibber API endpoint URL, the port to connect to, and the user's access token for the Tibber API.

The initWiFi() function is called to connect to the Wi-Fi network. It waits until the connection is established and prints the local IP address to the serial monitor.

The executeGraphQLQuery() function is called to make a GraphQL request to the Tibber API. It creates a WiFiClientSecure object, sets it to be insecure (because the Tibber API uses a self-signed certificate), and connects to the API endpoint using the connect() method. It then sends a POST request with the GraphQL query in the request body, along with the authorization token and content type headers.

The response from the Tibber API is read and printed to the serial monitor for debugging purposes.

In the setup() function, a GraphQL query is defined as a multi-line string using the R"() syntax. The query requests the current subscription price info for the user's home.

Finally, the executeGraphQLQuery() function is called with the query string as an argument.

tibber-energy's People

Contributors

ltvanderkrogt avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.