hardware:channels:meters:power:shelly
Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
Shelly
Hardware
Verwendet wird ein Shelly Plug S.
Die Konfiguration lässt sich aber sicher auch für ähnliche Shelly Geräte anpassen.
Durch Eingabe der URL http://<Shelly IP>/meter/0 bekommen wir folgende JSON Antwort
{"power":20.57,"is_valid":true,"timestamp":1697657582,"counters":[20.735, 20.814, 20.791],"total":4131}
Interessant sind die Elemente
- power: Current real AC power being drawn, in Watts
- total: Total energy consumed by the attached electrical appliance in Watt-minute
Das Element „total“ in Watt Minuten wird leider nach einem Aus-Einschalten des Shelly auf null gesetzt.
Bleibt noch das Element „power“ in Watt, das aufaddieren der Energie übernimmt dann der volkszähler.
vzlogger
Software vorbereiten
Um den JSON-String vom Shelly auswerten zu können ist ein zusätzliche Tool nötig. Installation mit
sudo apt install jq
Beispiel vzlogger.conf
- vzlogger.conf
// Shelly Plug S { "enabled": true, "allowskip": true, "protocol": "exec", "command": "curl -s http://<Shelly IP>/meter/0 | jq -c '.power' | awk '{print \"power \" $1}'", "format": "$i $v", "interval": 10, "channels": [ { "api": "volkszaehler", "uuid": "xxxxxxxxxxxxxx", "identifier": "power", "middleware": "http://localhost/middleware.php" } ] }
Zum Testen des „command“ in der Shell müssen die zwei \ im awk Kommando entfernt werden.
- Shell
pi@raspberrypi:~ $ curl -s http://<Shelly IP>/meter/0 | jq -c '.power' | awk '{print "power " $1}' power 20.67 pi@raspberrypi:~ $
Kanäle
Im Web Frontende einen Kanal vom Typ powersensor / El. Energie (Leistungswerte) anlegen
hardware/channels/meters/power/shelly.1697651982.txt.gz · Zuletzt geändert: 2023/10/18 19:59 von van