Skip to content

Instantly share code, notes, and snippets.

@Didgeridrew
Created February 1, 2024 02:12
Show Gist options
  • Select an option

  • Save Didgeridrew/d133609d7c62d988cad572ace27ebb8e to your computer and use it in GitHub Desktop.

Select an option

Save Didgeridrew/d133609d7c62d988cad572ace27ebb8e to your computer and use it in GitHub Desktop.
HA - Button Game automation
alias: Button game
description: ""
trigger:
- platform: state
entity_id:
- input_button.ztest_button_1
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: >-
{{ now() >
state_attr('automation.ztest_button_game','last_triggered') |
default(as_datetime(0), 1) + timedelta(minutes=2) }}
sequence:
- service: light.turn_off
target:
entity_id: light.gledopto_lightbar_01
data: {}
- conditions:
- condition: template
value_template: >-
{{ now() > this.attributes.last_triggered |
default(as_datetime(0), 1) + timedelta(seconds=20) }}
sequence:
- service: light.turn_on
target:
entity_id: light.gledopto_lightbar_01
data:
color_name: red
- conditions:
- condition: template
value_template: >-
{{ now() > this.attributes.last_triggered |
default(as_datetime(0), 1) + timedelta(seconds=10) }}
sequence:
- service: light.turn_on
target:
entity_id: light.gledopto_lightbar_01
data:
color_name: yellow
- conditions:
- condition: template
value_template: >-
{{ now() >
state_attr('automation.ztest_button_game','last_triggered') |
default(as_datetime(0), 1) + timedelta(seconds=5) }}
sequence:
- service: light.turn_on
target:
entity_id: light.gledopto_lightbar_01
data:
color_name: green
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment