Hi everyone, I’m reaching out for a bit of help with my Node-RED and MQTT setup. I’m still pretty new to this, so please bear with me. I’ve been trying to set up a system to control my outdoor lights from inside the house, and while I’ve made some progress, I’m stuck on a particular part of the configuration.
The setup involves two Shelly devices: one connected to a push button switch and the other controlling the outdoor lights. I’ve managed to get the lights toggling on and off using the MQTT payload {turn: toggle}, which works manually through Home Assistant. However, I’m struggling to get the system to work seamlessly when the switch is pressed.
Here’s the issue: when the switch Shelly broadcasts its status, it’s causing the lights to toggle every time, even if the switch hasn’t been pressed. I want to find a way to pass the current status of the switch (either ‘on’ or ‘off’) into the payload for the light Shelly. This way, pressing the switch once would turn the lights on, and pressing it again would turn them off, without any unintended toggling.
I know that the payload can only use ‘on’, ‘off’, or ‘toggle’, but hardcoding these values doesn’t solve the problem because it doesn’t account for the switch’s current state. I’m hoping there’s a way to dynamically pass the switch’s status through the MQTT topic.
If anyone has experience with this kind of setup or knows of a method to achieve this, I’d greatly appreciate your input. I’ll be sure to provide more details and screenshots once I get home to help clarify the issue further. Thanks in advance for your time and assistance!