@denver wrote:
Im trying to create an automation that turns off our bedside lights depending on the brightness when triggered.
If the lights are on the lowest brightness 1 then turn off, If the brightness is above the setting 1 then dim the lights to off.
Ive tried so far but with no luck
- alias: "Dim to off bedside lights" initial_state: "on" trigger: platform: event event_type: deconz_event event_data: id: bedroom_switch event: 1002 action: - service_template: > {%- if state_attr("light.bedroom_table_lamps", "brightness") == 1 -%} light.turn_off {%- else -%} service: light.toggle data: brightness: 255 transition: 60 {%- endif %} entity_id: light.bedroom_table_lamps
and
- alias: "Dim to off bedside lights" initial_state: "on" trigger: platform: event event_type: deconz_event event_data: id: bedroom_switch event: 1002 action: - condition: template value_template: '{{ state_attr("light.bedroom_table_lamps", "brightness") == 1 }}' - service: light.turn_off entity_id: light.bedroom_table_lamps - condition: template value_template: '{{ state_attr("light.bedroom_table_lamps", "brightness") > 1 }}' - service: light.toggle data: brightness: 255 transition: 60 entity_id: light.bedroom_table_lamps
I would be grateful for some advice on this.
Posts: 2
Participants: 2