Have Objects in msg, need to take actions based on one of the payload codes

So sorry I missed that. However when setting it to the state of the input, the UI switch icon does not update via UI press neither when the UI switch is coupled or decoupled from the incoming rtl_433 parts of the flow. Said another way...stand alone UI switch simply wired to send the python script, then clicked via the UI...no icon update, but indeed the relay state changes. Second try, connect the rtl_433 part of the flow to the input of the switch, still no icon update.

Here is what it looks like in the flow...the graphic is set to off...the message that last passed is on:
ioswitch

Further testing shows I may have something proceeding the switch incorrect. This simple flow verifies what you state should happen Colin. The switch icon does appropriately update with this setup.
boolinj

Well....I have the switch status now updating according to the new input message, however with the checkbox on the UI switch set to not pass through, now the node attached to the UI Switch output (which is the python script that sends the 433 code) does not activate. I am stumped. If anyone is still willing to assist, below is the flow I have been messing with for testing

[{"id":"18e8e789.778a08","type":"tab","label":"Translate 433mhz","disabled":false,"info":""},{"id":"68134d2b.4fc204","type":"debug","z":"18e8e789.778a08","name":"From rtl_433","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":110,"y":80,"wires":[]},{"id":"31e8fc24.42c854","type":"rtl_433","z":"18e8e789.778a08","name":"","device":"","frequency":"","protocols":"","x":90,"y":20,"wires":[["68134d2b.4fc204","a153d738.c85908"]]},{"id":"a153d738.c85908","type":"switch","z":"18e8e789.778a08","name":"","property":"payload.code","propertyType":"msg","rules":[{"t":"eq","v":"450513","vt":"str"},{"t":"eq","v":"8529fb","vt":"str"},{"t":"eq","v":"2529fb","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":290,"y":35.5,"wires":[["98768616.8d5188"],[],[]],"outputLabels":["relay 1","relay 2","relay 3"]},{"id":"2f917e27.809da2","type":"mqtt out","z":"18e8e789.778a08","name":"","topic":"Relay_1","qos":"0","retain":"true","broker":"98e43eb6.346e2","x":500,"y":40,"wires":[]},{"id":"38d8e069.8596d","type":"ui_switch","z":"18e8e789.778a08","name":"","label":"Relay #1","tooltip":"","group":"dce9e7a2.d20c78","order":4,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"Relay 1","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":920,"y":160,"wires":[["306abda4.e31ad2","cd668987.36ce98"]]},{"id":"306abda4.e31ad2","type":"change","z":"18e8e789.778a08","name":"copy msg.payload --> flow.relay1","rules":[{"t":"set","p":"relay1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":804,"y":240,"wires":[["2c70fbb1.e85804"]]},{"id":"cd668987.36ce98","type":"exec","z":"18e8e789.778a08","command":"python3 send.py -p 367 -t 1 13148322","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Relay #1 Send Code","x":1160,"y":160,"wires":[["66b2d671.f35108"],["42ff3b56.3b5184"],["e9127a68.ee2328"]]},{"id":"98768616.8d5188","type":"change","z":"18e8e789.778a08","name":"copy flow.relay1 --> msg.payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"relay1","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":184,"y":160,"wires":[["d81f173e.5ee2b8","afa62b39.2c6098"]]},{"id":"d81f173e.5ee2b8","type":"switch","z":"18e8e789.778a08","name":"is payload true or false?","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":457,"y":160,"wires":[["f5f80e84.274ab","e3b16575.341ab8"],["b9f164e3.15b8b8","98223be9.ed36f8"]]},{"id":"b9f164e3.15b8b8","type":"change","z":"18e8e789.778a08","name":"if false, set to true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":180,"wires":[["32e70ffb.52415","38d8e069.8596d"]]},{"id":"f5f80e84.274ab","type":"change","z":"18e8e789.778a08","name":"if true, set to false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":140,"wires":[["38d8e069.8596d","5b40682c.520e68"]]},{"id":"afa62b39.2c6098","type":"debug","z":"18e8e789.778a08","name":"1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":170,"y":220,"wires":[]},{"id":"e3b16575.341ab8","type":"debug","z":"18e8e789.778a08","name":"from payload check top","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":470,"y":100,"wires":[]},{"id":"2c70fbb1.e85804","type":"debug","z":"18e8e789.778a08","name":"2nd relay state","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1060,"y":300,"wires":[]},{"id":"98223be9.ed36f8","type":"debug","z":"18e8e789.778a08","name":"from payload check bottom","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":440,"y":220,"wires":[]},{"id":"5b40682c.520e68","type":"debug","z":"18e8e789.778a08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":970,"y":80,"wires":[]},{"id":"b71e8ba1.a118c8","type":"ui_switch","z":"18e8e789.778a08","name":"test switch","label":"Test Switch","tooltip":"","group":"dce9e7a2.d20c78","order":3,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":450,"y":440,"wires":[[]]},{"id":"f43ca71c.df5a38","type":"inject","z":"18e8e789.778a08","name":"inject boolean true","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":220,"y":400,"wires":[["b71e8ba1.a118c8"]]},{"id":"de779ef.f18c36","type":"inject","z":"18e8e789.778a08","name":"inject boolean false","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":210,"y":480,"wires":[["b71e8ba1.a118c8","b089f283.13567"]]},{"id":"d7fcbe60.8603b","type":"inject","z":"18e8e789.778a08","name":"inject boolean true","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":710,"y":40,"wires":[["f5f80e84.274ab"]]},{"id":"ff53209d.dd4f9","type":"inject","z":"18e8e789.778a08","name":"inject boolean false","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":490,"y":280,"wires":[["b9f164e3.15b8b8"]]},{"id":"b089f283.13567","type":"debug","z":"18e8e789.778a08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":540,"wires":[]},{"id":"32e70ffb.52415","type":"debug","z":"18e8e789.778a08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1090,"y":220,"wires":[]},{"id":"66b2d671.f35108","type":"debug","z":"18e8e789.778a08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1220,"y":60,"wires":[]},{"id":"42ff3b56.3b5184","type":"debug","z":"18e8e789.778a08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1330,"y":280,"wires":[]},{"id":"e9127a68.ee2328","type":"debug","z":"18e8e789.778a08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1290,"y":340,"wires":[]},{"id":"98e43eb6.346e2","type":"mqtt-broker","name":"P-Pi-Gibson","broker":"192.168.1.101","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"dce9e7a2.d20c78","type":"ui_group","name":"Object detection","tab":"5132060d.4cde48","order":1,"disp":true,"width":"7","collapse":false},{"id":"5132060d.4cde48","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

What did you change that made the switch output not work? Did you change the output that the switch sends?

[Edit] Back at my computer now so had a look at the flow.

It is difficult to see how that can be the case as the output of the ui_switch goes directly to the exec node. Add another debug node showing what is coming out of the switch node, give all the relevant debug nodes names so you can identify them in the debug, then deploy and click the switch. What do you see in the debug pane?

Here is the flow with debugs renamed"

[{"id":"18e8e789.778a08","type":"tab","label":"Translate 433mhz","disabled":false,"info":""},{"id":"68134d2b.4fc204","type":"debug","z":"18e8e789.778a08","name":"From rtl_433","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":110,"y":80,"wires":[]},{"id":"31e8fc24.42c854","type":"rtl_433","z":"18e8e789.778a08","name":"","device":"","frequency":"","protocols":"","x":90,"y":20,"wires":[["68134d2b.4fc204","a153d738.c85908"]]},{"id":"a153d738.c85908","type":"switch","z":"18e8e789.778a08","name":"","property":"payload.code","propertyType":"msg","rules":[{"t":"eq","v":"450513","vt":"str"},{"t":"eq","v":"8529fb","vt":"str"},{"t":"eq","v":"2529fb","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":290,"y":35.5,"wires":[["98768616.8d5188"],[],[]],"outputLabels":["relay 1","relay 2","relay 3"]},{"id":"2f917e27.809da2","type":"mqtt out","z":"18e8e789.778a08","name":"","topic":"Relay_1","qos":"0","retain":"true","broker":"98e43eb6.346e2","x":500,"y":40,"wires":[]},{"id":"38d8e069.8596d","type":"ui_switch","z":"18e8e789.778a08","name":"","label":"Relay #1","tooltip":"","group":"dce9e7a2.d20c78","order":4,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"Relay 1","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":920,"y":160,"wires":[["306abda4.e31ad2","cd668987.36ce98"]]},{"id":"306abda4.e31ad2","type":"change","z":"18e8e789.778a08","name":"copy msg.payload --> flow.relay1","rules":[{"t":"set","p":"relay1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":804,"y":240,"wires":[["2c70fbb1.e85804"]]},{"id":"cd668987.36ce98","type":"exec","z":"18e8e789.778a08","command":"python3 send.py -p 367 -t 1 13148322","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Relay #1 Send Code","x":1160,"y":160,"wires":[["66b2d671.f35108"],["42ff3b56.3b5184"],["e9127a68.ee2328"]]},{"id":"98768616.8d5188","type":"change","z":"18e8e789.778a08","name":"copy flow.relay1 --> msg.payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"relay1","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":184,"y":160,"wires":[["d81f173e.5ee2b8","afa62b39.2c6098"]]},{"id":"d81f173e.5ee2b8","type":"switch","z":"18e8e789.778a08","name":"is payload true or false?","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":457,"y":160,"wires":[["f5f80e84.274ab","e3b16575.341ab8"],["b9f164e3.15b8b8","98223be9.ed36f8"]]},{"id":"b9f164e3.15b8b8","type":"change","z":"18e8e789.778a08","name":"if false, set to true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":180,"wires":[["32e70ffb.52415","38d8e069.8596d"]]},{"id":"f5f80e84.274ab","type":"change","z":"18e8e789.778a08","name":"if true, set to false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":140,"wires":[["38d8e069.8596d","5b40682c.520e68"]]},{"id":"afa62b39.2c6098","type":"debug","z":"18e8e789.778a08","name":"from read the initial relay state","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":190,"y":260,"wires":[]},{"id":"e3b16575.341ab8","type":"debug","z":"18e8e789.778a08","name":"from payload check top","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":450,"y":100,"wires":[]},{"id":"2c70fbb1.e85804","type":"debug","z":"18e8e789.778a08","name":"from copy UI switch state","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1090,"y":300,"wires":[]},{"id":"98223be9.ed36f8","type":"debug","z":"18e8e789.778a08","name":"from payload check bottom","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":440,"y":220,"wires":[]},{"id":"5b40682c.520e68","type":"debug","z":"18e8e789.778a08","name":"from if true set false","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":990,"y":80,"wires":[]},{"id":"b71e8ba1.a118c8","type":"ui_switch","z":"18e8e789.778a08","name":"test switch","label":"Test Switch","tooltip":"","group":"dce9e7a2.d20c78","order":3,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":450,"y":440,"wires":[[]]},{"id":"f43ca71c.df5a38","type":"inject","z":"18e8e789.778a08","name":"inject boolean true","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":220,"y":400,"wires":[["b71e8ba1.a118c8"]]},{"id":"de779ef.f18c36","type":"inject","z":"18e8e789.778a08","name":"inject boolean false","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":210,"y":480,"wires":[["b71e8ba1.a118c8","b089f283.13567"]]},{"id":"d7fcbe60.8603b","type":"inject","z":"18e8e789.778a08","name":"inject boolean true","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":710,"y":40,"wires":[["f5f80e84.274ab"]]},{"id":"ff53209d.dd4f9","type":"inject","z":"18e8e789.778a08","name":"inject boolean false","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":490,"y":280,"wires":[["b9f164e3.15b8b8"]]},{"id":"b089f283.13567","type":"debug","z":"18e8e789.778a08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":540,"wires":[]},{"id":"32e70ffb.52415","type":"debug","z":"18e8e789.778a08","name":"from if false set true","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1110,"y":220,"wires":[]},{"id":"66b2d671.f35108","type":"debug","z":"18e8e789.778a08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1330,"y":80,"wires":[]},{"id":"42ff3b56.3b5184","type":"debug","z":"18e8e789.778a08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1350,"y":160,"wires":[]},{"id":"e9127a68.ee2328","type":"debug","z":"18e8e789.778a08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1330,"y":220,"wires":[]},{"id":"98e43eb6.346e2","type":"mqtt-broker","name":"P-Pi-Gibson","broker":"192.168.1.101","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"dce9e7a2.d20c78","type":"ui_group","name":"Object detection","tab":"5132060d.4cde48","order":1,"disp":true,"width":"7","collapse":false},{"id":"5132060d.4cde48","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

Below is the output from clicking the UI switch from within NR
uiclick
The relay does activate from this UI click, however the graphic does not change status.

But now with this flow, the 433 button press does not change the graphic and subsequently the set node that copies the switch state does not get the new switch state payload that is to be read at the start of the flow from when the rtl_433 node triggers.

I have just deleted the last post, in case you were trying to understand it.
Show us what comes out of the rtl node.

Understood, essentially it is the trigger that starts the flow which can also be accomplished by an inject timestamp node. For all intents and purposes, the rtl_433 node is looking at the captured 433mhz signals being read. I am then using the switch node to look for the specific code being transmitted by my wall switch, when the switch node sees that code it is directed to the #1 output of the switch node which then triggers the next node which is supposed to read the state of the UI switch stored from its last state. But since the checkbox for "Pass through msg if payload matches new state: " on that UI switch is unchecked, that state never changes.

Here is the switch node configuration immediately after the rtl_433, where I am looking at the payload and directing the output(s) based upon the code seen:
look for code

Output #1 is then connected to the rest of the flow

Not thinking that this is relevant, but here is the output of the rtl_433:

rtl output

Thank you!

How do you know the actual state of the device in the real world?

Good question...The relay(s) are on my workbench for now during development so it is easy to see their state. When using the wall switch that sends the 433mhz directly to the relay with the 433mhz receiver attached, the relay latches with a wall switch press (single button wall switch), then pressing the same wall switch button, the relay unlatches and the load goes off.

The only time things may get out of sync appears to be if the Pi gets rebooted as it nor node red would not know the current state of the relay, thus the UI may not reflect its actual state.

As I also wish to use the node red UI to activate the relays in addition to the wall switch...and make the UI aware of wall switch presses, that is the basis of this project.

But if you cannot guarantee that the switch will always be in line with the real world then what is the point of using a switch. Is it not true that 433MHz control can be a bit unreliable, so you may have to repeat the action to get it to switch? I would have thought it might be better to use a push button and accept that tit is just a toggle.

However if if you want to continue down the route you are on then you need to tell the ui_switch to toggle each time it gets an input, which I now realise is what you have been trying to do all along. I have been a bit slow to pick that up.
Do you get an input from the RTL node when you click the ui_switch, or is that only when the wall switch is pressed?

Colin, Indeed there may be some out-of-sync situations, however the environment I am using this in is very small and essentially without interference, so I am quite confident all wall switch presses will be received by the relays.

So the issue with the solution previously (prior to working trough the update of the UI switch node to show state) was that the UI press of the switch (obviously) triggers the 433mhz send of the signal via the python script. This in turn is also being seen by the rtl_433 as it sees ALL 433 transmissions. At that point of the project this caused the flow to go into a loop.

I am thinking I may go back to using MQTT to store the switch state in the subscription, then attempt to act upon that...but may find myself in a similar situation.

It won't make it loop because you have cleared pass through, and set it to show the state of the incoming messge. There must be an error in the logic feeding the ui_switch node. What do you see going into the switch node when you click the ui_switch?

Would you be able to have a look at the flow I posted a few hours ago to see the flow 1st hand? The rtl_433 input can be mimicked / triggered by the inject node at the start

What do you see going into the switch node when you click the ui_switch?

This is the debug from click on the UI switch note. Please note that the UI switch graphic does NOT change when doing so

Imagine the switch is currently off. If you click it then it sends true, as that is the required new state so you save true in flow.relay1. Note that it is the required new state that you are saving. Then the signal comes in from the rtl node you pick up the flow.relay1 (which contains the required new state) and change it from true to false (which is the old state of the switch icon) and pass that to the node, which sets it Off (which it already is). You don't need the complementing logic. Just feed the flow value straight in.

click

OK, I have a meeting for the next hour or so, but will try to figure that out and report back. Many Thanks!

OK, started over (again) the flow below works fine to prove the concept by simply using an inject node, however when using the rtl_433 as the input the relay turning on then off loop is induced.

[{"id":"6e716fb5.71658","type":"tab","label":"Flow 2"},{"id":"74ce6ddd.15fc54","type":"ui_switch","z":"6e716fb5.71658","name":"","label":"switch top","tooltip":"","group":"dce9e7a2.d20c78","order":4,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":1180,"y":180,"wires":[["e466c863.0c97f8","f1bae529.80f738"]]},{"id":"e466c863.0c97f8","type":"change","z":"6e716fb5.71658","name":"copy msg.payload --> flow.switch1","rules":[{"t":"set","p":"switch1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1440,"y":220,"wires":[[]]},{"id":"9fa79a1e.7f47f8","type":"inject","z":"6e716fb5.71658","name":"some event","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":70,"y":180,"wires":[["24123ac0.8297c6"]]},{"id":"24123ac0.8297c6","type":"change","z":"6e716fb5.71658","name":"copy flow.switch1 --> msg.payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"switch1","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":180,"wires":[["85ae447c.b1c3c8"]]},{"id":"85ae447c.b1c3c8","type":"switch","z":"6e716fb5.71658","name":"is payload true or false?","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":180,"wires":[["6092c582.fd44ac","61d76158.54035"],["5f952775.f412e8","795c9865.1df778"]]},{"id":"6092c582.fd44ac","type":"debug","z":"6e716fb5.71658","name":"switch1 is true :)","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":600,"y":120,"wires":[]},{"id":"5f952775.f412e8","type":"debug","z":"6e716fb5.71658","name":"switch1 is false :(","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":630,"y":240,"wires":[]},{"id":"c282ea8b.db6908","type":"inject","z":"6e716fb5.71658","name":"True","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":1170,"y":120,"wires":[["74ce6ddd.15fc54"]]},{"id":"e4f29b9f.b78898","type":"inject","z":"6e716fb5.71658","name":"False","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":1170,"y":260,"wires":[["74ce6ddd.15fc54"]]},{"id":"61d76158.54035","type":"change","z":"6e716fb5.71658","name":"set payload to false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":140,"wires":[["7254a96e.1c91f8","74ce6ddd.15fc54"]]},{"id":"795c9865.1df778","type":"change","z":"6e716fb5.71658","name":"set payload to true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":200,"wires":[["fbbc5764.e63bb8","74ce6ddd.15fc54"]]},{"id":"7254a96e.1c91f8","type":"debug","z":"6e716fb5.71658","name":"set to false","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":80,"wires":[]},{"id":"fbbc5764.e63bb8","type":"debug","z":"6e716fb5.71658","name":"set to true","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":940,"y":260,"wires":[]},{"id":"f1bae529.80f738","type":"exec","z":"6e716fb5.71658","command":"python3 send.py -p 367 -t 1 13148322","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Relay #1 Send Code","x":1400,"y":160,"wires":[[],[],[]]},{"id":"dce9e7a2.d20c78","type":"ui_group","name":"Object detection","tab":"5132060d.4cde48","order":1,"disp":true,"width":"7","collapse":false},{"id":"5132060d.4cde48","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

It is looping because you have once again set Pass Through.

Try this
Note that I have added an entry into the first Change node to complement the flow variable, so that multiple 433 events will toggle the switch each time.

[{"id":"9fa79a1e.7f47f8","type":"inject","z":"6e716fb5.71658","name":"some event","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":180,"wires":[["24123ac0.8297c6"]]},{"id":"24123ac0.8297c6","type":"change","z":"6e716fb5.71658","name":"copy flow.switch1 --> msg.payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"switch1","tot":"flow"},{"t":"set","p":"switch1","pt":"flow","to":"$not(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":180,"wires":[["74ce6ddd.15fc54","97f4d948.597a88"]]},{"id":"97f4d948.597a88","type":"debug","z":"6e716fb5.71658","name":"Into switch","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":410,"y":260,"wires":[]},{"id":"74ce6ddd.15fc54","type":"ui_switch","z":"6e716fb5.71658","name":"","label":"switch top","tooltip":"","group":"dce9e7a2.d20c78","order":4,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":640,"y":180,"wires":[["e466c863.0c97f8","12a6bcbc.1a0203"]]},{"id":"e466c863.0c97f8","type":"change","z":"6e716fb5.71658","name":"copy msg.payload --> flow.switch1","rules":[{"t":"set","p":"switch1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":220,"wires":[[]]},{"id":"12a6bcbc.1a0203","type":"debug","z":"6e716fb5.71658","name":"Out of switch","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":870,"y":280,"wires":[]},{"id":"dce9e7a2.d20c78","type":"ui_group","name":"Object detection","tab":"5132060d.4cde48","order":1,"disp":true,"width":"7","collapse":false},{"id":"5132060d.4cde48","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
1 Like

@Colin You my friend are a genius! :100: once again! I just could not see the trees for the forest so to speak.

Just one finding...the 433 wall switch does not activate the UI switch state UNTIL the first use of the UI switch, as there is no known stat to be stored in the flow. I will experiment with finding some way of setting an initial state upon node red reboot/deploy. Let me know if you have an idea please.

Now I will investigate some type of node red state capture to attempt to keep the actual relay state synced up with the NR UI.