Skip to content

Instantly share code, notes, and snippets.

@blindguynar
Created February 10, 2025 00:21
Show Gist options
  • Select an option

  • Save blindguynar/a69f86b8afc8c94743765e166feef18d to your computer and use it in GitHub Desktop.

Select an option

Save blindguynar/a69f86b8afc8c94743765e166feef18d to your computer and use it in GitHub Desktop.
Dimmer Automation Example
alias: "Light: Living Room Lights Dimmer"
description: ""
mode: queued
max: 10
triggers:
- trigger: state
entity_id:
- sensor.living_room_ceiling_lights_dimmer
attribute: action
id: Adjustment
- trigger: state
entity_id:
- sensor.living_room_ceiling_lights_dimmer
attribute: action
to: null
for:
hours: 0
minutes: 0
seconds: 1
id: Button
conditions:
- condition: or
conditions:
- condition: template
value_template: >-
{{ trigger.to_state.attributes['action'] == 'brightness_move_to_level'
}}
enabled: true
- condition: template
enabled: true
value_template: "{{ trigger.to_state.attributes['action'] == none }}"
- condition: template
value_template: "{{ trigger.to_state.attributes['action'] != \"\" }}"
enabled: true
enabled: true
actions:
- choose:
- conditions:
- condition: or
conditions:
- condition: template
value_template: "{{ trigger.to_state.attributes['action_level'] == 0 }}"
enabled: true
- condition: and
conditions:
- condition: template
value_template: "{{ trigger.to_state.state == \"None\" }}"
enabled: true
- condition: template
enabled: true
value_template: "{{ trigger.to_state.attributes['action'] == none }}"
- condition: trigger
id:
- Button
sequence:
- if:
- condition: device
type: is_on
device_id: b698eb1d2aa87a08c83a98d7e542e720
entity_id: b81259163c52c8e71ba79ec345e2f5ed
domain: light
then:
- action: light.turn_off
target:
entity_id:
- light.living_room_light
data: {}
else:
- action: light.turn_on
target:
entity_id:
- light.living_room_light
data: {}
- action: mqtt.publish
data:
topic: zigbee2mqtt/Living Room Light Dimmer
payload: "{\"action\":\"\"}"
enabled: true
- conditions:
- condition: template
value_template: "{{ trigger.to_state.attributes['action_level'] >= 2 }}"
enabled: true
sequence:
- action: light.turn_on
data_template:
brightness: |
{{ trigger.to_state.attributes['action_level'] }}
transition: 0.1
target:
entity_id: light.living_room_light
enabled: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment