I recently started diving into Home Assistant like many people around here due to the Insteon fiasco. I finally had a breakthrough last night and started getting the hang of the syntax and how everything operates. After finishing my first “complex” automation I wanted to get some feedback to further my knowledge of this you guys might change. I started using the Visual Editor for some of the code before writing the rest in YAML.
What I was able to achieve was to use two of the buttons on my six button Keypadlinc to increase and decrease the brightness in the room with a double click (insteon.button_on_fast) changing it by 20 instead of 10.
alias: Ceiling Fan Light Brightness (Duplicate)
description: ''
trigger:
- platform: event
event_type: insteon.button_off
event_data:
address: 4b6064
button: a
- platform: event
event_type: insteon.button_off_fast
event_data:
address: 4b6064
button: a
- platform: event
event_type: insteon.button_off
event_data:
address: 4b6064
button: b
- platform: event
event_type: insteon.button_off_fast
event_data:
address: 4b6064
button: b
condition: []
action:
- if:
- condition: template
value_template: '{{ trigger.event.data.button == ''a'' }}'
then:
- service: light.turn_on
data:
entity_id: light.keypad_with_dimmer_4b_60_64_main
brightness_step_pct: '{{ 10 if trigger.event.event_type == ''insteon.button_off'' else 20 }}'
else:
- service: light.turn_on
data:
entity_id: light.keypad_with_dimmer_4b_60_64_main
brightness_step_pct: >-
{{ -10 if trigger.event.event_type == 'insteon.button_off' else -20
}}
mode: single