Skip to content

Instantly share code, notes, and snippets.

@chpego
Last active January 27, 2021 15:22
Show Gist options
  • Save chpego/ea0ebd9f5c8ba9a2bce80f60d95e55a2 to your computer and use it in GitHub Desktop.
Save chpego/ea0ebd9f5c8ba9a2bce80f60d95e55a2 to your computer and use it in GitHub Desktop.
- alias: "[System] - Heure Reveil"
trigger:
platform: time
at: input_datetime.heure_reveil_avant_A
action:
- service: hommeassistant.toggle
data:
entity_id: switch.monchauffage
- alias: "[System] - Modification de l'input_datetime heure_reveil_avant_A"
trigger:
- platform: state
entity_id: input_datetime.heure_reveil_A
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.heure_reveil_avant_A
data:
timestamp: "{{ ( as_timestamp(states('input_datetime.heure_reveil_A')) - ( ( states('input_number.duree_min') | int ) * 60 ) ) }}"
input_number:
duree_min:
name: "Durée (minutes)"
min: 1.0
max: 60.0
step: 1
initial: 20
unit_of_measurement: min
mode: slider
input_datetime:
heure_reveil_A:
name: Reveil A
has_time: true
has_date: true
heure_reveil_avant_A:
name: Reveil avant A
has_time: true
has_date: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment