I’ve got a red series dimmer in my daughter’s room and just installed some WiFi RGB bulbs. The dimmer is connected to Home Assistant via Zwave-js and the bulbs are connected via the Tuya integration. There are 4 WiFi bulbs and they are in a light group.
I have the dimmer in Smart Bulb mode and I’ve used the blueprint below to create an automation to control the lights from the switch. By itself, this works well and the lights turn on/off & dim from the switch and a double tap up sets brightness to 100% and resets the bulbs to white.
However, what I’m lacking is the ability to have changes to the bulbs reflected back to the switch. So if I turn on/off the bulbs or change the brightness via HA, the status of the switch doesn’t change. I created an automation to do this, but having both automations enabled seems to create loops and leads the overall control of the lights to be unreliable and unpredictable.
Any recommendation on how this can be solved so that the switch controls the bulbs and if the bulbs are changed via HA it is reflected in the switch.
I do my automations in node red so I won’t be able to help with the yaml, but I’ll run you through my general thought process here.
The way I’d approach this would be using the bulb’s brightness attribute as the trigger.
From there the first step should be checking the brightness of the switch. If it matches, do nothing. If it doesn’t, set the switch brightness to match the bulb brightness.
Then on your automation to control brightness of the bulbs from the switch, you’ll want to implement the same logic.
Brightness of the switch as the trigger.
Check the brightness of the bulbs, if they match do nothing, if they don’t, set the bulb brightness to match the switch.
Implementing the check before calling the service should eliminate the loop you’re seeing.
Thanks for the advice. I added the brightness match in a couple of places and also added a condition to only run if the other automation isn’t running (I had to modify the blueprint I was using to add the condition). I honestly haven’t checked to see which helped more, but adding both seemed to get rid of the loops and improve responsiveness.