Skip to content

Instantly share code, notes, and snippets.

@mohsinonxrm
Forked from OJ7/automations.yaml
Created September 19, 2022 00:29
Show Gist options
  • Save mohsinonxrm/5ab353519f866805803c5127afd991a9 to your computer and use it in GitHub Desktop.
Save mohsinonxrm/5ab353519f866805803c5127afd991a9 to your computer and use it in GitHub Desktop.
Automate Playing Adhan on Google Home (using Home Assistant)
# Automation for Dhuhr, Asr, Maghrib, and Isha Adhan
- action:
- alias: ''
data:
entity_id: media_player.family_room_speaker # replace with your Google Home's id
media_content_id: https://www.youtube.com/watch?v=ADLO-Hm_nCQ # replace with your choice of Adhan
media_content_type: audio/youtube
service: media_extractor.play_media
- data:
entity_id: media_player.family_room_speaker # replace with your Google Home's id
volume_level: '0.7'
service: media_player.volume_set
alias: Adhan
condition: []
id: '1517693010922'
trigger:
- platform: template
value_template: '{{ states.salat.dhuhr.state == states.sensor.time.state }}'
- platform: template
value_template: '{{ states.salat.asr.state == states.sensor.time.state }}'
- platform: template
value_template: '{{ states.salat.maghrib.state == states.sensor.time.state }}'
- platform: template
value_template: '{{ states.salat.isha.state == states.sensor.time.state }}'
# Separate Automation for Fajr Adhan
- action:
- data:
entity_id: media_player.family_room_speaker # replace with your Google Home's id
media_content_id: https://www.youtube.com/watch?v=VHcRTIcRvN8 # replace with your choice of Fajr Adhan
media_content_type: audio/youtube
service: media_extractor.play_media
- data:
entity_id: media_player.family_room_speaker # replace with your Google Home's id
volume_level: '0.99'
service: media_player.volume_set
alias: Fajr Adhan
condition: []
id: '1517694139112'
trigger:
- platform: template
value_template: '{{ states.salat.fajr.state == states.sensor.time.state }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment