Skip to content

Instantly share code, notes, and snippets.

@Didgeridrew
Created April 21, 2023 03:05
Show Gist options
  • Select an option

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

Select an option

Save Didgeridrew/2bd70bc82986604570fbb665feeb7f81 to your computer and use it in GitHub Desktop.
alias: Select input to timed output
description: ""
trigger:
- platform: state
id: button
entity_id:
- input_select.ztest_1_to_5
not_from:
- unavailable
- platform: event
event_type:
- timer.cancelled
- timer.finished
event_data:
entity_id: timer.ztest_timer
- platform: event
id: timer_start
event_type:
- timer.started
- timer.restarted
event_data:
entity_id: timer.ztest_timer
- platform: state
to: "off"
id: climate_off
not_from:
- unknown
- unavailable
entity_id: light.behind_tv
condition:
- condition: time
after: "09:00:00"
action:
- choose:
- conditions:
- condition: trigger
id: button
- condition: template
value_template: "{{ trigger.to_state.state | is_number}}"
sequence:
- service: timer.start
data:
duration: |
{{ trigger.to_state.state | int * 60 }}
target:
entity_id: timer.ztest_timer
- conditions:
- condition: trigger
id: timer_start
sequence:
- service: light.turn_on
data: {}
target:
entity_id: light.behind_tv
- conditions:
- condition: trigger
id: climate_off
sequence:
- service: input_select.select_option
target:
entity_id: input_select.ztest_1_to_5
data:
option: "Off"
default:
- condition: "{{ not is_state('light.behind_tv', 'off') }}"
- service: light.turn_off
data: {}
target:
entity_id: light.behind_tv
mode: queued
max: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment