- ioBroker Community Home
- Deutsch
- Skripten / Logik
- Node-Red
- Node Red Flow Werte vergleichen
NEWS
Node Red Flow Werte vergleichen
-
Hallo,
Ich benötige Hilfe bei einem flow. Ich bin da am verzweifeln. Habe es Sundenlang versucht und google bringt mich nicht weiter.
Ich habe eine node die mir 1 oder 2 ausgibt
Eine zweite node gibt mir 3 oder 4 aus.1 bedeutet daheim Person 1
2 bedeutet nicht daheim Person 13 bedeutet daheim Person 2
4 bedeutet nicht daheim Person 2Die Ausgabe müsste sein einer weg(Person 1 oder 2), beide weg beide daheim
vlt kann mir hier jemand helfen, das wäre wirklich sehr nett.
Danke
Mousenray
-
Hallo,
Ich benötige Hilfe bei einem flow. Ich bin da am verzweifeln. Habe es Sundenlang versucht und google bringt mich nicht weiter.
Ich habe eine node die mir 1 oder 2 ausgibt
Eine zweite node gibt mir 3 oder 4 aus.1 bedeutet daheim Person 1
2 bedeutet nicht daheim Person 13 bedeutet daheim Person 2
4 bedeutet nicht daheim Person 2Die Ausgabe müsste sein einer weg(Person 1 oder 2), beide weg beide daheim
vlt kann mir hier jemand helfen, das wäre wirklich sehr nett.
Danke
Mousenray
@mousenray Finde zwar diese Zahlen mit den Personen etwas eigenartig, aber jeder wie er mag. ;)
Hier mal ein Vorschlag:

[ { "id": "520b6c0934f33782", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "1", "payloadType": "num", "x": 130, "y": 2680, "wires": [ [ "40df5071ec88ea95" ] ] }, { "id": "e23fb862b9a58495", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "2", "payloadType": "num", "x": 130, "y": 2720, "wires": [ [ "40df5071ec88ea95" ] ] }, { "id": "16165bcebb279065", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "3", "payloadType": "num", "x": 130, "y": 2780, "wires": [ [ "40df5071ec88ea95" ] ] }, { "id": "52529e19f90021de", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "4", "payloadType": "num", "x": 130, "y": 2820, "wires": [ [ "40df5071ec88ea95" ] ] }, { "id": "40df5071ec88ea95", "type": "change", "z": "7e6af0015415146d", "name": "wieder in Personen wandeln", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "\"Person \" & ($floor((payload-1)/2) + 1)", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "payload % 2", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 380, "y": 2740, "wires": [ [ "498f5def46a8c9c9" ] ] }, { "id": "498f5def46a8c9c9", "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": 590, "y": 2740, "wires": [ [ "cb655b5d69808d8a", "0a344758c59647c4" ] ] }, { "id": "cb655b5d69808d8a", "type": "debug", "z": "7e6af0015415146d", "name": "Personenstatus", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 780, "y": 2680, "wires": [] }, { "id": "0a344758c59647c4", "type": "split", "z": "7e6af0015415146d", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 750, "y": 2740, "wires": [ [ "56eac638f7ba4894" ] ] }, { "id": "56eac638f7ba4894", "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": "", "x": 890, "y": 2740, "wires": [ [ "73e6f13cc632894c", "f0c36b93a59e2371" ] ] }, { "id": "73e6f13cc632894c", "type": "debug", "z": "7e6af0015415146d", "name": "Anzahl Personen zuhause", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1110, "y": 2680, "wires": [] }, { "id": "f0c36b93a59e2371", "type": "change", "z": "7e6af0015415146d", "name": "", "rules": [ { "t": "change", "p": "payload", "pt": "msg", "from": "0", "fromt": "num", "to": "Keiner daheim", "tot": "str" }, { "t": "change", "p": "payload", "pt": "msg", "from": "1", "fromt": "num", "to": "Einer von beiden daheim", "tot": "str" }, { "t": "change", "p": "payload", "pt": "msg", "from": "2", "fromt": "num", "to": "Beide daheim", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1070, "y": 2740, "wires": [ [ "9568f12ecdabc626" ] ] }, { "id": "9568f12ecdabc626", "type": "debug", "z": "7e6af0015415146d", "name": "Text", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1270, "y": 2740, "wires": [] } ]Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.
-
@mousenray Finde zwar diese Zahlen mit den Personen etwas eigenartig, aber jeder wie er mag. ;)
Hier mal ein Vorschlag:

[ { "id": "520b6c0934f33782", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "1", "payloadType": "num", "x": 130, "y": 2680, "wires": [ [ "40df5071ec88ea95" ] ] }, { "id": "e23fb862b9a58495", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "2", "payloadType": "num", "x": 130, "y": 2720, "wires": [ [ "40df5071ec88ea95" ] ] }, { "id": "16165bcebb279065", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "3", "payloadType": "num", "x": 130, "y": 2780, "wires": [ [ "40df5071ec88ea95" ] ] }, { "id": "52529e19f90021de", "type": "inject", "z": "7e6af0015415146d", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "4", "payloadType": "num", "x": 130, "y": 2820, "wires": [ [ "40df5071ec88ea95" ] ] }, { "id": "40df5071ec88ea95", "type": "change", "z": "7e6af0015415146d", "name": "wieder in Personen wandeln", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "\"Person \" & ($floor((payload-1)/2) + 1)", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "payload % 2", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 380, "y": 2740, "wires": [ [ "498f5def46a8c9c9" ] ] }, { "id": "498f5def46a8c9c9", "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": 590, "y": 2740, "wires": [ [ "cb655b5d69808d8a", "0a344758c59647c4" ] ] }, { "id": "cb655b5d69808d8a", "type": "debug", "z": "7e6af0015415146d", "name": "Personenstatus", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 780, "y": 2680, "wires": [] }, { "id": "0a344758c59647c4", "type": "split", "z": "7e6af0015415146d", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 750, "y": 2740, "wires": [ [ "56eac638f7ba4894" ] ] }, { "id": "56eac638f7ba4894", "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": "", "x": 890, "y": 2740, "wires": [ [ "73e6f13cc632894c", "f0c36b93a59e2371" ] ] }, { "id": "73e6f13cc632894c", "type": "debug", "z": "7e6af0015415146d", "name": "Anzahl Personen zuhause", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1110, "y": 2680, "wires": [] }, { "id": "f0c36b93a59e2371", "type": "change", "z": "7e6af0015415146d", "name": "", "rules": [ { "t": "change", "p": "payload", "pt": "msg", "from": "0", "fromt": "num", "to": "Keiner daheim", "tot": "str" }, { "t": "change", "p": "payload", "pt": "msg", "from": "1", "fromt": "num", "to": "Einer von beiden daheim", "tot": "str" }, { "t": "change", "p": "payload", "pt": "msg", "from": "2", "fromt": "num", "to": "Beide daheim", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1070, "y": 2740, "wires": [ [ "9568f12ecdabc626" ] ] }, { "id": "9568f12ecdabc626", "type": "debug", "z": "7e6af0015415146d", "name": "Text", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1270, "y": 2740, "wires": [] } ]