- Home
- Deutsch
- Skripten / Logik
- Node-Red
- Einfache Funktion - Wertüberwachung mit 2 Verzögerungszeiten
Einfache Funktion - Wertüberwachung mit 2 Verzögerungszeiten
-
@mickym Okay ich hab die 2 pfade schon über join zusammengeführt wie in dem Flow von dir der auch schon läuft bei mir.
Und dann die msg.topics schon eindeutig geändert ... ok dann google ich mal weiter ist ja eigentlich nicht so das ich mir alles erschnorren möchte Aber wenn ich grundlegend meine Funktionen mal habe kann ich damit arbeiten.
DANKE -
@i0br0ker Ich stell Dir mal meine Logiknodes zur Verfügung- sitze am Rechner. Und nein mach Dir keine Gedanken zum "Erschnorren" - ich mach das gerne und habe im Moment eh keine Lust an meinen eigenen Projekten zu arbeiten. Deshalb sind solche Hinweise für mich eine willkommene Abwechslung. Ausserdem glaube ich, dass Du vielleicht doch langsam ein Fan von NodeRed wirst und es für Dich nicht eine Last ist, weil es auf der Victron nichts anderes gibt.
-
Hier mal meine Logiknodes zum Import und zum Ausprobieren:
[ { "id": "b52592ecd269d672", "type": "switch", "z": "7e6af0015415146d", "name": "AND?", "property": "$reduce(payload.*,function($i, $j){$i and $j})", "propertyType": "jsonata", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 170, "y": 6320, "wires": [ [], [] ], "info": "# All properties of an object must be true.\n\nAll properties of an object must be true.\n\n`{\n \"Office\": true,\n \"Bedroom\": true,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis true,\n\n`{\n \"Office\": true,\n \"Bedroom\": false,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis false.\n\n# Alle Eigenschaften eines Objektes müssen wahr sein\n\nAlle Eigenschaften eines Objektes müssen wahr sein.\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": true,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt true,\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt false." }, { "id": "b5dd6dc0da9e8c83", "type": "change", "z": "7e6af0015415146d", "name": "AND ?", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$reduce(payload.*,function($i, $j){$i and $j})", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 670, "y": 6500, "wires": [ [ "807f93af8b411c17" ] ], "info": "# All Property of an object must be true.\n\nAll properties of an object must be true.\n\n`{\n \"Office\": true,\n \"Bedroom\": true,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis true,\n\n`{\n \"Office\": true,\n \"Bedroom\": false,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis false.\n\n# Alle Eigenschaften eines Objektes müssen wahr sein\n\nAlle Eigenschaften eines Objektes müssen wahr sein.\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": true,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt true,\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt false." }, { "id": "5be9d6962a70746d", "type": "switch", "z": "7e6af0015415146d", "name": "OR?", "property": "$reduce(payload.*,function($i, $j){$i or $j})", "propertyType": "jsonata", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 330, "y": 6320, "wires": [ [], [] ], "info": "# Only one or more properties of an object need to be true.\n\n Only one or more properties of an object need to be true.\n\n`{\n \"Office\": false,\n \"Bedroom\": false,\n \"Living Room Balcony\": false,\n \"Liviueng Room Right Window\": false,\n \"Living Room Left Window\": false\n}`\n\nis false,\n\n`{\n \"Office\": false,\n \"Bedroom\": true,\n \"Living Room Balcony\": false,\n \"Living Room Right Window\": false,\n \"Living Room Left Window\": false\n}`\n\nis true.\n\n# Mindestens eine Eigenschaft des Objektes muss wahr sein.\n\nMindestens eine Eigenschaft des Objektes muss wahr sein.\n\n`{\n \"Büro Balkon\": false,\n \"Schlafzimmer Balkon\": false,\n \"Wohnzimmer Balkon\": false,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": false\n}`\n\nergibt false,\n\n`{\n \"Büro Balkon\": false,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": false,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": false\n}`\n\nergibt true (wahr)." }, { "id": "cef81d9d372220df", "type": "change", "z": "7e6af0015415146d", "name": "OR ?", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$reduce(payload.*,function($i, $j){$i or $j})", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 330, "y": 6360, "wires": [ [] ], "info": "# Only one or more properties of an object need to be true.\n\n Only one or more properties of an object need to be true.\n\n`{\n \"Office\": false,\n \"Bedroom\": false,\n \"Living Room Balcony\": false,\n \"Liviueng Room Right Window\": false,\n \"Living Room Left Window\": false\n}`\n\nis false,\n\n`{\n \"Office\": false,\n \"Bedroom\": true,\n \"Living Room Balcony\": false,\n \"Living Room Right Window\": false,\n \"Living Room Left Window\": false\n}`\n\nis true.\n\n# Mindestens eine Eigenschaft des Objektes muss wahr sein.\n\nMindestens eine Eigenschaft des Objektes muss wahr sein.\n\n`{\n \"Büro Balkon\": false,\n \"Schlafzimmer Balkon\": false,\n \"Wohnzimmer Balkon\": false,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": false\n}`\n\nergibt false,\n\n`{\n \"Büro Balkon\": false,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": false,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": false\n}`\n\nergibt true (wahr)." }, { "id": "3d479b8d8cf8bb24", "type": "change", "z": "7e6af0015415146d", "name": "NOT", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$not(payload)\t", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 490, "y": 6340, "wires": [ [] ] }, { "id": "fc01283fd925fd9c", "type": "comment", "z": "7e6af0015415146d", "name": "meine Logik-Nodes", "info": "", "x": 190, "y": 6260, "wires": [] }, { "id": "d8880d092aea4bd4", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "topic1", "payload": "true", "payloadType": "bool", "x": 220, "y": 6500, "wires": [ [ "52e5a4db11c00365" ] ] }, { "id": "e7457bc09c39f0a9", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "topic1", "payload": "false", "payloadType": "bool", "x": 210, "y": 6540, "wires": [ [ "52e5a4db11c00365" ] ] }, { "id": "75e97a2f3de610e3", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "topic2", "payload": "true", "payloadType": "bool", "x": 220, "y": 6600, "wires": [ [ "da768d9610d74ace" ] ] }, { "id": "d54b8850e7baeadd", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "topic2", "payload": "false", "payloadType": "bool", "x": 210, "y": 6640, "wires": [ [ "da768d9610d74ace" ] ] }, { "id": "cec439f3f58e485b", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "topic3", "payload": "true", "payloadType": "bool", "x": 220, "y": 6700, "wires": [ [ "8cfb7fe629cb3864" ] ] }, { "id": "fa95f7360b6c91bf", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "topic3", "payload": "false", "payloadType": "bool", "x": 210, "y": 6740, "wires": [ [ "8cfb7fe629cb3864" ] ] }, { "id": "6b338a0f25b8a36a", "type": "join", "z": "7e6af0015415146d", "name": "", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": "1", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 470, "y": 6620, "wires": [ [ "b5dd6dc0da9e8c83", "55d97225125db746", "6dcb71cf2a719263", "5c43e54468acf258" ] ] }, { "id": "807f93af8b411c17", "type": "debug", "z": "7e6af0015415146d", "name": "Ergebnis UND", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 880, "y": 6500, "wires": [] }, { "id": "be836d8c583562d3", "type": "debug", "z": "7e6af0015415146d", "name": "Ergebnis ODER", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 880, "y": 6560, "wires": [] }, { "id": "bee35810b67e0fe3", "type": "debug", "z": "7e6af0015415146d", "name": "Wenn UND = wahr", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 890, "y": 6640, "wires": [] }, { "id": "98788861c8ea3152", "type": "debug", "z": "7e6af0015415146d", "name": "Wenn UND = falsch", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 890, "y": 6680, "wires": [] }, { "id": "6a617a990679ee53", "type": "debug", "z": "7e6af0015415146d", "name": "Wenn ODER = wahr", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 900, "y": 6740, "wires": [] }, { "id": "c16cb77cc5959037", "type": "debug", "z": "7e6af0015415146d", "name": "Wenn ODER = falsch", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 900, "y": 6780, "wires": [] }, { "id": "5c78dfe8762a3c1f", "type": "change", "z": "7e6af0015415146d", "name": "AND ?", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$reduce(payload.*,function($i, $j){$i and $j})", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 170, "y": 6360, "wires": [ [] ], "info": "# All Property of an object must be true.\n\nAll properties of an object must be true.\n\n`{\n \"Office\": true,\n \"Bedroom\": true,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis true,\n\n`{\n \"Office\": true,\n \"Bedroom\": false,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis false.\n\n# Alle Eigenschaften eines Objektes müssen wahr sein\n\nAlle Eigenschaften eines Objektes müssen wahr sein.\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": true,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt true,\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt false." }, { "id": "55d97225125db746", "type": "change", "z": "7e6af0015415146d", "name": "OR ?", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$reduce(payload.*,function($i, $j){$i or $j})", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 670, "y": 6560, "wires": [ [ "be836d8c583562d3" ] ], "info": "# Only one or more properties of an object need to be true.\n\n Only one or more properties of an object need to be true.\n\n`{\n \"Office\": false,\n \"Bedroom\": false,\n \"Living Room Balcony\": false,\n \"Liviueng Room Right Window\": false,\n \"Living Room Left Window\": false\n}`\n\nis false,\n\n`{\n \"Office\": false,\n \"Bedroom\": true,\n \"Living Room Balcony\": false,\n \"Living Room Right Window\": false,\n \"Living Room Left Window\": false\n}`\n\nis true.\n\n# Mindestens eine Eigenschaft des Objektes muss wahr sein.\n\nMindestens eine Eigenschaft des Objektes muss wahr sein.\n\n`{\n \"Büro Balkon\": false,\n \"Schlafzimmer Balkon\": false,\n \"Wohnzimmer Balkon\": false,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": false\n}`\n\nergibt false,\n\n`{\n \"Büro Balkon\": false,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": false,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": false\n}`\n\nergibt true (wahr)." }, { "id": "6dcb71cf2a719263", "type": "switch", "z": "7e6af0015415146d", "name": "AND?", "property": "$reduce(payload.*,function($i, $j){$i and $j})", "propertyType": "jsonata", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 670, "y": 6660, "wires": [ [ "bee35810b67e0fe3" ], [ "98788861c8ea3152" ] ], "info": "# All properties of an object must be true.\n\nAll properties of an object must be true.\n\n`{\n \"Office\": true,\n \"Bedroom\": true,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis true,\n\n`{\n \"Office\": true,\n \"Bedroom\": false,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis false.\n\n# Alle Eigenschaften eines Objektes müssen wahr sein\n\nAlle Eigenschaften eines Objektes müssen wahr sein.\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": true,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt true,\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt false." }, { "id": "5c43e54468acf258", "type": "switch", "z": "7e6af0015415146d", "name": "OR?", "property": "$reduce(payload.*,function($i, $j){$i or $j})", "propertyType": "jsonata", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 670, "y": 6760, "wires": [ [ "6a617a990679ee53" ], [ "c16cb77cc5959037" ] ], "info": "# Only one or more properties of an object need to be true.\n\n Only one or more properties of an object need to be true.\n\n`{\n \"Office\": false,\n \"Bedroom\": false,\n \"Living Room Balcony\": false,\n \"Liviueng Room Right Window\": false,\n \"Living Room Left Window\": false\n}`\n\nis false,\n\n`{\n \"Office\": false,\n \"Bedroom\": true,\n \"Living Room Balcony\": false,\n \"Living Room Right Window\": false,\n \"Living Room Left Window\": false\n}`\n\nis true.\n\n# Mindestens eine Eigenschaft des Objektes muss wahr sein.\n\nMindestens eine Eigenschaft des Objektes muss wahr sein.\n\n`{\n \"Büro Balkon\": false,\n \"Schlafzimmer Balkon\": false,\n \"Wohnzimmer Balkon\": false,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": false\n}`\n\nergibt false,\n\n`{\n \"Büro Balkon\": false,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": false,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": false\n}`\n\nergibt true (wahr)." }, { "id": "471a757274736ce3", "type": "comment", "z": "7e6af0015415146d", "name": "... in Aktion", "info": "", "x": 160, "y": 6440, "wires": [] }, { "id": "52e5a4db11c00365", "type": "junction", "z": "7e6af0015415146d", "x": 320, "y": 6520, "wires": [ [ "016f3a621d800e55" ] ] }, { "id": "da768d9610d74ace", "type": "junction", "z": "7e6af0015415146d", "x": 320, "y": 6620, "wires": [ [ "016f3a621d800e55" ] ] }, { "id": "8cfb7fe629cb3864", "type": "junction", "z": "7e6af0015415146d", "x": 320, "y": 6720, "wires": [ [ "016f3a621d800e55" ] ] }, { "id": "016f3a621d800e55", "type": "junction", "z": "7e6af0015415146d", "x": 380, "y": 6620, "wires": [ [ "6b338a0f25b8a36a" ] ] } ]
Im Prinzip kann auch eine JOIN Node Dir aus mehreren Eigenschaften eines Objektes EIN Ergebnis ermitteln (nicht nur logische Verknüpfungen).
Das benötigt zwar mehr Einarbeitung - aber damit kann man auch selbst Durchschnitte etc. berechnen und ist nicht unbedingt auf fertige Nodes der Community angewiesen - auch wenn man die natürlich nutzen kann. Es gibt auch fertige Boolean Nodes - aber wie gesagt, wenn man mit Standardnodes und JSONATA hinkommt, dann ziehe ich diese Vorgehensweise vor.
-
@i0br0ker sagte in Einfache Funktion - Wertüberwachung mit 2 Verzögerungszeiten:
@mickym Okay ich hab die 2 pfade schon über join zusammengeführt wie in dem Flow von dir der auch schon läuft bei mir.
Und dann die msg.topics schon eindeutig geändert ... ok dann google ich mal weiter ist ja eigentlich nicht so das ich mir alles erschnorren möchte Aber wenn ich grundlegend meine Funktionen mal habe kann ich damit arbeiten.
DANKEAch und beim "Googlen" wirst Du leider feststellen, dass es auch im Netz noch viel zu viele Leute gibt, die herkömmlich mit function Nodes codieren und somit das Potential vorgefertigter Funktionsblöcke (Nodes) nicht zu schätzen oder anzuwenden wissen.
Es gibt Fälle, wo function Nodes Sinn machen - insbesondere wenn man weitere NodeJS Bibliotheken einbinden will, aber ansonsten macht man sich oft viel zu viel Arbeit mit der Codeschreiberei und wie gesagt, viele Nodes können Funktionen, die man ja nicht selbst nachprogrammieren, zusammensuchen oder via KI bekommt und keiner versteht, was der Code tut.
Du kannst auch JEDEN Flow in einer function Node abbilden, sowie Du es am Anfang gemacht hast - aber die Fehlersuche ist viel mühsamer und oft ist das ganze wenig strukturiert (sorry kein Angriff auf Deine Programmierkünste). Ich bin halt jetzt schon oft zu faul, mir im Code alle Möglichkeiten zu überlegen.
Für mich ist es viel einfacher, wenn Du sagst - OK ich habe das Problem, wie kann man es lösen, als wenn man nachher einen fertigen Code "überprüfen" soll.
-
Hier noch ein paar Anregungen - um über Arrays und JOIN Nodess verschiedene Berechnungen zu machen. Ich habe hier nun den Durchschnitt genommen, denn man aber auch in der Sequenz zu reduzieren - mit komplexeren Berechnungen füttern kann. Ich habe nur das Beispiel aus der Hilfe genommen:
Wenn man bereits ein Array hat, dann kann man es direkt über JSONATA oder über eine JOIN Node zu einem Ergebnis überführen:
Nun kann man die JOIN Node bevor man sie reduziert auch zu Erstellung eines Arrays verwenden.
- Nach einer bestimmten Anzahl von Messwerten
- Nach einer bestimmten Zeit.
So kann man also den Durchschnitt zum Beispiel von Messungen innerhalb 1 Minute verwenden.
Nach einer Minute - werden sofern Messwerte angekommen sind, diese automatisch als Array released und können für die Durchschnittsberechnung verwendet werden.
Mit complete kann das Array auch sofort released werden.
So kann man also Messwerte beliebig innerhalb einer Zeiteinheit konsolidieren - wie max, min etc. - das geht also alles mit Boardmitteln (wobei es für diese einfachen Funktionen, JSONATA Funktionen gibt, so dass man die Reduzierung nicht über eine JOIN Node machen muss.)
Hier wieder zum Ausprobieren:
[ { "id": "4a38c02fa8d419eb", "type": "join", "z": "7e6af0015415146d", "name": "", "mode": "reduce", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": "", "reduceRight": false, "reduceExp": "$A+payload", "reduceInit": "0", "reduceInitType": "num", "reduceFixup": "$A/$N", "x": 690, "y": 6960, "wires": [ [ "f2f6a6b833d0cbe3" ] ] }, { "id": "1b8c4632e6aa8fc2", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "[15,20,6,8]", "payloadType": "json", "x": 180, "y": 6960, "wires": [ [ "4f41141b7fdc6049", "a685b310bd5cad08" ] ] }, { "id": "4f41141b7fdc6049", "type": "split", "z": "7e6af0015415146d", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 350, "y": 6960, "wires": [ [ "4a38c02fa8d419eb" ] ] }, { "id": "f2f6a6b833d0cbe3", "type": "debug", "z": "7e6af0015415146d", "name": "Sequenz reduzieren => Mittelwert", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 940, "y": 6960, "wires": [] }, { "id": "a685b310bd5cad08", "type": "change", "z": "7e6af0015415146d", "name": "... Mit JSONATA", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$average(payload)\t", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 380, "y": 6900, "wires": [ [ "f55364965ba0031a" ] ] }, { "id": "f55364965ba0031a", "type": "debug", "z": "7e6af0015415146d", "name": "Durchschnitt - dafür braucht man in der Regel keine Node", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 750, "y": 6900, "wires": [] }, { "id": "b592a118eb019814", "type": "join", "z": "7e6af0015415146d", "name": "", "mode": "reduce", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": "", "reduceRight": false, "reduceExp": "$A+payload", "reduceInit": "0", "reduceInitType": "num", "reduceFixup": "$A/$N", "x": 690, "y": 7160, "wires": [ [ "2f5807d58b630812" ] ] }, { "id": "2f5807d58b630812", "type": "debug", "z": "7e6af0015415146d", "name": "Sequenz reduzieren => Mittelwert", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 960, "y": 7160, "wires": [] }, { "id": "f477a7db73cc1533", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "6", "payloadType": "num", "x": 210, "y": 7140, "wires": [ [ "35287ce1b1118281" ] ] }, { "id": "9034307ed6ff36a5", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "8", "payloadType": "num", "x": 210, "y": 7180, "wires": [ [ "35287ce1b1118281" ] ] }, { "id": "6e9f0e588c13de80", "type": "debug", "z": "7e6af0015415146d", "name": "test array", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 520, "y": 7220, "wires": [] }, { "id": "c830f915a6f2df47", "type": "inject", "z": "7e6af0015415146d", "name": "complete", "props": [ { "p": "complete", "v": "true", "vt": "bool" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 200, "y": 7240, "wires": [ [ "35287ce1b1118281" ] ] }, { "id": "35287ce1b1118281", "type": "join", "z": "7e6af0015415146d", "name": "", "mode": "custom", "build": "array", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": false, "timeout": "60", "count": "", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 370, "y": 7160, "wires": [ [ "992a3b14e76080d8", "6e9f0e588c13de80", "f4f51d2cdd158174" ] ] }, { "id": "992a3b14e76080d8", "type": "split", "z": "7e6af0015415146d", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 510, "y": 7160, "wires": [ [ "b592a118eb019814" ] ] }, { "id": "f4f51d2cdd158174", "type": "change", "z": "7e6af0015415146d", "name": "... Mit JSONATA", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$average(payload)\t", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 540, "y": 7100, "wires": [ [ "5715eda0b05a7e22" ] ] }, { "id": "5715eda0b05a7e22", "type": "debug", "z": "7e6af0015415146d", "name": "Durchschnitt - dafür braucht man in der Regel keine Node", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 910, "y": 7100, "wires": [] } ]
-
@mickym iss mir alles dann irgendwie zu hoch.
Ich programmiere normalerweise SPS Siemens S7 , Wago usw ...Hier bekomm ich auf beiden true pfaden immer das gleiche topic ... und das UND von dir sagt undefined ..
Ich hätte erwartet das pro letztem True das enstprechende Topic auch auf dem Pfad kommt.
[ { "id": "8a9f2e53cba0f9db", "type": "mqtt in", "z": "dc34425fdcbad6f6", "name": "", "topic": "openWB/housebattery/W", "qos": "2", "datatype": "auto-detect", "broker": "25bae39f364832cf", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 110, "y": 620, "wires": [ [ "710bbfb486a16c1c" ] ] }, { "id": "042f531628c05590", "type": "debug", "z": "dc34425fdcbad6f6", "name": "SMA Ladung", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 350, "y": 600, "wires": [] }, { "id": "1289f2571390bf1d", "type": "mqtt in", "z": "dc34425fdcbad6f6", "name": "", "topic": "openWB/housebattery/%Soc", "qos": "2", "datatype": "auto-detect", "broker": "25bae39f364832cf", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 120, "y": 780, "wires": [ [ "da65b9c21543aaef" ] ] }, { "id": "5755a104d1fefad9", "type": "debug", "z": "dc34425fdcbad6f6", "name": "SMA SOC", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 350, "y": 960, "wires": [] }, { "id": "319c2ca6a53bb7bd", "type": "join", "z": "dc34425fdcbad6f6", "name": "", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": false, "timeout": "", "count": "2", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 450, "y": 740, "wires": [ [ "7a7ae0708f9c160e", "2ce6b6ac8beaaac7" ] ] }, { "id": "9ad4a20bd808759f", "type": "change", "z": "dc34425fdcbad6f6", "name": "SMAcharge", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "SMAcharge", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 270, "y": 700, "wires": [ [ "042f531628c05590", "319c2ca6a53bb7bd" ] ] }, { "id": "d1476c81b719d3da", "type": "change", "z": "dc34425fdcbad6f6", "name": "SMAsoc", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "SMAsoc", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 260, "y": 860, "wires": [ [ "5755a104d1fefad9", "319c2ca6a53bb7bd" ] ] }, { "id": "710bbfb486a16c1c", "type": "rbe", "z": "dc34425fdcbad6f6", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 90, "y": 700, "wires": [ [ "9ad4a20bd808759f" ] ] }, { "id": "da65b9c21543aaef", "type": "rbe", "z": "dc34425fdcbad6f6", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 90, "y": 860, "wires": [ [ "d1476c81b719d3da" ] ] }, { "id": "2ce6b6ac8beaaac7", "type": "switch", "z": "dc34425fdcbad6f6", "name": "", "property": "payload.SMAsoc", "propertyType": "msg", "rules": [ { "t": "lt", "v": "49", "vt": "num" }, { "t": "btwn", "v": "49", "vt": "num", "v2": "55", "v2t": "num" }, { "t": "gt", "v": "55", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 550, "y": 880, "wires": [ [ "139b9845ae856742", "f65081881e7f66b3" ], [ "6d3df0cbf367ec31" ], [ "a3f73d4f7afb5fbf", "146e9ccbe758b0b9" ] ] }, { "id": "7a7ae0708f9c160e", "type": "switch", "z": "dc34425fdcbad6f6", "name": "", "property": "payload.SMAcharge", "propertyType": "msg", "rules": [ { "t": "lt", "v": "2500", "vt": "num" }, { "t": "btwn", "v": "2500", "vt": "num", "v2": "3800", "v2t": "num" }, { "t": "gt", "v": "3800", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 550, "y": 640, "wires": [ [ "edabec89dec66e03", "2614728e8f3a3b36" ], [ "67c43fd717fc2e41" ], [ "1267fb0309718af7", "a1f415285d8f9ca9" ] ] }, { "id": "139b9845ae856742", "type": "trigger", "z": "dc34425fdcbad6f6", "name": "setze false", "op1": "", "op2": "false", "op1type": "nul", "op2type": "bool", "duration": "5", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 890, "y": 860, "wires": [ [] ] }, { "id": "a3f73d4f7afb5fbf", "type": "trigger", "z": "dc34425fdcbad6f6", "name": "setze true", "op1": "", "op2": "true", "op1type": "nul", "op2type": "bool", "duration": "5", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 900, "y": 920, "wires": [ [ "8c491c4d16d701ec", "d888575ab7360fee" ] ] }, { "id": "f65081881e7f66b3", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 710, "y": 800, "wires": [ [ "a3f73d4f7afb5fbf" ] ] }, { "id": "6d3df0cbf367ec31", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 710, "y": 880, "wires": [ [ "139b9845ae856742", "a3f73d4f7afb5fbf" ] ] }, { "id": "146e9ccbe758b0b9", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 710, "y": 960, "wires": [ [ "139b9845ae856742" ] ] }, { "id": "edabec89dec66e03", "type": "trigger", "z": "dc34425fdcbad6f6", "name": "setze false", "op1": "", "op2": "true", "op1type": "nul", "op2type": "bool", "duration": "5", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 890, "y": 620, "wires": [ [] ] }, { "id": "1267fb0309718af7", "type": "trigger", "z": "dc34425fdcbad6f6", "name": "setze true", "op1": "", "op2": "true", "op1type": "nul", "op2type": "bool", "duration": "5", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 900, "y": 680, "wires": [ [ "8c491c4d16d701ec" ] ] }, { "id": "2614728e8f3a3b36", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 710, "y": 560, "wires": [ [ "1267fb0309718af7" ] ] }, { "id": "67c43fd717fc2e41", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 710, "y": 640, "wires": [ [ "edabec89dec66e03", "1267fb0309718af7" ] ] }, { "id": "a1f415285d8f9ca9", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 710, "y": 720, "wires": [ [ "edabec89dec66e03" ] ] }, { "id": "d888575ab7360fee", "type": "debug", "z": "dc34425fdcbad6f6", "name": "UND", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1270, "y": 860, "wires": [] }, { "id": "8c491c4d16d701ec", "type": "change", "z": "dc34425fdcbad6f6", "name": "AND ?", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$reduce(payload.*,function($i, $j){$i and $j})", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1090, "y": 740, "wires": [ [] ], "info": "# All Property of an object must be true.\n\nAll properties of an object must be true.\n\n`{\n \"Office\": true,\n \"Bedroom\": true,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis true,\n\n`{\n \"Office\": true,\n \"Bedroom\": false,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis false.\n\n# Alle Eigenschaften eines Objektes müssen wahr sein\n\nAlle Eigenschaften eines Objektes müssen wahr sein.\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": true,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt true,\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt false." }, { "id": "25bae39f364832cf", "type": "mqtt-broker", "name": "OpenWB4", "broker": "192.168.123.14", "port": "1883", "clientid": "", "autoConnect": true, "usetls": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "autoUnsubscribe": true, "birthTopic": "", "birthQos": "0", "birthRetain": "false", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closeRetain": "false", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willRetain": "false", "willPayload": "", "willMsg": {}, "userProps": "", "sessionExpiry": "" } ]
-
@i0br0ker Na schau Dir halt meinen Flow - an Du musst das doch alles in ein payload Objekt mit einer JOIN Node zusammenfassen bevor du die AND Node verwendest. Ich schau mir Deinen Flow an und komm ggf. mit Fragen nochmal auf Dich zu diese UND Node analysiert Objekte und keine skalaren Werte. Du musst alles in Objekten sammeln.
-
Du hast die JOIN Node nur an die falsche Stelle gesetzt - müsste so funktionieren - sonst müssen wir uns das mit Debug Nodes anschauen.
Dieser Filter am Anfang wird bei Messwerten nicht viel bringen, da ja nur identische Werte geblockt werden. Ändern sich das nur um 0.1 Watt schon wird das durchgelassen - also ggf. den Nahbandfilter verwenden.
Ach und ich sehe gerade - Du hast ja in den trigger Node 2 mal true gesetzt - das musst Du noch korrigieren.
So nun müsste der Reimport stimmen:
[ { "id": "8a9f2e53cba0f9db", "type": "mqtt in", "z": "7e6af0015415146d", "name": "", "topic": "openWB/housebattery/W", "qos": "2", "datatype": "auto-detect", "broker": "25bae39f364832cf", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 230, "y": 7560, "wires": [ [ "710bbfb486a16c1c" ] ] }, { "id": "042f531628c05590", "type": "debug", "z": "7e6af0015415146d", "name": "SMA Ladung", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 470, "y": 7540, "wires": [] }, { "id": "1289f2571390bf1d", "type": "mqtt in", "z": "7e6af0015415146d", "name": "", "topic": "openWB/housebattery/%Soc", "qos": "2", "datatype": "auto-detect", "broker": "25bae39f364832cf", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 240, "y": 7720, "wires": [ [ "da65b9c21543aaef" ] ] }, { "id": "5755a104d1fefad9", "type": "debug", "z": "7e6af0015415146d", "name": "SMA SOC", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 470, "y": 7900, "wires": [] }, { "id": "9ad4a20bd808759f", "type": "change", "z": "7e6af0015415146d", "name": "SMAcharge", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "SMAcharge", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 390, "y": 7640, "wires": [ [ "042f531628c05590", "7a7ae0708f9c160e" ] ] }, { "id": "d1476c81b719d3da", "type": "change", "z": "7e6af0015415146d", "name": "SMAsoc", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "SMAsoc", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 380, "y": 7800, "wires": [ [ "5755a104d1fefad9", "2ce6b6ac8beaaac7" ] ] }, { "id": "710bbfb486a16c1c", "type": "rbe", "z": "7e6af0015415146d", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 210, "y": 7640, "wires": [ [ "9ad4a20bd808759f" ] ] }, { "id": "da65b9c21543aaef", "type": "rbe", "z": "7e6af0015415146d", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 210, "y": 7800, "wires": [ [ "d1476c81b719d3da" ] ] }, { "id": "2ce6b6ac8beaaac7", "type": "switch", "z": "7e6af0015415146d", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "lt", "v": "49", "vt": "num" }, { "t": "btwn", "v": "49", "vt": "num", "v2": "55", "v2t": "num" }, { "t": "gt", "v": "55", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 670, "y": 7820, "wires": [ [ "139b9845ae856742", "f65081881e7f66b3" ], [ "6d3df0cbf367ec31" ], [ "a3f73d4f7afb5fbf", "146e9ccbe758b0b9" ] ] }, { "id": "7a7ae0708f9c160e", "type": "switch", "z": "7e6af0015415146d", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "lt", "v": "2500", "vt": "num" }, { "t": "btwn", "v": "2500", "vt": "num", "v2": "3800", "v2t": "num" }, { "t": "gt", "v": "3800", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 670, "y": 7580, "wires": [ [ "edabec89dec66e03", "2614728e8f3a3b36" ], [ "67c43fd717fc2e41" ], [ "1267fb0309718af7", "a1f415285d8f9ca9" ] ] }, { "id": "139b9845ae856742", "type": "trigger", "z": "7e6af0015415146d", "name": "setze false", "op1": "", "op2": "false", "op1type": "nul", "op2type": "bool", "duration": "5", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 1050, "y": 7800, "wires": [ [ "597dd89bf81c8972" ] ] }, { "id": "a3f73d4f7afb5fbf", "type": "trigger", "z": "7e6af0015415146d", "name": "setze true", "op1": "", "op2": "true", "op1type": "nul", "op2type": "bool", "duration": "5", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 1060, "y": 7880, "wires": [ [ "597dd89bf81c8972" ] ] }, { "id": "f65081881e7f66b3", "type": "change", "z": "7e6af0015415146d", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 7760, "wires": [ [ "a3f73d4f7afb5fbf" ] ] }, { "id": "6d3df0cbf367ec31", "type": "change", "z": "7e6af0015415146d", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 7840, "wires": [ [ "139b9845ae856742", "a3f73d4f7afb5fbf" ] ] }, { "id": "146e9ccbe758b0b9", "type": "change", "z": "7e6af0015415146d", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 7900, "wires": [ [ "139b9845ae856742" ] ] }, { "id": "edabec89dec66e03", "type": "trigger", "z": "7e6af0015415146d", "name": "setze false", "op1": "", "op2": "false", "op1type": "nul", "op2type": "bool", "duration": "5", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 1050, "y": 7560, "wires": [ [ "597dd89bf81c8972" ] ] }, { "id": "1267fb0309718af7", "type": "trigger", "z": "7e6af0015415146d", "name": "setze true", "op1": "", "op2": "true", "op1type": "nul", "op2type": "bool", "duration": "5", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 1060, "y": 7660, "wires": [ [ "597dd89bf81c8972" ] ] }, { "id": "2614728e8f3a3b36", "type": "change", "z": "7e6af0015415146d", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 7520, "wires": [ [ "1267fb0309718af7" ] ] }, { "id": "67c43fd717fc2e41", "type": "change", "z": "7e6af0015415146d", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 7600, "wires": [ [ "edabec89dec66e03", "1267fb0309718af7" ] ] }, { "id": "a1f415285d8f9ca9", "type": "change", "z": "7e6af0015415146d", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 7680, "wires": [ [ "edabec89dec66e03" ] ] }, { "id": "d888575ab7360fee", "type": "debug", "z": "7e6af0015415146d", "name": "UND", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1590, "y": 7700, "wires": [] }, { "id": "8c491c4d16d701ec", "type": "change", "z": "7e6af0015415146d", "name": "AND ?", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$reduce(payload.*,function($i, $j){$i and $j})", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1430, "y": 7700, "wires": [ [ "d888575ab7360fee" ] ], "info": "# All Property of an object must be true.\n\nAll properties of an object must be true.\n\n`{\n \"Office\": true,\n \"Bedroom\": true,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis true,\n\n`{\n \"Office\": true,\n \"Bedroom\": false,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis false.\n\n# Alle Eigenschaften eines Objektes müssen wahr sein\n\nAlle Eigenschaften eines Objektes müssen wahr sein.\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": true,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt true,\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt false." }, { "id": "597dd89bf81c8972", "type": "join", "z": "7e6af0015415146d", "name": "", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": "2", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 1290, "y": 7700, "wires": [ [ "8c491c4d16d701ec" ] ] }, { "id": "25bae39f364832cf", "type": "mqtt-broker", "name": "OpenWB4", "broker": "192.168.123.14", "port": "1883", "clientid": "", "autoConnect": true, "usetls": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "autoUnsubscribe": true, "birthTopic": "", "birthQos": "0", "birthRetain": "false", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closeRetain": "false", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willRetain": "false", "willPayload": "", "willMsg": {}, "userProps": "", "sessionExpiry": "" } ]
-
@mickym
Das 2 mal true hatte ich eben zum testen gemacht ... ohne die ersten Filter ging die Berechnung beim Start irgendwie nicht wirklich bzw. bei SOC kommen sehr wenige Werte über MQTT und ich hatte das Gefühl das der Filter das Buffert irgendwieWas ich halt vor habe ist folgendes:
Je nach SMAsoc und SMAcharge wert ( Auswertung hab ich ja gemacht ) soll jetzt der SMAcharge Wert auf meine Berechnung der "Ursprungsfrage" addiert werden.Also wenn beide true sind möchte ich den SMAcharge Wert hier mit aufadieren ....
-
@i0br0ker Ah Ok ich verstehe und arbeite - dann verwendest Du auch besser eine andere Nachrichteneigenschaft zum addieren. OK - ich arbeite ....
-
@i0br0ker sagte in Einfache Funktion - Wertüberwachung mit 2 Verzögerungszeiten:
@mickym
Das 2 mal true hatte ich eben zum testen gemacht ... ohne die ersten Filter ging die Berechnung beim Start irgendwie nicht wirklich bzw. bei SOC kommen sehr wenige Werte über MQTT und ich hatte das Gefühl das der Filter das Buffert irgendwieWas ich halt vor habe ist folgendes:
Je nach SMAsoc und SMAcharge wert ( Auswertung hab ich ja gemacht ) soll jetzt der SMAcharge Wert auf meine Berechnung der "Ursprungsfrage" addiert werden.Also wenn beide true sind möchte ich den SMAcharge Wert hier mit aufadieren ....
Also wenn true aus dem jetztigen Flow dann soll das passieren?
Dann wäre es sinnvoller all diese Inputs in einen Flow Kontext zu packen. OK?
sprich schreib die aktuellen Werte netz in einer Flowvariable, verbrauchDC in eine Flowvariable etc. - Ich mach das mal mit Inject Nodes.
-
@mickym
Dann soll praktisch der Wert SMAcharge noch mit drauf addiert werden in den alten flow -
@i0br0ker Also wir haben einmal Netz und SMACharge.
Also speichern wir das mal in Flowvariablen, OK?
Als ergänze deine Change Node entsprechend, bitte wie oben abgebildet.
Woher bekomme ich Netz kann ich das mit Inject Node simulieren.
Ich habe jetzt mal folgende Werte im Flowkontext gespeichert:
SMACharge wie gesagt wie vorher in die Change Node mit aufgenommen.
So hier die modifizierten NOdes zum Anhängen an den letzten Flow (wie gesagt fehlende Werte über den Flowkontext in diesem Flow rein holen).
[ { "id": "60301a70f297d447", "type": "switch", "z": "7e6af0015415146d", "name": "AND?", "property": "$reduce(payload.*,function($i, $j){$i and $j})", "propertyType": "jsonata", "rules": [ { "t": "true" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 1430, "y": 7700, "wires": [ [ "d888575ab7360fee", "b20ba726d88da12f" ] ], "info": "# All properties of an object must be true.\n\nAll properties of an object must be true.\n\n`{\n \"Office\": true,\n \"Bedroom\": true,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis true,\n\n`{\n \"Office\": true,\n \"Bedroom\": false,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis false.\n\n# Alle Eigenschaften eines Objektes müssen wahr sein\n\nAlle Eigenschaften eines Objektes müssen wahr sein.\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": true,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt true,\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt false." }, { "id": "d888575ab7360fee", "type": "debug", "z": "7e6af0015415146d", "name": "UND", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1630, "y": 7800, "wires": [] }, { "id": "adcd9409b12f3bb2", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "50", "payloadType": "num", "x": 1370, "y": 7400, "wires": [ [ "33bf712ae8c4b1e2" ] ] }, { "id": "33bf712ae8c4b1e2", "type": "change", "z": "7e6af0015415146d", "name": "", "rules": [ { "t": "set", "p": "netz", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1540, "y": 7400, "wires": [ [] ] }, { "id": "f5217ea1ff8a95ab", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "+50", "payloadType": "num", "x": 1370, "y": 7480, "wires": [ [ "469f3a148143d8ea" ] ] }, { "id": "469f3a148143d8ea", "type": "change", "z": "7e6af0015415146d", "name": "", "rules": [ { "t": "set", "p": "verbrauchAC", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1570, "y": 7480, "wires": [ [] ] }, { "id": "e4b98fb5a4d3fd22", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "-50", "payloadType": "num", "x": 1370, "y": 7440, "wires": [ [ "75d6c6ee2f8e2599" ] ] }, { "id": "75d6c6ee2f8e2599", "type": "change", "z": "7e6af0015415146d", "name": "", "rules": [ { "t": "set", "p": "verbrauchDC", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1570, "y": 7440, "wires": [ [] ] }, { "id": "b20ba726d88da12f", "type": "switch", "z": "7e6af0015415146d", "name": "verbrauchDC < 0 ?", "property": "verbrauchDC", "propertyType": "flow", "rules": [ { "t": "lt", "v": "0", "vt": "num" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1630, "y": 7700, "wires": [ [ "ff681c7f22ccb7ae" ], [ "527710ec97a474b8" ] ] }, { "id": "527710ec97a474b8", "type": "change", "z": "7e6af0015415146d", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "netz", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1850, "y": 7740, "wires": [ [ "9c58499af8418c39" ] ] }, { "id": "ff681c7f22ccb7ae", "type": "change", "z": "7e6af0015415146d", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "netz", "tot": "flow" }, { "t": "set", "p": "SMAcharge", "pt": "msg", "to": "SMAcharge", "tot": "flow" }, { "t": "set", "p": "payload", "pt": "msg", "to": "payload + SMAcharge", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1850, "y": 7660, "wires": [ [ "9c58499af8418c39" ] ] }, { "id": "9c58499af8418c39", "type": "debug", "z": "7e6af0015415146d", "name": "Netzberechnung", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 2080, "y": 7700, "wires": [] } ]
Mann kann auch überr die JSONATA Funktion $flowContext("Variablenname") direkt auf die Werte von Flowvariablen zugreifen, wenn Du willst und muss die nicht in das Nachrichtenobjekt holen.
-
@mickym Never ending story
Ich bin auf der zielgeraden ...
Aber diese Funktion macht leider nichts das UND wird nicht ausgelöst.
Ich vermute weil über den unteren MQTT Connect nur sehr selten was kommt.
Wie kann ich das denn zwischenspeichern oder beheben?
[ { "id": "8a9f2e53cba0f9db", "type": "mqtt in", "z": "dc34425fdcbad6f6", "name": "", "topic": "openWB/housebattery/W", "qos": "2", "datatype": "auto-detect", "broker": "25bae39f364832cf", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 620, "wires": [ [ "710bbfb486a16c1c" ] ] }, { "id": "042f531628c05590", "type": "debug", "z": "dc34425fdcbad6f6", "name": "SMA Ladung", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 490, "y": 580, "wires": [] }, { "id": "1289f2571390bf1d", "type": "mqtt in", "z": "dc34425fdcbad6f6", "name": "", "topic": "openWB/housebattery/%Soc", "qos": "0", "datatype": "auto-detect", "broker": "25bae39f364832cf", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 180, "y": 860, "wires": [ [ "da65b9c21543aaef" ] ] }, { "id": "5755a104d1fefad9", "type": "debug", "z": "dc34425fdcbad6f6", "name": "SMA SOC", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 450, "y": 1000, "wires": [] }, { "id": "9ad4a20bd808759f", "type": "change", "z": "dc34425fdcbad6f6", "name": "SMAcharge", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "SMAcharge", "tot": "str" }, { "t": "set", "p": "SMAcharge", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 330, "y": 700, "wires": [ [ "042f531628c05590", "7a7ae0708f9c160e" ] ] }, { "id": "d1476c81b719d3da", "type": "change", "z": "dc34425fdcbad6f6", "name": "SMAsoc", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "SMAsoc", "tot": "str" }, { "t": "set", "p": "SMAsoc", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 320, "y": 940, "wires": [ [ "5755a104d1fefad9", "2ce6b6ac8beaaac7", "c9e121e18c3858cb" ] ] }, { "id": "710bbfb486a16c1c", "type": "rbe", "z": "dc34425fdcbad6f6", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 150, "y": 700, "wires": [ [ "9ad4a20bd808759f" ] ] }, { "id": "da65b9c21543aaef", "type": "rbe", "z": "dc34425fdcbad6f6", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 150, "y": 940, "wires": [ [ "d1476c81b719d3da" ] ] }, { "id": "2ce6b6ac8beaaac7", "type": "switch", "z": "dc34425fdcbad6f6", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "lt", "v": "49", "vt": "num" }, { "t": "btwn", "v": "49", "vt": "num", "v2": "55", "v2t": "num" }, { "t": "gt", "v": "55", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 510, "y": 940, "wires": [ [ "139b9845ae856742", "f65081881e7f66b3" ], [ "6d3df0cbf367ec31" ], [ "a3f73d4f7afb5fbf", "146e9ccbe758b0b9" ] ] }, { "id": "7a7ae0708f9c160e", "type": "switch", "z": "dc34425fdcbad6f6", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "lt", "v": "1500", "vt": "num" }, { "t": "btwn", "v": "1500", "vt": "num", "v2": "3800", "v2t": "num" }, { "t": "gt", "v": "3800", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 510, "y": 700, "wires": [ [ "edabec89dec66e03", "2614728e8f3a3b36" ], [ "67c43fd717fc2e41" ], [ "1267fb0309718af7", "a1f415285d8f9ca9" ] ] }, { "id": "139b9845ae856742", "type": "trigger", "z": "dc34425fdcbad6f6", "name": "setze false", "op1": "", "op2": "false", "op1type": "nul", "op2type": "bool", "duration": "60", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 870, "y": 880, "wires": [ [ "edf0fcde21432d8f" ] ] }, { "id": "a3f73d4f7afb5fbf", "type": "trigger", "z": "dc34425fdcbad6f6", "name": "setze true", "op1": "", "op2": "true", "op1type": "nul", "op2type": "bool", "duration": "60", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 880, "y": 980, "wires": [ [ "7e5a064ccd5b98b9" ] ] }, { "id": "f65081881e7f66b3", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 860, "wires": [ [ "a3f73d4f7afb5fbf" ] ] }, { "id": "6d3df0cbf367ec31", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 940, "wires": [ [ "139b9845ae856742", "a3f73d4f7afb5fbf" ] ] }, { "id": "146e9ccbe758b0b9", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 730, "y": 1000, "wires": [ [ "139b9845ae856742" ] ] }, { "id": "edabec89dec66e03", "type": "trigger", "z": "dc34425fdcbad6f6", "name": "setze false", "op1": "", "op2": "false", "op1type": "nul", "op2type": "bool", "duration": "60", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 870, "y": 640, "wires": [ [ "9cb270a3cc1dbcba" ] ] }, { "id": "1267fb0309718af7", "type": "trigger", "z": "dc34425fdcbad6f6", "name": "setze true", "op1": "", "op2": "true", "op1type": "nul", "op2type": "bool", "duration": "60", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 860, "y": 720, "wires": [ [ "f6a8cb46c61a8f11" ] ] }, { "id": "2614728e8f3a3b36", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 620, "wires": [ [ "1267fb0309718af7" ] ] }, { "id": "67c43fd717fc2e41", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 700, "wires": [ [ "edabec89dec66e03", "1267fb0309718af7" ] ] }, { "id": "a1f415285d8f9ca9", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 760, "wires": [ [ "edabec89dec66e03" ] ] }, { "id": "f6a8cb46c61a8f11", "type": "rbe", "z": "dc34425fdcbad6f6", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 1030, "y": 720, "wires": [ [ "fc6969463c24a6b0" ] ] }, { "id": "fdf451d9f508d165", "type": "change", "z": "dc34425fdcbad6f6", "name": "AND ?", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$reduce(payload.*,function($i, $j){$i and $j})", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1250, "y": 800, "wires": [ [ "a68dfdf79d15a609" ] ], "info": "# All Property of an object must be true.\n\nAll properties of an object must be true.\n\n`{\n \"Office\": true,\n \"Bedroom\": true,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis true,\n\n`{\n \"Office\": true,\n \"Bedroom\": false,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis false.\n\n# Alle Eigenschaften eines Objektes müssen wahr sein\n\nAlle Eigenschaften eines Objektes müssen wahr sein.\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": true,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt true,\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt false." }, { "id": "7e5a064ccd5b98b9", "type": "rbe", "z": "dc34425fdcbad6f6", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 1010, "y": 980, "wires": [ [ "fc6969463c24a6b0" ] ] }, { "id": "fc6969463c24a6b0", "type": "join", "z": "dc34425fdcbad6f6", "name": "", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": false, "timeout": "", "count": "2", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 1130, "y": 800, "wires": [ [ "fdf451d9f508d165" ] ] }, { "id": "a68dfdf79d15a609", "type": "change", "z": "dc34425fdcbad6f6", "name": "Force -1500", "rules": [ { "t": "set", "p": "forcevictron", "pt": "flow", "to": "-1500", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1410, "y": 800, "wires": [ [] ] }, { "id": "12d3de1061f8cd89", "type": "change", "z": "dc34425fdcbad6f6", "name": "Force 0", "rules": [ { "t": "set", "p": "forcevictron", "pt": "flow", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1400, "y": 880, "wires": [ [] ] }, { "id": "edf0fcde21432d8f", "type": "rbe", "z": "dc34425fdcbad6f6", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 1010, "y": 880, "wires": [ [ "12d3de1061f8cd89" ] ] }, { "id": "9cb270a3cc1dbcba", "type": "rbe", "z": "dc34425fdcbad6f6", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 1030, "y": 640, "wires": [ [ "12d3de1061f8cd89" ] ] }, { "id": "c9e121e18c3858cb", "type": "switch", "z": "dc34425fdcbad6f6", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "lt", "v": "94", "vt": "num" }, { "t": "btwn", "v": "94", "vt": "num", "v2": "95", "v2t": "num" }, { "t": "gt", "v": "95", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 530, "y": 1160, "wires": [ [ "77dd766d73980f05" ], [ "4021a2f868b6ef56" ], [ "185d0153538ea72e", "a68dfdf79d15a609" ] ] }, { "id": "77dd766d73980f05", "type": "trigger", "z": "dc34425fdcbad6f6", "name": "setze false", "op1": "", "op2": "false", "op1type": "nul", "op2type": "bool", "duration": "60", "extend": false, "overrideDelay": true, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 890, "y": 1100, "wires": [ [ "ac2af08c0f7ccd9b" ] ] }, { "id": "4021a2f868b6ef56", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 710, "y": 1160, "wires": [ [ "77dd766d73980f05" ] ] }, { "id": "185d0153538ea72e", "type": "change", "z": "dc34425fdcbad6f6", "name": "reset", "rules": [ { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 710, "y": 1220, "wires": [ [ "77dd766d73980f05" ] ] }, { "id": "ac2af08c0f7ccd9b", "type": "rbe", "z": "dc34425fdcbad6f6", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": false, "property": "payload", "topi": "topic", "x": 1030, "y": 1100, "wires": [ [ "12d3de1061f8cd89" ] ] }, { "id": "25bae39f364832cf", "type": "mqtt-broker", "name": "OpenWB4", "broker": "192.168.123.14", "port": "1883", "clientid": "", "autoConnect": true, "usetls": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "autoUnsubscribe": true, "birthTopic": "", "birthQos": "0", "birthRetain": "false", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closeRetain": "false", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willRetain": "false", "willPayload": "", "willMsg": {}, "userProps": "", "sessionExpiry": "" } ]
-
@i0br0ker Sorry - aber ich habe Dir eine ganz andere Lösung gepostet und habe Dir das mit Zwischenspeicher in den Flowvariablen gepostet.
Außerdem hat die Frequenz damit gar nichts zu tun. Wenn Du meine UND Node nutzen würdest, wie ich gepostet habe und dort ein Debug anhängst, dann siehst Du jeweils das ganze Objekt.Tut mir leid, aber wenn ich mir schon die Mühe mache, Dir eine Lösung zu präsentieren und Du ignorierst das einfach, dann hat das einen gewaltigen Einfluss auf meine Motivation.
-
@mickym Na ja ich hab halt jetzt stunden dran gebastelt mit den Grundlagen von dir, damit es das macht was ich letztlich möchte - ich muss es scheinbar über ein join zusammenführen ganz am Anfang damit der Trigger von dem anderen MQTT wert halt kommt und den SOC wert dann "mitnimmt".
-
@i0br0ker Na ja wenn Du es besser weißt - dann musst Du halt auch mit der Logik selbst klar kommen.
Alleine das hier ist doch gelinde gesagt "Schwachsinn". Aus diesem Objekt mit 2 mal true wird jede AND verknüpfung immer true ergeben. Wie gesagt, wenn Du das Prinzip verstanden hast, dann solltest Du ja den Rest ohne meine Hilfe erledigen können.
Nimm Inject Nodes und Debug Nodes. Setze sie an verschiedene Stellen und prüfe Deine Logik. So wird das jedenfalls nichts. Insbesondere wenn Du dann noch filter Nodes hinter die trigger Nodes setzt. Damit kommt genau einmal ein true raus und dann nie wieder was - da die filter Node alles blockiert, solange keine Wertänderung (und nach dem ja nur true kommt - wird die filter Node alles bis in alle Ewigkeit blockieren) stattfindet. Das dürfte auch Dein Problem sein. Aber sowas kannst Du ja nun selbst rausfinden.
-
@mickym hmm zum einen will ja ich nur 1 true oder false im wechsel und nicht ständig trues oder false ..
Weil die Anlage im Hintergrund noch per Hand übersteuert werden kann und sonst immer wieder "zurück" springt.
Und ich möchte wenn beide Ausgänge true sind durch das AND wissen das beide true sind und erst dann weiter machen.Es funktioniert soweit auch jetzt ich hab die Filter direkt am Anfang raus genommen war ja klar das der SOC sich nicht sekündlich ändert .. denkfehler
Danke bis hier hin für die Anstöße und die Hilfe
-
@i0br0ker Wie gesagt hier nochmal zum Abschluss um mein Geschriebenes auszuprobieren und wie gesagt, das solltest Du halt selbst machen:
Mach diese Inject Node vor den Filter und eine Debug Node dahinter und schau, ob Du nach der 1. Nachricht noch jemals was raus bringst.
[ { "id": "38380c7431f79978", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "SMAcharge", "payload": "true", "payloadType": "bool", "x": 900, "y": 7280, "wires": [ [ "f6a8cb46c61a8f11" ] ] }, { "id": "f260b3dadb7efeb5", "type": "debug", "z": "7e6af0015415146d", "name": "teste filter", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1300, "y": 7220, "wires": [] } ]
Ansonsten dann viel Glück und Gelingen. Ich bin dann erst mal raus.