Closed Schmetterfliege closed 10 months ago
Hi You don’t have to reset it. Let me see your flow. Send a screenshot and the flow code.
Thanks for your fast response!
It works fine if it is with the delay + "change" node after that, which is just sending some random payload to reset it.
If I just disconnect this change node from the boolean node, it will break.
Triggerin again will have the first message -> reset <- the node, and the 2nd message will be the only topic to arrive at the boolean node
[ { "id": "ca2db94df5453b0c", "type": "inject", "z": "46acc2e9e80ed87b", "name": "", "props": [ { "p": "payload.contact", "v": "Schlafzimmer", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 70, "y": 1320, "wires": [ [ "963b782565edb342" ] ] }, { "id": "963b782565edb342", "type": "function", "z": "46acc2e9e80ed87b", "name": "function 5", "func": "msg.payload = [true,true];\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 200, "y": 1320, "wires": [ [ "b87432c8602c8d10" ] ] }, { "id": "b87432c8602c8d10", "type": "split", "z": "46acc2e9e80ed87b", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 330, "y": 1320, "wires": [ [ "b9a4763129a6962f" ] ] }, { "id": "b9a4763129a6962f", "type": "change", "z": "46acc2e9e80ed87b", "name": "", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "_msgid", "tot": "msg" }, { "t": "move", "p": "payload", "pt": "msg", "to": "payload.contact", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 490, "y": 1320, "wires": [ [ "620279a03d59c4d8" ] ] }, { "id": "620279a03d59c4d8", "type": "BooleanLogicUltimate", "z": "46acc2e9e80ed87b", "name": "", "payloadPropName": "payload.contact", "filtertrue": "onlytrue", "persist": false, "sInitializeWith": "WaitForPayload", "triggertopic": "Schlafzimmer", "outputtriggeredby": "all", "inputCount": 2, "topic": "result", "restrictinputevaluation": false, "delayEvaluation": "0", "x": 700, "y": 1260, "wires": [ [ "572421dc0a9a423b", "8360826113984666" ], [ "3023edf51d6cea1d" ], [ "1ebf05e4a7085868", "8360826113984666" ] ] }, { "id": "4c3635964a1a954b", "type": "change", "z": "46acc2e9e80ed87b", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "true", "tot": "bool" }, { "t": "move", "p": "payload", "pt": "msg", "to": "payload.contact", "tot": "msg" }, { "t": "set", "p": "topic", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 530, "y": 1380, "wires": [ [ "620279a03d59c4d8" ] ] }, { "id": "572421dc0a9a423b", "type": "debug", "z": "46acc2e9e80ed87b", "name": "AND", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 950, "y": 1240, "wires": [] }, { "id": "8360826113984666", "type": "delay", "z": "46acc2e9e80ed87b", "name": "", "pauseType": "delay", "timeout": "50", "timeoutUnits": "milliseconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 950, "y": 1380, "wires": [ [ "4c3635964a1a954b" ] ] }, { "id": "3023edf51d6cea1d", "type": "debug", "z": "46acc2e9e80ed87b", "name": "OR", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 950, "y": 1280, "wires": [] }, { "id": "1ebf05e4a7085868", "type": "debug", "z": "46acc2e9e80ed87b", "name": "XOR", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 950, "y": 1320, "wires": [] } ]
So like this, it breaks. Just disconnect the change node with 3 rules, from the boolean node
https://1drv.ms/v/s!Ar-LSzjpd359izqW326Ve5Jf3RKO?e=zv2W2A
I made a quick video with my phone, so I can proof it if you are not able to reproduce it with my code haha :D EDIT: I just updated the node to 1.1.0, but still the same result :(
Hi Thank you for sharing your flow. The problem is here:
_msgit changes everytime a new message arrives. The node needs 2 fixed topics.
Please see my correction here:
And the corrected flow:
[{"id":"ca2db94df5453b0c","type":"inject","z":"4a897568afaa4560","name":"","props":[{"p":"payload.contact","v":"Schlafzimmer","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":90,"y":180,"wires":[["963b782565edb342"]]},{"id":"963b782565edb342","type":"function","z":"4a897568afaa4560","name":"function 5","func":"msg.payload = [{key:\"ein\", value:true},{key:\"zwei\", value:true}];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":220,"y":180,"wires":[["b87432c8602c8d10"]]},{"id":"b87432c8602c8d10","type":"split","z":"4a897568afaa4560","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":350,"y":180,"wires":[["b9a4763129a6962f"]]},{"id":"b9a4763129a6962f","type":"change","z":"4a897568afaa4560","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.key","tot":"msg"},{"t":"move","p":"payload","pt":"msg","to":"payload.contact","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":180,"wires":[["620279a03d59c4d8"]]},{"id":"620279a03d59c4d8","type":"BooleanLogicUltimate","z":"4a897568afaa4560","name":"","payloadPropName":"payload.contact.value","filtertrue":"onlytrue","persist":false,"sInitializeWith":"WaitForPayload","triggertopic":"Schlafzimmer","outputtriggeredby":"all","inputCount":2,"topic":"result","restrictinputevaluation":false,"delayEvaluation":"0","translatorConfig":"","x":720,"y":120,"wires":[["572421dc0a9a423b","8360826113984666"],["3023edf51d6cea1d"],["1ebf05e4a7085868","8360826113984666"]]},{"id":"4c3635964a1a954b","type":"change","z":"4a897568afaa4560","d":true,"name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"},{"t":"move","p":"payload","pt":"msg","to":"payload.contact","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":240,"wires":[["620279a03d59c4d8"]]},{"id":"572421dc0a9a423b","type":"debug","z":"4a897568afaa4560","name":"AND","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":970,"y":100,"wires":[]},{"id":"8360826113984666","type":"delay","z":"4a897568afaa4560","d":true,"name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":970,"y":240,"wires":[["4c3635964a1a954b"]]},{"id":"3023edf51d6cea1d","type":"debug","z":"4a897568afaa4560","name":"OR","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":970,"y":140,"wires":[]},{"id":"1ebf05e4a7085868","type":"debug","z":"4a897568afaa4560","name":"XOR","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":970,"y":180,"wires":[]}]
I'm not sure what do you want to achieve, so i've modified your test flow.
Hi, sorry for the late response, couldn't test it earlier today :( I just made the changes to have input 1 and input 2 have the same topic each all the time (input 1 topic = A, input 2 topic = B), and it technically works. But: When I trigger it the first time, it gives me the results once. Each time I trigger it after the first time, it gives me the results twice :( In the video I used exactly your flow, without changing anything. Exact same result as I got after doing the changes to my flow.
Hi, in suggest you to carefully read the README page here on github, to take a look at the youtube video (you'll find the link in the node config window) and to take a look at the help tab. You are passing "true" as payload every time, so the behaviour is correct. The node sends TRUE on the AND pin and TRUE on the OR pin, hence you see the two messages, belonging to AND and OR debug nodes.
Hey,
that was not what I meant. I have disabled the OR and XOR debug nodes to make it more clear. First trigger: 1 AND debug message every trigger afterwards: 2 AND debug messages
Hi Yes, that’s the correct behavior. You are sending an array with two messages, so you’ll have always 2 output messages. Why are you sending the messages via such a complicated way? You are still sending two messages with “true” payload. Is there a reason for that?
So, what I'm trying to do: I have like 8 contact sensors, and 5 radiators. There are 5 rooms, 3 of them have only 1 contact sensor, 2 of them have 2 contact sensors. Let's say room A and room B are the rooms that have 2 contact sensors, the other 3 can be ignored. When a contact sensor is chaning it's status to closed, I need to make sure that in that room BOTH contact sensors are closed. All states are stored in global context. So when a contact sensor changes to "closed", I load the contact sensor states into the payload. I then split this into each separate contact sensor, then I check if the current contact sensor has the same payload.room as the one that triggered the flow, so only the data from the corresponding room gets sent to the boolean node. And with that boolean node I want to check whether both are closed (= true) and only then turn back on the radiator.
When I run it the FIRST time, I only get 1(!) output from the boolean node, which is exactly what I need.
But when I then trigger it again, I always get the output from the boolean node TWICE.
Even though the input is always exactly the same.
So first trigger = it works fine 2nd, 3rd, 4th, etc. trigger = output is always doubled
From my understanding I obviously have to send 2 messages, to be able to compare them with the boolean node. With one message I can only check 1 payload and that payload can't have 2 values, right?
Like I understand the issue, but not how to solve it (besides sending a 3 topic to reset the boolean node). When I run it the first time, it compars topic A and topic B and gives the output. But it saves both topics. If I run it again then, it compares topic A to earlier topic A und topic B to earlier topic B, and this gives an output for topic A and topic B. And this I don't want, since it changes the result. How can I overcome this? Like, make sure that the boolean node "resets" after it was run?
I solved it by just using a function node and doing the comparison manually :D
Yes I was suggesting you to use javascript! You seems to be a c# developer, or similar. Nodered is powerful, but if you don’t use javascript, you cannot achieve such results!! Good job.
Thank you very much for your support and enduring my stupidity :D :)
I'm trying to figure out how to get this node working for a flow that is triggering as soon as a contact sensor closes. Basically, my problem is that this node needs to be reset once it did the evaluation. E.g.: evaluate 2 inputs, works fine. Evaluate again doesn't work since the first input after that is resetting the node, and then it only receives the 2nd one. I don't really understand why it is like that? I specifically configure the node to wait for 2 inputs. It received the 2 inputs and gave me an output. Why do I need to "manually" reset it before I can use it again?