Dear All,
Since I have started working with Home Assistant, I started with a small project to automate the Azan (Muslim Prayer Call) with my Nest Mini. I have done my research and first tried to run the configuration available on the forum. Unfortunately it did not worked for me at all. Then in the discord group someone told me to add integration and then automate. I did that but still it is not running.
Whenever I reload the integration it start playing the Azan but it is not as per the time itâs like randomly I tried to reload the integration and it started playing the azan. I request if anyone can help. I will be grateful.
The automation code I found on the forum is as follows:
- id: '2020042901'
alias: Adhan Fajr
trigger:
- platform: template
value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M,
%Y-%m-%d")) == as_timestamp(strptime(states("sensor.fajr_prayer"), "%Y-%m-%dT%H:%M:%S"))
}}'
condition: []
action:
- data:
volume_level: 0.3
entity_id: media_player.living_room_speaker
service: media_player.volume_set
target:
entity_id:
- media_player.living_room_speaker
- service: media_player.play_media
data:
entity_id: media_player.living_room_speaker
media_content_id: http://x.x.x.x:8123/local/Mishary_Rashid_Fajr.mp4
media_content_type: audio/mp4
- delay: 00:00:00
- id: '2020042902'
alias: Adhan Dhuhr and Asr
trigger:
- platform: template
value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M,
%Y-%m-%d")) == as_timestamp(strptime(states("sensor.dhuhr_prayer"), "%Y-%m-%dT%H:%M:%S"))
}}'
- platform: template
value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M,
%Y-%m-%d")) == as_timestamp(strptime(states("sensor.asr_prayer"), "%Y-%m-%dT%H:%M:%S"))
}}'
condition: []
action:
- data:
volume_level: 0.4
service: media_player.volume_set
target:
entity_id: media_player.living_room_speaker
- data:
media_content_id: http://x.x.x.x:8123/local/Mishary_Rashid_Azan.mp4
media_content_type: video/mp4
service: media_player.play_media
target:
entity_id: media_player.living_room_speaker
- delay: 00:00:00
mode: single
- id: '151769301093'
alias: Adhan Maghrib and Isha
trigger:
- platform: template
value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M,
%Y-%m-%d")) == as_timestamp(strptime(states("sensor.maghrib_prayer"), "%Y-%m-%dT%H:%M:%S"))
}}'
- platform: template
value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M,
%Y-%m-%d")) == as_timestamp(strptime(states("sensor.isha_prayer"), "%Y-%m-%dT%H:%M:%S"))-1800
}}'
condition: []
action:
- data:
volume_level: 0.4
service: media_player.volume_set
target:
entity_id: media_player.living_room_speaker
device_id: b19748c5c11121ca67ade94f9ce4ea12
- data:
media_content_id: http://x.x.x.x:8123/local/Mishary_Rashid_Azan.mp4
media_content_type: video/mp4
service: media_player.play_media
target:
entity_id: media_player.living_room_speaker
device_id: b19748c5c11121ca67ade94f9ce4ea12
- delay: 00:00:00
mode: single
This Automation works manually but its automation it should work automatically please help if someone can.
Big thank you.