Skip to content

Instantly share code, notes, and snippets.

@chpego
Created January 8, 2021 09:33
Show Gist options
  • Save chpego/a8a01e1c5bbbbe31579e0b0e78688fc0 to your computer and use it in GitHub Desktop.
Save chpego/a8a01e1c5bbbbe31579e0b0e78688fc0 to your computer and use it in GitHub Desktop.
package reveil pour home assistant
---
automation:
- alias: "[System] - Heure Reveil PERSONNE 1"
trigger:
platform: state
entity_id: sensor.telephone_next_alarm
for: "00:00:15"
action:
- choose:
- conditions: >
{{ states(trigger.entity_id) != 'unavailable' }}
sequence:
- service: automation.turn_on
entity_id:
- automation.lumiere_reveil_sejour
- service: input_datetime.set_datetime
entity_id: input_datetime.heure_reveil_personne_1
data:
timestamp: "{{ as_timestamp(states(trigger.entity_id)) }}"
- conditions: >
{{ states(trigger.entity_id) == 'unavailable' }}
sequence:
- service: automation.turn_off
entity_id:
- automation.lumiere_reveil_sejour
- alias: "[System] - Heure Reveil Sejour"
trigger:
- platform: state
entity_id: input_datetime.heure_reveil_personne_1
- platform: state
entity_id: input_number.duree_simulateur_aube
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.heure_reveil_sejour
data:
timestamp: "{{ as_timestamp(states('input_datetime.heure_reveil_personne_1')) }}"
- alias: '[Lumière] - Réveil séjour'
description: "Active l'automatisation reveil sejour"
trigger:
platform: time
at: input_datetime.heure_reveil_sejour
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: state
entity_id: group.persons
state: home
action:
- delay:
seconds: '{{ ( range(15,30) | random ) }}'
- service: script.simulateur_aube
data:
entity_id: light.sejour_bas
brightness_pct_value: "35"
transition_value: "25"
input_datetime:
heure_reveil_sejour:
name: Reveil Séjour
has_time: true
has_date: true
heure_reveil_personne_1:
name: Heure Reveil PERSONNE 1
has_time: true
has_date: true
script:
simulateur_aube:
sequence:
- service: light.turn_on
data:
entity_id: "{{ entity_id }}"
brightness: 1
color_temp: "{{ state_attr(entity_id,'max_mireds') }}"
- delay: 2
- service: light.turn_on
data:
entity_id: "{{ entity_id }}"
brightness_pct: "{{ brightness_pct_value }}"
transition: "{{ transition_value | int * 60 }}"
color_temp: "{{ state_attr(entity_id,'max_mireds') - ( (state_attr(entity_id,'max_mireds') - state_attr(entity_id,'min_mireds')) /2 ) | int }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment