forked from romquenin/home-assistant-config-fr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreveil.yaml
executable file
·73 lines (70 loc) · 2.34 KB
/
reveil.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
############################################################
## ##
## RÉVEIL TEMPLATE ##
## ##
############################################################
sensor:
- platform: template
sensors:
alarmclock_wd_time_template:
friendly_name: 'Réglage du réveil'
icon_template: "{{ 'mdi:alarm' if is_state('input_boolean.alarmclock_wd_enabled', 'on') else 'mdi:alarm-off' }}"
value_template: '{{ "%0.02d:%0.02d" | format(states("input_number.alarmclock_wd_hour") | int, states("input_number.alarmclock_wd_minute") | int) }}'
input_boolean:
alarmclock_wd_enabled:
name: Réglage du réveil
initial: off
icon: mdi:alarm
input_number:
alarmclock_wd_hour:
name: Heure
icon: mdi:timer
initial: 7
min: 0
max: 23
step: 1
alarmclock_wd_minute:
name: Minute
icon: mdi:timer
initial: 30
min: 0
max: 55
step: 5
automation:
- alias: Réveil
initial_state: 'on'
trigger:
- platform: time_pattern
minutes: '/1'
seconds: 00
condition:
condition: or
conditions:
- condition: and
conditions:
- condition: template
value_template: '{{ now().time().strftime("%H:%M") == states.sensor.alarmclock_wd_time_template.state }}'
- condition: state
entity_id: input_boolean.alarmclock_wd_enabled
state: 'on'
action:
- service: script.sonnerie_reveil
############################################################
## ##
## RÉVEIL EN MUSIQUE ##
## ##
############################################################
script:
sonnerie_reveil:
alias: '[Réveil] Sonnerie réveil'
sequence:
- service: media_player.select_source
data:
source: chambre
entity_id: media_player.ytube_music_player
- service: media_player.play_media
data:
entity_id: media_player.ytube_music_player
media_content_id: PLwG00xEEyR9ELtHz61D5JJz7s2W41m-ho
media_content_type: playlist
mode: single