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

your browser or phone has the wrong browser time. try restarting it.

Thank you for letting me know that it doesnā€™t work!

Waā€™alaikum salam,

Maybe try re-booting your system to force-update the prayer times.

Also, Iā€™ve noticed, you are looking at sensor: sensor.date_time
Did you change the code from the first post?

The original code in the first post used sensor.time_date and not sensor.date_time.

Assalaamuā€™alaikum

How does one display the actual prayer time for today in the front end, e.g. Fair at ā€œ06:00ā€ instead of ā€œ9 hours agoā€?

2 Likes

Thank you, it started working once I installed an update to the OS. I had tried to restart a few times before posting but it didnā€™t seem to work then.

Thanks, it is working now after an OS update. I have both sensor.time_date and sensor.date_time configured.

1 Like

This is possible so long as the prayer times provider has an API feed that you can access. Iā€™ve done something similar and it works.

did you find a way to show it as exact time instead of hours ago/ hours left?

No, I have not yet been successful.

how did you get the farr and other prayers saying in 2 hours.

Through groups or you can use a lovelace entity card:

card:
  entities:
    - entity: sensor.islamic_prayer_time_fajr
    - entity: sensor.islamic_prayer_time_sunrise
    - entity: sensor.islamic_prayer_time_dhuhr
    - entity: sensor.islamic_prayer_time_asr
    - entity: sensor.islamic_prayer_time_maghrib
    - entity: sensor.islamic_prayer_time_isha
  show_header_toggle: false
  type: entities

Hi, Iā€™ve been trying to set this up for 2 weeks and I still not getting anywhere.
Iā€™m a newbie to home assistant and yaml files. But I have done alot of work with computers and Android configuration files with ini files, HTML etcā€¦

I have home assistant set-up on my synology via docker. I know the tutorial suggests to install hassio but on synology thereā€™s no option to have hassio. From what Iā€™ve read hassio is not required as it work as an operating system for raspberry pi.

I inject codes into my configuration and automation yaml files. I donā€™t get any errors after scrip config check.

I have # out any things I donā€™t think required as Iā€™m only using 1 google home device and Iā€™m not fussed with all the other option untill I canā€™t successfully get adhan working.

I have afew questions :
-where is local folder? Same as configuration.yaml?
ā€“what ID do I use or where do I find the ID
-if using local folder for adhan audio, do I put a (s) after http or without an (s)?

In my home assistant page I can see the automations for adhan but I cant trigger it. When I select trigger, my google home make a ding noise but no adhan.
I tried using YouTube link and local folder hut still no joy.

Any assistance will be highly appreciated. I just want to successfully have adhan work for now then I will improve on it at a later stage.

Maybe if possible and not too much work maybe created a code for the bare basic to have adhan called via google home.

Hi, Could you please share your config file entry ? Also, do you see these sensors in the states section under Developer tools.
image

  1. Local folder in www folder. I had mine on /config/www/audio folder. Folder permission 755
    Make sure you can reach it from http://yourhaip:8123/local/audio/youraudiofilename.mp3
  2. Which ID do you mean? you can find the list of IDs if you click on " <>" under Developer tools.
  3. You shouldnā€™t need the (s)

You can also call services in the services menu under Developer tools. I was having similar issues when I started using this. To trouble shoot the issue, I used a script to call the media player service.
Also, Itā€™s very important to have your configuration.yaml setup up like porankaziā€™s in the first post. Especially the sensors part.

Let us know how you make out.

Hi AdighaLogic, thanks for your reply and I appreciate your assistance

I do have these same sensors in the states section, under developer tool.

I have created a www folder in the same location where the yaml files are in (Iā€™m assuming this is the local folder) and put the audio in that folder.
The media content id Iā€™ve used is http://internalip:8123/local/www/azan2.mp3
The actual location in my Synology is /volume1/docker/Homeassistant/www/azan2.pm3 (yaml files are locted in /volume1/docker/Homeassistant)

I changed folder permission to 755 using the following code in putty via ssh (chmod -R 755 /volume1/docker/Homeassistant/www)

When I try to call the service under developer tools, I get an error ā€œfailed to call service media_player/play media. required key not provided @data[ā€˜media_content_typeā€™]ā€. I have tied the following media content type as: music and audio with upper and lower case

I have attached the following screenshot:
config yaml
auto yaml
services
call service

In the auto yaml, I have highlighted the ID which I was asking about

I didnā€™t know how to correctly attached the yaml files hence why I screenshot them.

I hope I have given all the information required

call%20service

Hi!
youā€™d still need to specify the media type in the service.
Try this in the Service Data (Json,optional) section of your service
{
ā€œmedia_content_idā€: ā€œhttp://internalip:8123/local/azan2.mp3ā€
ā€œmedia_content_typeā€: ā€œmusicā€
}

you could also try ā€˜audio/mp3ā€™ as media content type.
Thank you!

I have changed content ID in the auto yaml file to what you suggested and tried to call service but I get an error ā€œInvalid JSONā€

Iā€™m sorry it was missing a comma after each parameter.

{ā€œentity_idā€:ā€œmedia_player.living_room_speakerā€,
ā€œmedia_content_idā€:ā€œhttp://10.0.0.3:8123/local/azan2.mp3ā€,
ā€œmedia_content_typeā€:ā€œmucisā€}

image

Please give it a try.

Thanks, I still get ā€œinvalid JSONā€

call%20service2

But Iā€™m now able to trigger it via google home trigger page and plays the adhan.
Now to see if the automation works

Thanks heaps for your assistance. hopefully, I can work out the rest.

Glad to hear you were able to get the athan to play.
just a side note, i noticed you used (media_player.media_ play) instead of (media_player.play_media) and thatā€™s why you were still getting the invalid JSON.
Let us know you make out.

S.A
Looks like HA is upgrading youtube_dl in the next update. We should be able to play links from youtube directly AGAIN :slight_smile: