I’m trying to figure out how to trigger an automation when a dimmer light changes from any non-zero value for ‘brightness_pct’ to any value.
I have all the normal light automations working; trigger when motion detected, turn it off 5m after last motion, different brightnesses based on luminance and sun positioning, etc.
I’m using an ‘input_boolean’ to track whether a light was engaged via automation (true) or manually so that the auto-off automation can check if it should fire or not. The desire is if a light was turned on manually it shouldn’t auto off so quickly.
I have it working so that if a light triggers via automation, and you turn it off manually, it resets the input_boolean to false, but I need to find a way to also set the input_boolean to false if you change the brightness_pct.
The easiest way I can think of would be to break out the brightness attribute using a template sensor.
Trigger on any change of state of the sensor.
Include a condition that the trigger from state be greater than 0.
trigger:
platform: state
entity_id: light.LIGHT
condition:
condition: template
value_template: >
{{ trigger.from_state is not none and
trigger.from_state.state == 'on' and
trigger.from_state.attributes.brightness > 0 and
trigger.to_state is not none and
trigger.to_state.state == 'on' }}
How are you changing the brightness ?
I ask because I have an input number that gives the brightness of a group of my bulbs.
When the input number changes state (easy state change) it then sets the group to that brightness.
This is easy to put in the front end and you would not have to configure a sensor to do it.
You also have your trigger for whatever you are doing (if that’s changing the level of other bulbs, then your work is done.