Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Publishes Tibber live consumption data from Tibber API per MQTT.

License

Notifications You must be signed in to change notification settings

danielringch/tibber2mqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tibber2mqtt

Publishes Tibber live consumption data from Tibber API per MQTT.

Introduction

If you are a customer of Tibber and use a Tibber Pulse, you can retrieve realtime consumption data via the Tibber API.

This program publishes realtime consumption data from Tibber to one or more MQTT brokers of your choise.

The power consumption/ production value is published via MQTT as a single int16 or int32 value in Watts, negative values indicate power production.

Get tibber token and home id

{
  viewer {
    homes {
      id
    }
  }
}
  • Execute the query (play button above the text box) and you will see your home id in the left text box

Configuration

The configuration is done via yaml file. The example file can be found in config/sample.yaml

To keep sensitive content out of config files, some parameters can be replaced by environment variables. See the example config file for the enviroment variable names.

Usage without docker

Prerequisites

  • Python version 3.11 or newer with pip + venv

This program should run in any OS, but I have no capacity to test this, so feedback is appreciated. My test machines run Ubuntu and Raspbian.

Install

git clone https://github.com/danielringch/tibber2mqtt.git
python3 -m venv <path to virtual environment>
source <path to virtual environment>/bin/activate
python3 -m pip install -r requirements.txt

Run

source <path to virtual environment>/bin/activate
python3 -B tibber2mqtt/tibber2mqtt.py --config /path/to/your/config/file.yaml

Usage with docker

This program is also available as docker container:

docker pull danielringch/tibber2mqtt:latest

The container expects the configuration file at /config/tibber2mqtt.yaml

Example:

docker run --rm -it \
  -v /path/to/config/file:/config \
  -e T2M_TIBBER_TOKEN="my_token" \
  -e T2M_TIBBER_HOME="my_home_id" \
  -e T2M_MQTT_HOST_my_server="212.132.65.187:8883" \
  -e T2M_MQTT_USER_my_server="user" \
  -e T2M_MQTT_PASS_my_server="password" \
  danielringch/tibber2mqtt

Get support

You have trouble getting started? Something does not work as expected? You have some suggestions or thoughts? Please let me know.

Feel free to open an issue here on github or contact me on reddit: 3lr1ng0.

About

Publishes Tibber live consumption data from Tibber API per MQTT.

Topics

Resources

License

Stars

Watchers

Forks