Seite 2 von 2

Re: OpenWB-Steuerung EVU-Überschuss Heizen

Verfasst: Mo Nov 14, 2022 8:07 pm
von veut
Gero hat geschrieben: Mo Nov 14, 2022 9:12 am edit2: zumindest mit jq geht da noch was mit if-then-else: Probier mal "if .relays[0].ison then 3500 else 0 end". Ich weiß nicht, ob das auch beim Aufruf aus der openWB heraus klappt.
Geht leider nicht. Aber genau das hatte ich gesucht.
Muss mal schauen ob ich mit homeassistant ein Dummyzähler bauen und ob ich diesen von außen auch abgreifen kann.

Re: OpenWB-Steuerung EVU-Überschuss Heizen

Verfasst: Di Nov 15, 2022 8:51 am
von Gero
Falls Du im homeassistant nodeRED installieren magst, wäre hier die Lösung:
hei.jpg
Ganz links wird ein http-Endpoint namens "heizer" definiert. Wenn der angesprochen wird, geht's im nächsten an den Shelly, der den Status als String zurückliefert, der dann mit der JSON-Node zu einem JS-Objekt konvertiert wird. In diesem wird nun in der Change-Node relays[0].ison abgefragt und je nach status in den einen oder andern Fall verzweigt. Die letzte Node schließt den http-request ab.

Code: Alles auswählen

[{"id":"b7756e7447601fc4","type":"http in","z":"bbc4c862.00704","name":"","url":"heizer","method":"get","upload":false,"swaggerDoc":"","x":110,"y":1020,"wires":[["12318c3e2fa2d18d"]]},{"id":"12318c3e2fa2d18d","type":"http request","z":"bbc4c862.00704","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.8.30/status","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":290,"y":1020,"wires":[["e1a448586712f65e"]]},{"id":"e1a448586712f65e","type":"json","z":"bbc4c862.00704","name":"","property":"payload","action":"","pretty":false,"x":450,"y":1020,"wires":[["e7406e05224841ef"]]},{"id":"35aaf682f1c8890f","type":"http response","z":"bbc4c862.00704","name":"response","statusCode":"","headers":{},"x":900,"y":1020,"wires":[]},{"id":"e7406e05224841ef","type":"switch","z":"bbc4c862.00704","name":"","property":"payload.relays[0].ison","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":590,"y":1020,"wires":[["6e138c0932018129"],["a783b275fbfd877f"]]},{"id":"6e138c0932018129","type":"change","z":"bbc4c862.00704","name":"3500","rules":[{"t":"set","p":"payload","pt":"msg","to":"3500","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":1000,"wires":[["35aaf682f1c8890f"]]},{"id":"a783b275fbfd877f","type":"change","z":"bbc4c862.00704","name":"0","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":1040,"wires":[["35aaf682f1c8890f"]]}]
Einen kleinen Stolperstein gibt's noch: In einer Standard-Installation lauscht nodeRED auf Port 1880, also ist der URL http://192.168.x.x:1880/heizer. Musst mal kucken ob das im homeassistent auch so ist und ob die Eingabevalidierung in der openWB das verträgt.

Re: OpenWB-Steuerung EVU-Überschuss Heizen

Verfasst: Di Nov 15, 2022 9:34 am
von Gero
Oder Du machst's gleich in MQTT. Dazu erst den Shelly auf den Broker der openWB pubishen lassen:
shlly.jpg
Und dann ist das hier der Flow:

mqtt-.jpg
Konfigurieren musst Du nur den MQTT-Broker und die richtigen Topics in den beiden MQTT-Nodes.

Code: Alles auswählen

[{"id":"fe85aa0b843a6ed1","type":"mqtt in","z":"bbc4c862.00704","name":"","topic":"shellies/heizer/relay/0/power","qos":"2","datatype":"auto","broker":"c4cb83c8.1bd0c","nl":false,"rap":true,"rh":0,"inputs":0,"x":180,"y":1120,"wires":[["2966a55c4f853090"]]},{"id":"2966a55c4f853090","type":"switch","z":"bbc4c862.00704","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":430,"y":1120,"wires":[["18e15669c84cc9de"],["07b43e5425669434"]]},{"id":"18e15669c84cc9de","type":"change","z":"bbc4c862.00704","name":"3500","rules":[{"t":"set","p":"payload","pt":"msg","to":"3500","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":1100,"wires":[["04dd9445a4c8a972"]]},{"id":"07b43e5425669434","type":"change","z":"bbc4c862.00704","name":"0","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":1140,"wires":[["04dd9445a4c8a972"]]},{"id":"04dd9445a4c8a972","type":"mqtt out","z":"bbc4c862.00704","name":"","topic":"openWB/SmartHome/set/Devices/8/Aktpower","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"c4cb83c8.1bd0c","x":900,"y":1120,"wires":[]},{"id":"c4cb83c8.1bd0c","type":"mqtt-broker","name":"OpenWB","broker":"wallbox.fritz.box","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":4,"keepalive":"30","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]

Re: OpenWB-Steuerung EVU-Überschuss Heizen

Verfasst: Di Nov 15, 2022 8:32 pm
von veut
Habe es mit Node-RED wie du beschrieben hast gelöst (HTTP).

Mit MQTT hat kurz die OpenWB den Wert angezeigt ist dann aber wieder auf Null zurückgesprungen.
Ich werde mich mal mit NodeRed beschäftigen.

Besten Dank Gero für deine super Zuarbeit!