Automate Islamic Adhan (also called Azan or Azzan) or other prayer calls - Updated 3_24_2023 for Node-RED

Hi again - not sure if i got this right but the volume doesn’t seem to have a set point for Fajr in your node red config. The “turn on Fajr Volume” turns on the speaker but doesnt set a value for the speaker which I assume would be another call service node? or am i looking at this wrong.
basically i just want to know where the volume is being set, and from what i have been reading from other forums, I can’t seem to make out where its being done in node-red.

is there meant to be another call service after the delay 2s? e.g. "Turn on Fajr Volume > delay 2s > Set Volume > Play athan?

Testing this out and adding the call service node data: { "volume_level": 0.5} seems to have done the trick but I am not sure If I added this when it was already there? Just wanted to make sure.

Thanks

I feel that Mawait is doing better than what you’re trying to do. Also, Mawaqit offers integration with HA

Hope this helps :slight_smile:

i have installed the latest Prayer time official integration. It works fine but i want to add lovelace card to see the next prayer time like this. How can i do that?

rpyaer

Do you mean how to create a card like in the picture you posted?

For a easy simple automated azan solution please try Smart Azan Automation For Alexa

I made a glance card. In the yaml add format: time

I can confirm it does work

You must create a glance card with the islamic prayer times as the sensors. Then edit in yaml and add line format:time after each sensor so that it dispalys the times[quote=“Himdola, post:353, topic:100909, full:true”]
i have installed the latest Prayer time official integration. It works fine but i want to add lovelace card to see the next prayer time like this. How can i do that?

rpyaer
[/quote]

Hello,
I am looking for the same thing. Have you found a solution?

Thanks

Easy! put that mp3 file in your Home Assistant’s www (local) folder, then setup automation that will point towards the your custom mp3 file.

alias: ""
data:
  entity_id: media_player.master_bedroom_speaker
  media_content_id: http://192.168.1.129:8123/local/azaan.mp3
  media_content_type: music
service: media_player.play_media

1 Like

Thank you for your answer (sometimes the easier the better :D)

I created this automation but it still doesn’t play the file :confused:
in the log it was fired but didn’t play anything
when I execute it manually from the settings all works…

What am I missing?

alias: Maghreb Mawaqit
description: ""
trigger:
  - platform: time
    at: sensor.maghrib_adhan
condition: []
action:
  - service: media_player.play_media
    target:
      entity_id: media_player.my_sonos
    data:
      media_content_id: media-source://media_source/local/Azan_AbdelBasit.mp3
      media_content_type: audio/mpeg
    metadata:
      title: Azan_AbdelBasit.mp3
      thumbnail: null
      media_class: music
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://media_source
mode: single

Hello,
Can you help me to play Azan each prayer? I tried the automation but nothing is happening :confused:

alias: Maghreb Mawaqit
description: ""
trigger:
  - platform: time
    at: sensor.maghrib_adhan
condition: []
action:
  - service: media_player.play_media
    target:
      entity_id: media_player.my_sonos
    data:
      media_content_id: media-source://media_source/local/Azan_AbdelBasit.mp3
      media_content_type: audio/mpeg
    metadata:
      title: Azan_AbdelBasit.mp3
      thumbnail: null
      media_class: music
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://media_source
mode: single

The easy way to setup the adthan is to use the Islamic prayers integration in Home assistant. You can follow the following video how to add it and then use his setup to set your sonos to play the adthan. It is in egyptian arabic but just watch and follow in your home assistant. At 3:01, he will show his home assistant.

1 Like

My adhan automation notify services have stopped functioning correctly, I believe this was since around the last couple of releases of HA.

Here is my YAML:

