Call to prayer for Magrib

Hi,

Thought I’d share what I have setup for Magrib call to prayer (only pray where my family are mostly indoors!)

Explanation:
There’s many ways to achieve this I guess & we wanted to hear the Azaan (call for Prayer) from a particular Imam.
What we did was grab a MP3 of the Azaan that we wanted & placed it in the root folder of a web server in our network.

We then created a script & placed it in the scripts directory (/home/homeassistant/.homeassistant/scripts/magrib.yaml).

This script would first pause the sound bar we have which is connected to a harmony hub & then play the mp3 from the web server.

Secondly the media used are two google homes (one down & one up stairs) & will run for 156 seconds (timed how long the Azaan will take)

Once it runs its course the last part of the script will unmute the soundbar.

I then added the script to the automation.yaml (/home/homeassistant/.homeassistant/automations.yaml) file which will run every day at sunset.

Hope this helps someone.

Equipment:

Home Assistant 0.72.1
Local LAN webserver on same subnet as HA
2x Google Homes

Configurations:

/home/homeassistant/.homeassistant/scripts/magrib.yaml

alias: 'Magrib Azaan'
sequence:
  - service: remote.send_command
    data:
      command: Mute
      device: 52435888

  - service: media_player.play_media
    data_template:
         entity_id: media_player.kitchen_home
         media_content_id: http://IPADDRESSofWebserver/azaan.mp3
         media_content_type: audio/mp3

  - service: media_player.play_media
    data_template:
         entity_id: media_player.kitchen_speaker
         media_content_id: http://IPADDRESSofWebserver/azaan.mp3
         media_content_type: audio/mp3

  - delay:
      seconds: 157

  - service: remote.send_command
    data:
      command: Mute
      device: 52435888

/home/homeassistant/.homeassistant/automations.yaml

 - alias: 'Magrib Azaan'
     trigger:
       platform: sun
       event: sunset
     action:
      service: homeassistant.turn_on
      entity_id: script.magrib