Ich hab' mal das Dashboard erweitert um die Anzeige des Hausverbrauchs aus der openWB und an die drei Slider eine Summenfunktion drangehängt. Das ist die für Dummies, es gibt auch eine allgemeine in der Du Javascript-Coding coden kannst. Ganz links ist übrigens eine Inject-Node, die initialisiert die Schieber alle auf 0.
Für das publishen seitens der openWB musst Du glaube ich nichts machen, der Hausverbrauch kommt automatisch im nodeRED an. (Kannst das ja mal mit einem anderen Topic probieren) Um den Rückweg zur openWB zu probieren, habe ich eine nject-node gemacht, die einfach eine Null in die MQTT-out Node zum Topic openWB/lp/1/ChargePointEnabled schreibt. Und das funktioniert auch
Code: Alles auswählen
[{"id":"bbc4c862.00704","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"67a0bd38.a3660c","type":"ui_slider","z":"bbc4c862.00704","name":"","label":"L3","tooltip":"","group":"9a128f1d.c9e368","order":5,"width":4,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":10,"step":1,"x":270,"y":260,"wires":[["1dabd54a.aff44b"]]},{"id":"e42406ce.b03618","type":"ui_slider","z":"bbc4c862.00704","name":"","label":"L2","tooltip":"","group":"9a128f1d.c9e368","order":3,"width":4,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":10,"step":1,"x":270,"y":180,"wires":[["428fdcf1.602d6c"]]},{"id":"9e1a908d.03d11","type":"ui_slider","z":"bbc4c862.00704","name":"","label":"L1","tooltip":"","group":"9a128f1d.c9e368","order":1,"width":4,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":10,"step":1,"x":270,"y":100,"wires":[["68fa78.5b2fe588"]]},{"id":"68fa78.5b2fe588","type":"ui_numeric","z":"bbc4c862.00704","name":"l1","label":"","tooltip":"","group":"9a128f1d.c9e368","order":2,"width":2,"height":1,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":"0","max":"10","step":1,"x":410,"y":100,"wires":[["a5150192.f53848"]]},{"id":"428fdcf1.602d6c","type":"ui_numeric","z":"bbc4c862.00704","name":"l2","label":"","tooltip":"","group":"9a128f1d.c9e368","order":4,"width":2,"height":1,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":"0","max":"10","step":1,"x":410,"y":180,"wires":[["a5150192.f53848"]]},{"id":"1dabd54a.aff44b","type":"ui_numeric","z":"bbc4c862.00704","name":"l3","label":"","tooltip":"","group":"9a128f1d.c9e368","order":6,"width":2,"height":1,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":"0","max":"10","step":1,"x":410,"y":260,"wires":[["a5150192.f53848"]]},{"id":"e1568ef6.5805e","type":"mqtt in","z":"bbc4c862.00704","name":"Hausverbrauch","topic":"openWB/global/WHouseConsumption","qos":"2","datatype":"auto","broker":"c4cb83c8.1bd0c","x":190,"y":420,"wires":[["70cc4c82.4aab14"]]},{"id":"70cc4c82.4aab14","type":"ui_gauge","z":"bbc4c862.00704","name":"","group":"771c4180.25407","order":2,"width":0,"height":0,"gtype":"gage","title":"Hausverbrauch","label":"units","format":"{{value}}","min":0,"max":"6000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":500,"y":420,"wires":[]},{"id":"ab1bb337.18c608","type":"ui_numeric","z":"bbc4c862.00704","name":"","label":"Summe L1..3","tooltip":"","group":"771c4180.25407","order":1,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":0,"max":10,"step":1,"x":730,"y":180,"wires":[[]]},{"id":"968a81b.82d46","type":"inject","z":"bbc4c862.00704","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":90,"y":180,"wires":[["9e1a908d.03d11","e42406ce.b03618","67a0bd38.a3660c"]]},{"id":"a5150192.f53848","type":"combine-statistic","z":"bbc4c862.00704","name":"","topic":" ","operator":"sum","falsy":"include","defer":250,"timeout":0,"distinction":"topic","x":580,"y":180,"wires":[["ab1bb337.18c608"]]},{"id":"d9a283f4.484dc","type":"inject","z":"bbc4c862.00704","name":"LP1 ausschalten","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":190,"y":540,"wires":[["dc6d4e6d.4a879"]]},{"id":"dc6d4e6d.4a879","type":"mqtt out","z":"bbc4c862.00704","name":"","topic":"openWB/lp/1/ChargePointEnabled","qos":"","retain":"","broker":"c4cb83c8.1bd0c","x":480,"y":540,"wires":[]},{"id":"9a128f1d.c9e368","type":"ui_group","name":"Haussimulation","tab":"744b5117.d18b28","order":1,"disp":true,"width":6,"collapse":false},{"id":"c4cb83c8.1bd0c","type":"mqtt-broker","name":"OpenWB","broker":"192.168.8.11","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"30","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"771c4180.25407","type":"ui_group","name":"Group 2","tab":"744b5117.d18b28","order":2,"disp":true,"width":6},{"id":"744b5117.d18b28","type":"ui_tab","name":"Haussimulation","icon":"dashboard","disabled":false,"hidden":false}]
Aber wie immer steckt der Teufel im Detail - die Summierung funktioniert zwar schon ein bisschen, aber noch nicht vollkommen zufriedenstellend. Das liegt meiner Meinung nach daran, dass eine message immer nur dann geschickt wird, wenn man auf den Klickerpfeil drückt - dann fehlt der Summenfunktion aber der Wert der anderen Schieber. Irgendwie muss man da eine message bauen, in der alle Schieberwerte enthalten sind. Oder man nimmt die generelle Funktion, in der man javascript coden kann. Da müsste man sich drei Variablen im Kontext der Node bauen, die den letzten Wert eines jeden Schiebers sich merken. Dafür muss man aber am msg-object erkennen können, von welcher node die message kommt. Keine Ahnung ob das da drinsteht, ich vermute aber mal ja.