I couldn’t find a similar issue so created this one
I created two automations to automatically turn off or on a hue smart plug based on the brightness of a light group.
The “numeric state above” works as I expected, but the “numeric state below” doesn’t. When the brightness goes below the value the smart plug is switched off (as expected). But after i adjust the brightness (further down or up (but still below the given value), the smart plug is switched on. I added a condition for this automation that smart plug needs to switched on, but that didn’t help.
The wrong action doesn’t show up in traces for the automation, but does show up in the logbook.
I wonder if the brightness is “noisy” with intermittent high values or unavailable? It might be worth making a template sensor for the brightness so you can easily see what it’s doing with a history trace.
If a light’s state is on and Home Assistant sends a “turn_off” command but the physical light fails to promptly acknowledge receipt of the command, Home Assistant will immediately set the light’s state back to on.
This is what might be happening here because if you look at the log, the two messages are just 2 seconds apart.
I added the ID to the automation and went further troubleshooting. I changed the trigger to one specific light instead of the whole group, but that didn’t solve the issue.
In the system log i noticed an error Request failed: attribute (.dimming) is not supported by resource and that was because the hue plug was within the same group and isn’t able to dim (obviously). I moved the hue plug to another room and now the automation is working as desired (and expected).
I had the hue plug in the same room, so my hue dimmer was able to turn the whole group on/off, but now with HASS i can automate to hue plug based on the brightness.
The issue wasn’t within the automation itself, but within the fact that the bank_smart_plug was within the group in which i changed the brightness (light.woonkamer). I think the dimming error made the bank_smart_plug switch back on.
Before the “woonkamer” group contained the following: Woonkamer2, Woonkamer1, Hue go, Woonkamer3, bank_smart_plug
The automation had the trigger on the brightness for the whole “woonkamer” group (light.woonkamer), but i changed it to one specific light within that group.
Request failed: attribute (.dimming) is not supported by resource
So timewindow: I lowered the brightness for “light.woonkamer” so bank_smart_plug was turned off. I waited and changed the brightness for “light.woonkamer” (didn’t matter further down or minimum up (still under the value which was set: 121), which resulted in bank_smart_plug turned on.
I changed the room for the bank_smart_plug within the hue app, so it isn’t part of “light.woonkamer” anymore and after that the automation is working as expected.
I see. You had created a Light Group and one of its members wasn’t a light but a switch which, of course, has no dimming ability. Home Assistant created the group but failed to use it in a trigger that monitored each group member’s brightness.