Hello! I have used HomeAssistant to play the call for prayer (adan/azan) in my home automatically: Everything works fine but I want to noq play parts of the Quran at static times during the day. My code is below with bottom section trying to play Surah Baqara but it doesn’t work as intended. Any idea on what I am doing wrong?
#- id: '1640034001249'
# mode: restart
# Automation for 5 times Azan
- action:
- alias: 'Azan'
data:
entity_id: media_player.sonos_roam
media_content_id: https://www.islamcan.com/audio/adhan/azan14.mp3
media_content_type: music
service: media_player.play_media
- data:
entity_id: media_player.sonos_roam
volume_level: '0.6'
service: media_player.volume_set
alias: Adha
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")) }}'
- 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")) }}'
- 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")) }}'
### Restart HA to force update Islamic Time Sensors at 1AM ###
- alias: Restart HA
trigger:
platform: time
at: "01:00:00"
action:
- service: homeassistant.restart
##Play surah baqara at
- action:
alias: 'baqara'
trigger:
platform: time
at: "07:45:00"
- action:
data:
entity_id: media_player.sonos_roam
volume_level: '0.8'
media_content_id: https://www.islamcan.com/quran-mp3/alafasy/002-al-baqarah.mp3
media_content_type: music
service: media_player.volume_set