# Sensors
sensor:
  - platform: template
    sensors:
      salah_fajr:
        friendly_name: "Fajr"
        icon_template: mdi:weather-sunset-up
        value_template: '{{ (states("sensor.islamic_prayer_times_fajr_prayer").split("T")[1].split(":")[0]) +":"+ (states("sensor.islamic_prayer_times_fajr_prayer").split("T")[1].split(":")[1])}}'
      salah_dhuhr:
        friendly_name: "Dhuhr"
        icon_template: mdi:weather-sunny
        value_template: '{{ (states("sensor.islamic_prayer_times_dhuhr_prayer").split("T")[1].split(":")[0]) +":"+ (states("sensor.islamic_prayer_times_dhuhr_prayer").split("T")[1].split(":")[1])}}'
      salah_asr:
        friendly_name: "Asr"
        icon_template: mdi:weather-sunset
        value_template: '{{ (states("sensor.islamic_prayer_times_asr_prayer").split("T")[1].split(":")[0]) +":"+ (states("sensor.islamic_prayer_times_asr_prayer").split("T")[1].split(":")[1]) }}'
      salah_maghrib:
        friendly_name: "Maghrib"
        icon_template: mdi:weather-sunset-down
        value_template: '{{ (states("sensor.islamic_prayer_times_maghrib_prayer").split("T")[1].split(":")[0]) +":"+ (states("sensor.islamic_prayer_times_maghrib_prayer").split("T")[1].split(":")[1]) }}'
      salah_isha:
        friendly_name: "Isha"
        icon_template: mdi:weather-night
        value_template: '{{ (states("sensor.islamic_prayer_times_isha_prayer").split("T")[1].split(":")[0]) +":"+ (states("sensor.islamic_prayer_times_isha_prayer").split("T")[1].split(":")[1]) }}'
      salah_actual:
        friendly_name: Salah Actual
        value_template: >
           {%- if is_state('sensor.salah_fajr', states('sensor.time_utc')) -%}
             Fajr
           {%- elif is_state('sensor.salah_dhuhr', states('sensor.time_utc')) -%}
             Dhuhr
           {%- elif is_state('sensor.salah_asr', states('sensor.time_utc')) -%}
             Asr
           {%- elif is_state('sensor.salah_maghrib', states('sensor.time_utc')) -%}
             Maghrib
           {%- elif is_state('sensor.salah_isha', states('sensor.time_utc')) -%}
             Isha
           {%- endif -%}

# Automations
automation:
# Adhan
  - alias: Adhan
    trigger:
    - platform: time
      at:
      - sensor.islamic_prayer_times_fajr_prayer
      - sensor.islamic_prayer_times_dhuhr_prayer
      - sensor.islamic_prayer_times_asr_prayer
      - sensor.islamic_prayer_times_maghrib_prayer
      - sensor.islamic_prayer_times_isha_prayer
    action:
    - service: notify.ios_all
      data:
        message: "It is {{ states.sensor.salah_actual.state }} time, please perform wudhu."
    - service: media_player.media_pause
      data:
        entity_id:  media_player.android
    - service: switch.turn_on
      data:
        entity_id: switch.pc_mute
    - service: media_player.volume_set
      data:
        entity_id: media_player.living_room_speaker
        volume_level: 0.6
    - service: media_player.play_media
      target:
          entity_id:
            - media_player.living_room_speaker
            - media_player.kids_bedroom
      data:
        media_content_id: "http://10.10.1.200:8123/local/adhan-{{'fajr' if trigger.entity_id == 'sensor.fajr_prayer' else 'main'}}.mp3"
        media_content_type: music

The issue I have is with the notify.ios_all service, the message ignores the JSON code at the salah times and appears as ‘It is time, please perform wudhu.’. I have tested the JSON template within HA and it shows up completely fine (i.e. sensor.salah_actual indicates the right salah within the designated minute).

Just to be clear, everything is working with the automation as expected except for the notify message JSON.

Anyone have any idea what might be happening here?

Thank you very much for the link!!
I discovered lots of problems I had with the installation (specially I had the wrong timezone coming from my NAS and this one drove me crazy)
I love this community!!

1 Like

Glad to hear that your issue is being fixed!

1 Like