NEWS
Payload bedingt ausführen!?
-
Ein fröhliches Hallo in die Runde und direkt den Einstieg ins Forum mit einer Frage zu meinem wundervollen Speicher-Strompreis-Flow. Hiermit möchte ich mich auch direkt als Einsteiger outen in der Hoffnung ein paar Tipps zu erhalten. Mir fehlt tatsächlich an der ein oder andren Stelle noch etwas der Zusammenhang, aber wäre es Einfach würde ich glaube ich Fußball spielen
Nachfolgend der Flow um den es geht. Über ein Injekt Node triggere ich alle 10s die Tibber API an und schiebe über ein Change Node das Preislevel auf payload. Anschließend vergleicht ein Switch die Nachricht und leitet abhängig vom Preislevel (Tibber unterscheidet 5 Level, sehr günstig, günstig, normal, teuer und sehr teuer) an ein Change Node welches über die zulässige Entladeleistung entscheidet und anschließend nur bei einer Wertänderung das entsprechende Modbusregister des Wechselrichters beschreibt.
[ { "id": "e3b6095b776f216f", "type": "tibber-query", "z": "4c142b44a68afed9", "name": "", "active": true, "apiEndpointRef": "1b63eccdbbf38fd0", "x": 470, "y": 600, "wires": [ [ "8239af8e5b6b2e93" ] ] }, { "id": "eb413e79173d257f", "type": "template", "z": "4c142b44a68afed9", "name": "", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "{\n viewer {\n homes {\n currentSubscription {\n status\n priceInfo {\n current {\n total\n energy\n tax\n startsAt\n level\n }\n }\n }\n }\n }\n}", "output": "str", "x": 300, "y": 600, "wires": [ [ "e3b6095b776f216f" ] ] }, { "id": "d1866b867a350156", "type": "inject", "z": "4c142b44a68afed9", "name": "", "props": [], "repeat": "10", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 150, "y": 600, "wires": [ [ "eb413e79173d257f" ] ] }, { "id": "2d198785048c74c4", "type": "group", "z": "4c142b44a68afed9", "name": "Entladeleistung dynamisch anpassen über Preislevel; keine Entladeleistung, reduzierte Entladeleistung oder volle Entladeleistung", "style": { "stroke": "#ff3f3f", "fill": "#ffff7f", "label": true }, "nodes": [ "8239af8e5b6b2e93", "02559a8777eb61d0", "1abbc15570a228bb", "a0cb101ba0e9ed5b", "1d090e62ee6999a5", "31f6b78b4c4306a0", "ddf103ab399188c4", "66d66234c6011f36" ], "x": 574, "y": 519, "w": 1252, "h": 162 }, { "id": "8239af8e5b6b2e93", "type": "change", "z": "4c142b44a68afed9", "g": "2d198785048c74c4", "name": "aktuelles Preislevel", "rules": [ { "t": "move", "p": "payload.viewer.homes[0].currentSubscription.priceInfo.current.level", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 600, "wires": [ [ "02559a8777eb61d0" ] ] }, { "id": "02559a8777eb61d0", "type": "switch", "z": "4c142b44a68afed9", "g": "2d198785048c74c4", "name": "ein/aus", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "VERY_CHEAP", "vt": "str" }, { "t": "eq", "v": "CHEAP", "vt": "str" }, { "t": "eq", "v": "NORMAL", "vt": "str" }, { "t": "eq", "v": "EXPENSIVE", "vt": "str" }, { "t": "eq", "v": "VERY_EXPENSIVE", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 5, "x": 880, "y": 600, "wires": [ [ "a0cb101ba0e9ed5b" ], [ "a0cb101ba0e9ed5b" ], [ "66d66234c6011f36" ], [ "1abbc15570a228bb" ], [ "1abbc15570a228bb" ] ] }, { "id": "1abbc15570a228bb", "type": "change", "z": "4c142b44a68afed9", "g": "2d198785048c74c4", "name": "Entladen max. Leistung", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "100", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1130, "y": 640, "wires": [ [ "31f6b78b4c4306a0" ] ] }, { "id": "a0cb101ba0e9ed5b", "type": "change", "z": "4c142b44a68afed9", "g": "2d198785048c74c4", "name": "nicht Entladen", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "0", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1100, "y": 560, "wires": [ [ "31f6b78b4c4306a0" ] ] }, { "id": "1d090e62ee6999a5", "type": "debug", "z": "4c142b44a68afed9", "g": "2d198785048c74c4", "name": "schreibe Entladeleistung", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1670, "y": 640, "wires": [] }, { "id": "31f6b78b4c4306a0", "type": "rbe", "z": "4c142b44a68afed9", "g": "2d198785048c74c4", "name": "Nur Wertänderung", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": true, "property": "payload", "topi": "topic", "x": 1410, "y": 560, "wires": [ [ "1d090e62ee6999a5", "ddf103ab399188c4" ] ] }, { "id": "ddf103ab399188c4", "type": "modbus-write", "z": "4c142b44a68afed9", "g": "2d198785048c74c4", "name": "schreibe Entladeleistung", "showStatusActivities": true, "showErrors": true, "showWarnings": true, "unitid": "1", "dataType": "HoldingRegister", "adr": "3036", "quantity": "1", "server": "0eb91e2a81e44744", "emptyMsgOnFail": false, "keepMsgProperties": false, "delayOnStart": false, "startDelayTime": "", "x": 1670, "y": 560, "wires": [ [], [] ] }, { "id": "66d66234c6011f36", "type": "change", "z": "4c142b44a68afed9", "g": "2d198785048c74c4", "name": "Entladen konstante Leistung", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "8", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1140, "y": 600, "wires": [ [ "31f6b78b4c4306a0" ] ] }, { "id": "0eb91e2a81e44744", "type": "modbus-client", "name": "Growatt Haus", "clienttype": "tcp", "bufferCommands": true, "stateLogEnabled": true, "queueLogEnabled": true, "failureLogEnabled": true, "tcpHost": "192.168.2.56", "tcpPort": "502", "tcpType": "DEFAULT", "serialPort": "/dev/ttyUSB", "serialType": "RTU-BUFFERD", "serialBaudrate": "9600", "serialDatabits": "8", "serialStopbits": "1", "serialParity": "none", "serialConnectionDelay": "100", "serialAsciiResponseStartDelimiter": "0x3A", "unit_id": 1, "commandDelay": 1, "clientTimeout": 1000, "reconnectOnTimeout": true, "reconnectTimeout": 2000, "parallelUnitIdsAllowed": true, "showErrors": true, "showWarnings": true, "showLogs": true }, { "id": "1b63eccdbbf38fd0", "type": "tibber-api-endpoint", "queryUrl": "https://api.tibber.com/v1-beta/gql", "feedConnectionTimeout": "30", "feedTimeout": "60", "queryRequestTimeout": "30", "name": "" } ]
Soweit so gut, dies funktioniert mittlerweile zur vollsten Zufriedenheit und verhindert, dass mir Nachts der Speicher leergezogen wird und ich morgens den teuren Strom aus dem Netz verbraten muss.
Nun kommt jedoch noch eine Wallbox ins Spiel, sobald diese anfängt das Auto zu laden möchte ich die zulässige Entladeleistung auf 0 setzen. Dies macht allerdings auch schon mein Preislevel, denn wenn der Preis günstig oder sehr günstig ist setze ich mit dem oben beschriebenen Flow die Entladeleistung auch schon auf 0. Jetzt stellt sich mir die Frage, wie ich es hinbekomme, dass das Preislevel keinen Einfluss mehr hat sobald das Auto lädt. Den aktuell würde die Entladeleistung immer springen wenn das Auto lädt und der Strompreis normal wäre, da durch das Laden aktiv die Entladeleistung auf 0 und durch den Strompreis normal die Entladeleistung auf 8 gesetzt werden würde.
Ob die Wallbox aktiv ist bekomme ich übrigens raus, indem ich den Strom der Wallbox auslese und über ein Change Node vergleiche. <=0 Laden nicht aktiv, >=0 Laden aktiv.
Hat hierzu jemand einen Tipp für mich? Würde mich sehr über eine Idee freuen
Vielen Dank und Gruß
Dirk -
@dirkl Du setzt einfach eine Flow Variable mit dem Status des Ladens des Autos und blockierst Deinen obigen Flow mit einer Switch Node, wo immer Du den Flow blockieren willst.
-
Danke für den Tipp, dann werde ich mich mal irgendwie durchhangeln
Habe übrigens eben nochmal den Code korrigiert, hatte irgendwie Mist kopiert
-
@dirkl Hier mal ein Vorschlag mit InjectNodes simuliert:
und hier zum Import:
Du kannst den Filter, um den Flow zu blocken natürlich auch woanders hinsetzen - ich habe ihn halt ganz am Anfang gesetzt, so dass keine unnötigen Abfragen entstehen.
-
@mickym
Mit einem konkreten Beispiel hätte ich nicht gerechnet. Genial, vielen Dank. Dann teste ich mal in Ruhe und hoffe das ich irgendwann hier auch etwas beitragen kannGruß
Dirk -
@mickym
Funktioniert und verstanden, wieder was gelernt Vielen Dank.Gruß
Dirk -
Habe eben noch festgestellt, dass wenn der Flow wieder freigegebene wird der Filter Node nur wieder etwas sendet, wenn ich den Haken bei "Modus für jedes msg.topic separat anwenden" entferne. Lasse ich diese Option aktiv wird zwar mein Flow blockiert und die Entladeleistung auf 0 gesetzt. Sobald der Flow wieder aktiv ist erfolgt aber kein hochsetzten der Entladeleistung. Was sagt denn diese Option aus?
Auffällig ist auch, dass bei aktiver Option zuerst die Entladeleistung auf 0 geht und anschließend wieder erhöht wird. Nachfolgend der entsprechende Code, aber mit dem beschriebenen Phänomen.
[ { "id": "54993410cc0afe59", "type": "tibber-query", "z": "0cfd59449a206aa4", "name": "", "active": true, "apiEndpointRef": "1b63eccdbbf38fd0", "x": 670, "y": 1020, "wires": [ [ "ebc1f61d90ee82a5", "47bcd2bd4a65ba4c" ] ] }, { "id": "f7bf4b57d65305f8", "type": "template", "z": "0cfd59449a206aa4", "name": "", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "{\n viewer {\n homes {\n currentSubscription {\n status\n priceInfo {\n current {\n total\n energy\n tax\n startsAt\n level\n }\n }\n }\n }\n }\n}", "output": "str", "x": 500, "y": 1020, "wires": [ [ "54993410cc0afe59" ] ] }, { "id": "ebc1f61d90ee82a5", "type": "debug", "z": "0cfd59449a206aa4", "name": "Tibber Query", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 890, "y": 1020, "wires": [] }, { "id": "47bcd2bd4a65ba4c", "type": "change", "z": "0cfd59449a206aa4", "g": "c3e359c85d547096", "name": "aktuelles Preislevel", "rules": [ { "t": "move", "p": "payload.viewer.homes[0].currentSubscription.priceInfo.current.level", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 910, "y": 1180, "wires": [ [ "fc18eac988d5b3e0", "8793019e8f212a2f" ] ] }, { "id": "fc18eac988d5b3e0", "type": "switch", "z": "0cfd59449a206aa4", "g": "c3e359c85d547096", "name": "ein/aus", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "VERY_CHEAP", "vt": "str" }, { "t": "eq", "v": "CHEAP", "vt": "str" }, { "t": "eq", "v": "NORMAL", "vt": "str" }, { "t": "eq", "v": "EXPENSIVE", "vt": "str" }, { "t": "eq", "v": "VERY_EXPENSIVE", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 5, "x": 1100, "y": 1180, "wires": [ [ "8d482e9eed414e1d", "4b5b39c7f1e17d76" ], [ "7ed062e762ed59e1", "8d482e9eed414e1d" ], [ "c0aa9af386a60eba", "9220223ab7f8a389" ], [ "a79eaa802b0c5e7f", "2705c69253c32753" ], [ "a79eaa802b0c5e7f", "911079d75ecd8d2c" ] ] }, { "id": "a79eaa802b0c5e7f", "type": "change", "z": "0cfd59449a206aa4", "g": "c3e359c85d547096", "name": "Entladen max. Leistung", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "100", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1350, "y": 1220, "wires": [ [ "4aa010e27e384130" ] ] }, { "id": "8d482e9eed414e1d", "type": "change", "z": "0cfd59449a206aa4", "g": "c3e359c85d547096", "name": "nicht Entladen", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1320, "y": 1140, "wires": [ [ "4aa010e27e384130" ] ] }, { "id": "d72e01d6679c46b4", "type": "debug", "z": "0cfd59449a206aa4", "g": "c3e359c85d547096", "name": "schreibe Entladeleistung", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1890, "y": 1220, "wires": [] }, { "id": "c0aa9af386a60eba", "type": "debug", "z": "0cfd59449a206aa4", "name": "Level NORMAL", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1320, "y": 1440, "wires": [] }, { "id": "4b5b39c7f1e17d76", "type": "debug", "z": "0cfd59449a206aa4", "name": "Level VERY_CHEAP", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1340, "y": 1320, "wires": [] }, { "id": "2705c69253c32753", "type": "debug", "z": "0cfd59449a206aa4", "name": "Level EXPENSIVE", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1330, "y": 1500, "wires": [] }, { "id": "7ed062e762ed59e1", "type": "debug", "z": "0cfd59449a206aa4", "name": "Level CHEAP", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1320, "y": 1380, "wires": [] }, { "id": "911079d75ecd8d2c", "type": "debug", "z": "0cfd59449a206aa4", "name": "Level VERY_EXPENSIVE", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1350, "y": 1560, "wires": [] }, { "id": "4aa010e27e384130", "type": "rbe", "z": "0cfd59449a206aa4", "g": "c3e359c85d547096", "name": "Nur Wertänderung", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 1630, "y": 1140, "wires": [ [ "d72e01d6679c46b4", "bbdbd5d45af572e4" ] ] }, { "id": "bbdbd5d45af572e4", "type": "modbus-write", "z": "0cfd59449a206aa4", "g": "c3e359c85d547096", "name": "schreibe Entladeleistung", "showStatusActivities": true, "showErrors": true, "showWarnings": true, "unitid": "1", "dataType": "HoldingRegister", "adr": "3036", "quantity": "1", "server": "0eb91e2a81e44744", "emptyMsgOnFail": false, "keepMsgProperties": false, "delayOnStart": false, "startDelayTime": "", "x": 1890, "y": 1140, "wires": [ [], [] ] }, { "id": "8793019e8f212a2f", "type": "ui_chart", "z": "0cfd59449a206aa4", "name": "", "group": "a7514a44e87604ef", "order": 6, "width": 0, "height": 0, "label": "aktuelles Preislevel", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "", "ymax": "", "removeOlder": 1, "removeOlderPoints": "", "removeOlderUnit": "3600", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1090, "y": 1340, "wires": [ [] ] }, { "id": "9220223ab7f8a389", "type": "change", "z": "0cfd59449a206aa4", "g": "c3e359c85d547096", "name": "Entladen konstante Leistung", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "8", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1360, "y": 1180, "wires": [ [ "4aa010e27e384130" ] ] }, { "id": "31592e0d5b91904d", "type": "switch", "z": "0cfd59449a206aa4", "name": "Auto wird geladen?", "property": "AutoLaden", "propertyType": "flow", "rules": [ { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 310, "y": 1020, "wires": [ [ "f7bf4b57d65305f8" ] ] }, { "id": "fef0d9bf728b371f", "type": "switch", "z": "0cfd59449a206aa4", "name": "Laden aktiv?", "property": "payload", "propertyType": "msg", "rules": [ { "t": "lte", "v": "0", "vt": "num" }, { "t": "gt", "v": "0", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 970, "y": 940, "wires": [ [ "92d6d927eb198bbf" ], [ "81e9155ca11d1b33", "8d482e9eed414e1d" ] ] }, { "id": "92d6d927eb198bbf", "type": "change", "z": "0cfd59449a206aa4", "name": "", "rules": [ { "t": "set", "p": "AutoLaden", "pt": "flow", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1260, "y": 900, "wires": [ [] ] }, { "id": "81e9155ca11d1b33", "type": "change", "z": "0cfd59449a206aa4", "name": "", "rules": [ { "t": "set", "p": "AutoLaden", "pt": "flow", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1260, "y": 980, "wires": [ [] ] }, { "id": "fad0cb21263ce61f", "type": "inject", "z": "0cfd59449a206aa4", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "Laden Auto", "payload": "0", "payloadType": "num", "x": 750, "y": 920, "wires": [ [ "fef0d9bf728b371f" ] ] }, { "id": "e352195c414d2f94", "type": "inject", "z": "0cfd59449a206aa4", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "Laden Auto", "payload": "50", "payloadType": "num", "x": 770, "y": 960, "wires": [ [ "fef0d9bf728b371f" ] ] }, { "id": "1b63eccdbbf38fd0", "type": "tibber-api-endpoint", "queryUrl": "https://api.tibber.com/v1-beta/gql", "feedConnectionTimeout": "30", "feedTimeout": "60", "queryRequestTimeout": "30", "name": "" }, { "id": "0eb91e2a81e44744", "type": "modbus-client", "name": "Growatt Haus", "clienttype": "tcp", "bufferCommands": true, "stateLogEnabled": true, "queueLogEnabled": true, "failureLogEnabled": true, "tcpHost": "192.168.2.56", "tcpPort": "502", "tcpType": "DEFAULT", "serialPort": "/dev/ttyUSB", "serialType": "RTU-BUFFERD", "serialBaudrate": "9600", "serialDatabits": "8", "serialStopbits": "1", "serialParity": "none", "serialConnectionDelay": "100", "serialAsciiResponseStartDelimiter": "0x3A", "unit_id": 1, "commandDelay": 1, "clientTimeout": 1000, "reconnectOnTimeout": true, "reconnectTimeout": 2000, "parallelUnitIdsAllowed": true, "showErrors": true, "showWarnings": true, "showLogs": true }, { "id": "a7514a44e87604ef", "type": "ui_group", "name": "Standard", "tab": "cc414397ad6a64a0", "order": 1, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "cc414397ad6a64a0", "type": "ui_tab", "name": "Home", "icon": "dashboard", "disabled": false, "hidden": false } ]
-
@dirkl Diesen Haken musst Du immer rausmachen - da du ja nicht unterschiedliche Topics überprüfen willst.