Skip to content

Instantly share code, notes, and snippets.

@smarthomehobby
Created September 3, 2018 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarthomehobby/d932d01268aacea953ad83c5dae41f99 to your computer and use it in GitHub Desktop.
Save smarthomehobby/d932d01268aacea953ad83c5dae41f99 to your computer and use it in GitHub Desktop.
################################################
## Gen 1 Button Automations
################################################
This goes in automations.yaml
- id: bedside_button_single
alias: Bedside Button Single Click
initial_state: 'on'
trigger:
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d00019cd6e4
click_type: single
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0001e61312
click_type: single
action:
service: homeassistant.turn_on
entity_id: script.bedroom_lamp_toggle
- id: bedside_button_double
alias: Bedside Button Double Click
initial_state: 'on'
trigger:
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d00019cd6e4
click_type: double
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0001e61312
click_type: double
action:
service: switch.toggle
entity_id:
- switch.window_fan
- id: bedside_button_long
alias: Bedside Button Long Click
initial_state: 'on'
trigger:
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d00019cd6e4
click_type: long_click_press
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0001e61312
click_type: long_click_press
action:
service: homeassistant.toggle
entity_id:
- switch.bedroom_fan
This goes in scripts.yaml
bedroom_lamp_toggle:
alias: Bedroom Lamp Toggle
sequence:
- service: homeassistant.turn_on
data_template:
entity_id: >
{% if is_state("light.bedroom_lamp", "off") %}
script.bedroom_lamp_toggle_on
{%-elif is_state("light.bedroom_lamp", "on") %}
script.bedroom_lamp_toggle_off
{% else %}
script.none
{% endif %}
bedroom_lamp_toggle_on:
alias: Bedroom Lamp Toggle On
sequence:
- service: homeassistant.turn_on
entity_id: light.bedroom_lamp
data:
brightness_pct: 80
- service: homeassistant.turn_off
entity_id: script.bedroom_lamp_sunrise_snooze
bedroom_lamp_sunrise_snooze:
alias: Sunrise Snooze
sequence:
- service: homeassistant.turn_off
entity_id: script.sunrise
- service: homeassistant.turn_off
entity_id: light.bedroom_lamp
- delay: 00:05:00
- service: homeassistant.turn_on
entity_id: script.sunrise
bedroom_lamp_toggle_off:
alias: Bedroom Lamp Toggle Off
sequence:
- service: homeassistant.turn_off
entity_id: light.bedroom_lamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment