Sign inSign up

freakern/tibber2mqtt

By freakern

•Updated almost 3 years ago

Image
0

3.3K

freakern/tibber2mqtt repository overview

⁠Tibber2MQTT

This is a little helper Tool, that requests the Data from tibber and publishes the result in the MQTT Broker

⁠Description

Tibber offers a pretty decent api which can be used to request a lot of data. You can request information from Tibber itself or connect your devices to Tibber and request even that information.

For example, I have a Fronius Inverter and after adding the Inverter to my App, I can request the id of the "bubbles" (icons shown in the App) and add my inverter to the request query.

The Queries are made through a build GraphQL query. Which is simply a JSON structure to select the fields you want.

⁠Getting Started

⁠TL:DR
docker run -d --restart=always \
    -e TIBBER2MQTT_TIBBER_EMAIL="[email protected]" \
    -e TIBBER2MQTT_TIBBER_PASS="..." \
    -e TIBBER2MQTT_MQTT_CACHE=1 \
    -e TIBBER2MQTT_MQTT_SINGLE=1 \
    -e TIBBER2MQTT_MQTT_HOST=192.168.0.3 \
    -e TIBBER2MQTT_QUERY_FILENAME="your_file_name" \
    --name tibber2mqtt freakern/tibber2mqt
⁠Build your Query

The key to request the Values from Tibber is to get a working query.

A quick example

  1. Go to the Tibber login⁠ and log in to your account
  2. Go to the Query Playground⁠ of Tibber
  3. Paste the tibber_bubbles⁠ content into the left pane
  4. Press the Play Button

This will show you all your bubbles in the app. Navigate through the DOCS Menu to the right in the Query Playground⁠ to create a query that fits your needs

⁠Install and Start

Let's start with the tibber_bubbles⁠ (without defining the query-filename the tibber_bubbles is default)

docker run -d --restart=always \
  -e TIBBER2MQTT_TIBBER_EMAIL="[email protected]" \
  -e TIBBER2MQTT_TIBBER_PASS="your-password" \
  -e TIBBER2MQTT_MQTT_HOST=192.168.0.3 \
  -e TIBBER2MQTT_DEBUG=1 
  -e TIBBER2MQTT_MQTT_CACHE=1 \
  -e TIBBER2MQTT_MQTT_SINGLE=1 \
  freakern/tibber2mqtt

When you have your query ready, place the textfile with the Query in the config folder and add the ENV Variable (before the last line):

-v ${PWD}/config:/app/config \
-e TIBBER2MQTT_QUERY_FILENAME="your_file_name" \

Cache is a simple "Do not publish the same value again" and the Single Parameter is to send each value individually else it would publish the entire json each time (if it's not cached)

⁠Help

⁠Docker ENV Vars
ENV Variable NameDescriptionDefaultRequired
TIBBER2MQTT_DEBUGEnable Debug ModeFalseFalse
TIBBER2MQTT_VERBOSEEnable Verbose ModeFalseFalse
TIBBER2MQTT_TIBBER_EMAILTibber emailTrue
TIBBER2MQTT_TIBBER_PASSTibber PasswordTrue
TIBBER2MQTT_TOKEN_FILENAMEFilename of the File where the Token will be read from and write intotokenFalse
TIBBER2MQTT_QUERY_FILENAMEFilename of the File where the gql query will be saved into (must be located in the config folder)tibber_bubblesFalse
TIBBER2MQTT_REQUEST_INTERVALThe request intervalFalse
TIBBER2MQTT_MQTT_SINGLESend each value individually to the MQTT BrokerFalseFalse
TIBBER2MQTT_MQTT_CACHECache the send values (works best in single (-s) mode)FalseFalse
TIBBER2MQTT_MQTT_HOSTMQTT Host to connect tolocalhostFalse
TIBBER2MQTT_MQTT_PORTMQTT port to connect to1883False
TIBBER2MQTT_MQTT_TOPICMQTT Topic to publish totibber2mqttFalse
TIBBER2MQTT_MQTT_CLIENT_IDMQTT Client-IDtibber2mqttFalse
TIBBER2MQTT_MQTT_USERMQTT user to connect toFalse
TIBBER2MQTT_MQTT_PASSMQTT password to connect toFalse

⁠Disclaimer & I need your help

I do not have a Tibber Contract, I am just using the account to connect to my Polestar 2. So I can't really help if it is about the data related to a running contract.

That out of the way, if you have a good working Tibber Query and you want to share it. Please create a Pull-Request with your running query in the config folder. I would suggest you replace the ID's and put some comments with a # Symbol in front of it

⁠License

This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details

Tag summary

Content type

Image

Digest

sha256:657b064c9…

Size

365 MB

Last updated

almost 3 years ago

docker pull freakern/tibber2mqtt