I have a Philips LCT010 set up via Zigbee Home Automation and connected via a Homeassistant Sky Connect. The automation that I have set up looks like this:
Which used to set the light to 20% within a couple of seconds of the light switch being turned off and on. This is to let my child know that it’s bedtime and if they wake up in the middle of the night and try to turn their light on and it goes straight off, then it’s still bedtime.
However if the bulb is power cycled with the light switch a couple of times (which they very quickly cottoned onto) the light stays on 100% brightness and doesnt go back to 20% for a while.
But it is appearing in HA as being at 20% even though it’s not.
Same happens if I set the startup to 20 instead of 255 like it’s default is set as.
The light dims down to 20% when I manually run the automation. But it makes the automation pointless if I have to manually run it.
The trigger doesn’t look right - there doesn’t seem to be a state value. I would expect something like…
platform: state
entity_id:
- light.signify_netherlands_b_v_lct010_light_3
to: "on"
You don’t need the brightness attribute unless a particular value is part of the trigger, and you don’t need the “for” bit if you want the automation to trigger immediately. (If you’re editing in the UI these fields are optional).
In the action part, it’s good practice to use entities if you can, rather than device ids, which carry a lot of disadvantages.
Thanks. Long time lurker and usually I can find what I’m looking for by searching or by messing around. But this is a weird one because it works… Just not quickly. Haha.
I have been using the visual editor and copied the code from the yaml as I know it’s easier for other people to diagnose.
With the same result. Turning the light switch off and on twice, reverts the light to 100% for an unset amount of time.
Trying to change the action from device_id to entity_id is proving to be out of my depth
I’d be guessing it’s something to do with Zigbee Home Automation picking the light up as being on 20% when it’s not, that’s the issue? As when I try to turn the brightness up or down after they’ve pressed the light switch 2 times, it goes instantly to “on” at 20%. Even if I try and turn the light off in HA aswell.
Sorry, I’m being particularly dense. Now that I read your post properly, I see that power is being cut to the light completely - and presumably the start up level is set to 100%. Ignore me, I’m an idiot.
If they turn the light off at the switch and turn it back on quickly, twice. On the third time it ignores startup value and the automation and stays on at 100% until it eventually picks up that the brightness has changed and appears in HA as being on 5%.
But if you change the brightness at all after the third power cycle, it picks the light up brightness variable changing and sets it to 5% as it should.
I use zigbee home automation and not zigbee2mqtt due to setting up initially with ZHA and not Z2M. Could it be an issue with ZHA not syncing with the bulb or something?
My final idea is to get a couple of hard wired smart light switches and disable them in the automation, but that seems like overkill and I’d rather not do it.