Hierbei handelt es sich um ein kleines Hile-Skript um die Tibber Api auszulesen und per UDP weiter zu senden. Spziell hilfreich ist dies für Loxone, da das Auslesen der Tibber graphql-API nicht nativ in der Loxone unterstützt wird. Das Script wandelt die gelesenen Informationen in UDP-Befehle um, die der Beschreibung https://loxwiki.atlassian.net/wiki/spaces/LOX/pages/1522696197/Anbinden+der+aWATTar+hourly+API entsprechen.
Zunächst die python version testen. Das Script funktioniert nur mit python3.9 oder höher. Diese Abhänigkeit kommt nicht aus der Programmierung des Scriptes, sondern von der Library https://github.com/BeatsuDev/tibber.py.
❯ python3 --version
Python 3.10.8 # Muss größer oder gleich 3.9 sein!Installation der Abhängigkeit https://pypi.org/project/tibber.py:
❯ pip3 install tibber.pyPython Pfad identifizieren:
❯ which python3
/usr/bin/python3Cronjob anlegen:
❯ crontab -eund im Textfeld folgende Zeile einfügen. Der Python Pfad muss mit dem Output von which python3 übereinstimmen, ebenso der Pfad zum heruntergeladenen Pythonfile tibberlox.py.
*/30 * * * * /usr/bin/python3 /home/jacknjo/TibberLox/tibberlox.py
Im Repository ist die VUI_tibberlox.xml hinterlegt. Diese beinhaltet alle Werte, die vom Skript gesendet werden. Der Großteil der Werte entspricht der API-Beschreibung von: https://loxwiki.atlassian.net/wiki/spaces/LOX/pages/1522696197/Anbinden+der+aWATTar+hourly+API
Die folgenden Elemente wurden zusätzlich hinzugefügt:
date_now_seconds_since_epochKann als Trigger/Zeitstempel verwendet werden.price_stdevStandardabweichung der Preise des aktuellen Tagesdata_price_hour_rel_num_negativesAnzahl der validen negativen Relativwerte (invalide Werte tragen den Wert -1000).data_price_hour_rel_num_positivesAnzahl der validen positiven Relativwerte (invalide Werte tragen den Wert -1000).
# Ausführbarmachen des scriptes.
chmod +x tibberlox.py
# Ausführung mit default-Parametern.
./tibberlox.py
# Alternativ für die Hilfe.
./tibberlox.py -hThis is a small helper script that reads the tibber API and forwards the information read to a remote destination. This can be used for a Loxone Miniserver, as the functionality to receive information via graphql-API is not given natively. The UDP datagram contains one big packed package with the information as specified here: https://loxwiki.atlassian.net/wiki/spaces/LOX/pages/1522696197/Anbinden+der+aWATTar+hourly+API.
First of all you need to test your python version, as the script only works for python3.9 or higher. This dependency is injected by the https://github.com/BeatsuDev/tibber.py module.
❯ python3 --version
Python 3.10.8 # Needs to be >= 3.9Installation of the dependency https://pypi.org/project/tibber.py:
❯ pip3 install tibber.pyIdentify the python path
❯ which python3
/usr/bin/python3Create a cronjob:
❯ crontab -eIn the promt add the following line. Attention! The python path must match the output of which python3, as must the absolute path to the pythonfile tibberlox.py.
*/30 * * * * /usr/bin/python3 /home/jacknjo/TibberLox/tibberlox.py
# First make the script executable.
chmod +x tibberlox.py
# Run with default options.
./tibberlox.py
# To read the help.
./tibberlox.py -hIn the repository you find the file VUI_tibberlox.xml. This contains the library definition of all values sent by the script. This is mainly as documented in https://loxwiki.atlassian.net/wiki/spaces/LOX/pages/1522696197/Anbinden+der+aWATTar+hourly+API.
The following elements were added in addition:
date_now_seconds_since_epochCan be used as trigger for new data.price_stdevStandard deviation of the prices from the current day.data_price_hour_rel_num_negativesNumber of valid negative relative values (invalid values carry value -1000).data_price_hour_rel_num_positivesNumber of valid positive relative values (invalid values carry value -1000).