-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathconfiguration.yaml
155 lines (129 loc) · 6.2 KB
/
configuration.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
homeassistant:
sensor:
- platform: time_date
display_options:
- 'time'
template:
- sensor:
- name: "time to next prayer"
unit_of_measurement: "min"
state: '{{ ((as_timestamp(states("sensor.next_salat_time")) - (as_timestamp(now())))/60) | int }}'
input_datetime:
next_salat_time:
name: next salat time
has_date: true
has_time: true
next_prep_salat_time: # 10 minutes before prayer call, cf. the blueprints to change it
name: next prep salat time
has_date: true
has_time: true
automation:
- alias: Prayer Time Magreb
initial_state: true
trigger:
platform: template
value_template: >
{% set a1 = states("sensor.time").split(":")[0] %}
{% set b1 = states("sensor.time").split(":")[1] %}
{% set a = states("sensor.maghrib_adhan").split(" ")[1].split(":")[0] %}
{% set b = states("sensor.maghrib_adhan").split(":")[1] %}
{{ b | int == b1 | int and a | int == a1 | int }}
action: # the action below is given as an example and is to adapt based on on your homeassistant installation
- service: mqtt.publish
data_template:
topic: 'commande/play/mini'
payload: "http://192.168.10.101/Quran/nofajr.mp3"
- alias: Prayer Time Asr
initial_state: true
trigger:
platform: template
value_template: >
{% set a1 = states("sensor.time").split(":")[0] %}
{% set b1 = states("sensor.time").split(":")[1] %}
{% set a = states("sensor.asr_adhan").split(" ")[1].split(":")[0] %}
{% set b = states("sensor.asr_adhan").split(":")[1] %}
{{ b | int == b1 | int and a | int == a1 | int }}
action: # the action below is given as an example and is to adapt based on on your homeassistant installation
- service: mqtt.publish
data_template:
topic: 'commande/play/mini'
payload: "http://192.168.10.101/Quran/nofajr.mp3"
- alias: Prayer Time Dhuhr
initial_state: true
trigger:
platform: template
value_template: >
{% set a1 = states("sensor.time").split(":")[0] %}
{% set b1 = states("sensor.time").split(":")[1] %}
{% set a = states("sensor.dhuhr_adhan").split(" ")[1].split(":")[0] %}
{% set b = states("sensor.dhuhr_adhan").split(":")[1] %}
{{ b | int == b1 | int and a | int == a1 | int }}
action: # the action below is given as an example and is to adapt based on on your homeassistant installation
- service: mqtt.publish
data_template:
topic: 'commande/play/mini'
payload: "http://192.168.10.101/Quran/nofajr.mp3"
- alias: Prayer Time Isha
initial_state: true
trigger:
platform: template
value_template: >
{% set a1 = states("sensor.time").split(":")[0] %}
{% set b1 = states("sensor.time").split(":")[1] %}
{% set a = states("sensor.isha_adhan").split(" ")[1].split(":")[0] %}
{% set b = states("sensor.isha_adhan").split(":")[1] %}
{{ b | int == b1 | int and a | int == a1 | int }}
action: # the action below is given as an example and is to adapt based on on your homeassistant installation
- service: mqtt.publish
data_template:
topic: 'commande/play/mini'
payload: "http://192.168.10.101/Quran/nofajr.mp3"
- alias: Prayer Time Fajr
initial_state: true
trigger:
platform: template
value_template: >
{% set a1 = states("sensor.time").split(":")[0] %}
{% set b1 = states("sensor.time").split(":")[1] %}
{% set a = states("sensor.fajr_adhan").split(" ")[1].split(":")[0] %}
{% set b = states("sensor.fajr_adhan").split(":")[1] %}
{{ b | int == b1 | int and a | int == a1 | int }}
action: # the action below is given as an example and is to adapt based on on your homeassistant installation
- service: mqtt.publish
data_template:
topic: 'commande/play/mini'
payload: "http://192.168.10.101/Quran/fajr.mp3"
- alias: Quran before Prayer Time
initial_state: true
trigger:
platform: template
value_template: >
{% set before1 = (as_timestamp(states('sensor.maghrib_adhan')) - 10 * 60) | timestamp_custom("%H:%M") %}
{% set before2 = (as_timestamp(states('sensor.isha_adhan')) - 10 * 60) | timestamp_custom("%H:%M") %}
{% set before3 = (as_timestamp(states('sensor.dhuhr_adhan')) - 10 * 60) | timestamp_custom("%H:%M") %}
{% set before4 = (as_timestamp(states('sensor.fajr_adhan')) - 60 * 60) | timestamp_custom("%H:%M") %}
{% set before5 = (as_timestamp(states('sensor.fajr_adhan')) - 10 * 60) | timestamp_custom("%H:%M") %}
{% set b1 = states("sensor.time") | timestamp_custom("%H:%M") %}
{{ b1 == before1 or b1 == before2 or b1 == before3 or b1 == before4 or b1 == before5 }}
action: # the action below is given as an example and is to adapt based on on your homeassistant installation
- service: mqtt.publish
data_template:
topic: 'commande/play/mini'
payload: "http://192.168.10.101/Quran/Nasser/088.mp3"
- alias: Annonce before Prayer Time
initial_state: true
trigger:
platform: template
value_template: >
{% set before1 = (as_timestamp(states('sensor.maghrib_adhan')) - 1 * 60) | timestamp_custom("%H:%M") %}
{% set before2 = (as_timestamp(states('sensor.isha_adhan')) - 1 * 60) | timestamp_custom("%H:%M") %}
{% set before3 = (as_timestamp(states('sensor.dhuhr_adhan')) - 1 * 60) | timestamp_custom("%H:%M") %}
{% set before4 = (as_timestamp(states('sensor.fajr_adhan')) - 1 * 60) | timestamp_custom("%H:%M") %}
{% set before5 = (as_timestamp(states('sensor.fajr_adhan')) - 1 * 60) | timestamp_custom("%H:%M") %}
{% set b1 = states("sensor.time") | timestamp_custom("%H:%M") %}
{{ b1 == before1 or b1 == before2 or b1 == before3 or b1 == before4 or b1 == before5 }}
action: # the action below is given as an example and is to adapt based on on your homeassistant installation
service: mqtt.publish
data_template:
topic: 'commande/say/mini'
payload: "la prochaine salat aura lieu dans une minute. soyez prets"