Here is my setup. I am using 0.109.0 HA on a raspberry pi. I have configure it to have a static ip.
You should include the Islamic Prayer Times integration. See the screenshot below.
Then my configuration.yaml file looks like as follow.
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
media_extractor:
sensor:
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'
- 'time_date'
- 'time_utc'
- 'beat'
and my automations.yaml file looks like this
- 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.4
entity_id: media_player.kitchen_display
service: media_player.volume_set
- data:
entity_id: media_player.kitchen_display
media_content_id: http://192.168.0.199:8123/local/azan2.mp3
media_content_type: audio/mp3
service: media_player.play_media
- delay: 00:04:54
- 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.6
entity_id: media_player.kitchen_display
service: media_player.volume_set
- data:
entity_id: media_player.kitchen_display
media_content_id: http://192.168.0.199:8123/local/azan1.mp3
media_content_type: audio/mp3
service: media_player.play_media
- delay: 00:03:09
- 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"))
}}'
condition: []
action:
- data:
volume_level: 0.4
entity_id: media_player.kitchen_display
service: media_player.volume_set
- data:
entity_id: media_player.kitchen_display
media_content_id: http://192.168.0.199:8123/local/azan1.mp3
media_content_type: audio/mp3
service: media_player.play_media
- delay: 00:03:09
I am using two audio files. The audio files can be downloaded from the link https://gofile.io/?c=1ymMjM
The files should be uploaded to “www” folder under config.
You can install file editor addon to work with files. See screenshot below.
After doing all, restart your server. Hope this helps.