Hi I’m after a bit of assistance here. I’m pretty new to node-red and mqtt so go easy.
I have two Shellys that I am trying to control via a sequence to turn some outdoor lights on or off from the house. Reason for this setup is the distance from the house to the lights is around 40m so controlling the lights over wifi would be easier and cheaper than running the switch wire all the way outside. Wifi coverage is fine and I can manually turn the lights on and off via Home Assistant.
One Shelly is connected to a push button switch and the second is connected to the lights and I have figured out the mqtt payload {turn: toggle} to toggle this light on and off.
What I am struggling with is taking the output from the switch Shelly topic and payload and converting it correctly to the topic and payload for the light Shelly. I have used a change node to change the topic successfully but if I insert the payload of {turn: toggle} the lights just toggle on and off every time the switch Shelly broadcasts its status even without the switch being pressed.
Is there a way of inserting the current status of the switch Shelly either ‘on’ or ‘off’ into the payload {turn: xxx}? As far as I am aware I can only use ‘on’, ‘off’ or ‘toggle’. If I hardcode ‘on’ or ‘off’ it will just change once to that status. What I am after is a way of passing the current status through from the one topic payload to the other?
Sorry if this is a bit long winded. I will add some screenshots when I get home.