forked from zubir2k/HomeAssistantAdzan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomation_takbir.yaml
167 lines (165 loc) · 7.01 KB
/
automation_takbir.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
156
157
158
159
160
161
162
163
164
165
166
167
## This automation adds a takbir after Azan based on conditions that matches Eid Fitr and Eid Adha.
## Adjust the newly added delay accordingly (line 68 and 108) to match the audio (surah) length.
alias: Azan 3.0 (with Takbir)
description: ''
trigger:
- platform: template
value_template: >-
{{is_state_attr("sensor.solat_sekarang", "24hours",
now().strftime("%H:%M"))}}
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: '{{is_state("sensor.solat_sekarang", "Subuh")}}'
sequence:
- service: notify.telegram #Change this accordingly
data:
message: >-
🕋 Sekarang telah masuk waktu
{{states("sensor.solat_sekarang")}} bagi kawasan ini dan
kawasan yang sama waktu dengannya.
- service: persistent_notification.create
data:
message: >-
{{ now().strftime("%-I:%M %p") }} - Sekarang telah masuk waktu
{{states("sensor.solat_sekarang")}} bagi kawasan ini dan kawasan yang
sama waktu dengannya.
notification_id: esolat_azan
title: 🕋 eSolat - Waktu {{states("sensor.solat_sekarang")}}
- service: tts.google_say
data:
entity_id: media_player.all_devices #Change this accordingly
message: >-
Sekarang telah masuk waktu {{states("sensor.solat_sekarang")}}
bagi kawasan ini dan kawasan kawasan yang sama waktu dengannya.
language: id
- delay: '00:00:10'
- service: media_player.play_media
data:
media_content_type: audio/mp3
media_content_id: https://xxxx.duckdns.org/local/audio/azan/azansubuh.mp3 #Change this accordingly
extra:
title: Azan {{states("sensor.solat_sekarang")}}
target:
entity_id: media_player.all_devices #Change this accordingly
- delay: '00:05:00'
- service: media_player.play_media
data:
media_content_type: audio/mp3
media_content_id: https://xxxx.duckdns.org/local/audio/surah/alfatihah.mp3 #Change this accordingly
extra:
title: Surah Al Fatihah
entity_id: media_player.all_devices #Change this accordingly
- delay: '00:00:37'
- service: media_player.play_media
data:
media_content_type: audio/mp3
media_content_id: >
{{
["https://xxxx.duckdns.org/local/audio/surah/assajadah.mp3",
"https://xxxx.duckdns.org/local/audio/surah/almulk.mp3",
] | random }}
extra:
title: Surah
entity_id: media_player.all_devices #Change this accordingly
- delay: '00:06:21'
- conditions:
- condition: template
value_template: >-
{{is_state("sensor.solat_sekarang", "Zohor") or
is_state("sensor.solat_sekarang", "Asar") or
is_state("sensor.solat_sekarang", "Maghrib") or
is_state("sensor.solat_sekarang", "Isyak")}}
sequence:
- service: notify.telegram #Change this accordingly
data:
message: >-
🕋 Sekarang telah masuk waktu
{{states("sensor.solat_sekarang")}} bagi kawasan ini dan
kawasan yang sama waktu dengannya.
- service: persistent_notification.create
data:
message: >-
{{ now().strftime("%-I:%M %p") }} - Sekarang telah masuk waktu
{{states("sensor.solat_sekarang")}} bagi kawasan ini dan kawasan yang
sama waktu dengannya.
notification_id: esolat_azan
title: 🕋 eSolat - Waktu {{states("sensor.solat_sekarang")}}
- service: tts.google_say
data:
entity_id: media_player.all_devices #Change this accordingly
message: >-
Sekarang telah masuk waktu {{states("sensor.solat_sekarang")}}
bagi kawasan ini dan kawasan kawasan yang sama waktu dengannya.
language: id
- delay: '00:00:10'
- service: media_player.play_media
data:
media_content_type: audio/mp3
media_content_id: https://xxxx.duckdns.org/local/audio/azan/azan.mp3
#media_content_id: http://192.168.0.123:8123/local/audio/azan/azan.mp3 #Change this accordingly
extra:
title: Azan {{states("sensor.solat_sekarang")}}
target:
entity_id: media_player.all_devices #Change this accordingly
- delay: '00:02:46'
default:
- service: persistent_notification.create
data:
message: >-
{{ now().strftime("%-I:%M %p") }} - Sekarang telah masuk waktu
{{states("sensor.solat_sekarang")}} bagi kawasan ini dan kawasan yang
sama waktu dengannya.
notification_id: esolat_azan
title: 🕋 eSolat - Waktu {{states("sensor.solat_sekarang")}}
- condition: template
value_template: >-
{% set tasyrik_end = not is_state('sensor.solat_sekarang', 'Maghrib') and not is_state('sensor.solat_sekarang', 'Isyak') %}
{% set day = state_attr('sensor.solat_jakim', 'prayerTime')[0].hijri[8:10] %}
{% set month = state_attr('sensor.solat_jakim', 'prayerTime')[0].hijri[5:7] %}
{{(month == '12' and day > '08' and day < '14' and (day == '13' and tasyrik_end)) or (month == '09' and day == '30' and not tasyrik_end) }}
- service: media_player.play_media
data:
media_content_type: audio/mp3
media_content_id: media-source://media_source/local/audio/takbir.mp3
extra:
title: >-
Takbir Raya {{state_attr('sensor.solat_jakim', 'prayerTime')[0].hijri[0:4] ~ 'h'}}
target:
entity_id: media_player.all_devices
mode: single
alias: Doa Pagi on Sunrise
description: ''
trigger:
- platform: template
value_template: |
{{is_state("sun.sun", "above_horizon")}}
condition: []
action:
- service: media_player.play_media
target:
entity_id:
- media_player.all_devices
data:
media_content_id: media-source://media_source/local/audio/doa-pagi.mp3
media_content_type: audio/mp3
extra:
title: Doa Pagi
- delay: '00:02:53'
- condition: template
value_template: >-
{% set raya = (state_attr('sensor.solat_jakim', 'prayerTime')[0].hijri[8:10] ~ '-' ~ state_attr('sensor.solat_jakim', 'prayerTime')[0].hijri[5:7]) %}
{{ raya == '01-10' or raya == '10-12' }}
- service: media_player.play_media
target:
entity_id:
- media_player.all_devices
data:
media_content_id: media-source://media_source/local/audio/takbir.mp3
media_content_type: audio/mp3
extra:
title: >-
Takbir Raya {{state_attr('sensor.solat_jakim', 'prayerTime')[0].hijri[0:4] ~ 'h'}}
mode: single