Islamic Prayer Times Notifications (On mobile device and Media Player like Alexa)

It played when the file when the sensor detected its time but didn’t play the entire file. This was playing it on HomePod I haven’t had time to set up the Alexa and google mini yet wanted to enable remote access using the cloud flare method first.
so this is my code, when i take out the trigger and put it into the developer tool to test it it plays all the way through.

alias: Athan Call
description: ""
trigger:
  - platform: time
    id: asr
    at: sensor.asr_prayer
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: asr
        sequence:
          - service: media_player.play_media
            target:
              entity_id: media_player.living_room_2
            data:
              media_content_id: media-source://media_source/local/ZuhrAzan.mp3
              media_content_type: audio/mpeg
            metadata:
              title: ZuhrAzan.mp3
              thumbnail: null
              media_class: music
              children_media_class: null
              navigateIds:
                - {}
                - media_content_type: app
                  media_content_id: media-source://media_source
mode: single

Edit 2: so it did play through but a couple times it cut out but came back in going to try the other HomePod and see if connection issue. As well will try and set up the Alexa and see if that’ll work better
edit 3: now it wont work in the developer spot to test the call service… getting mroe and more confused think i need to start over with the code later tonight or this weekend

Time to time, I experienced that problem with alexa devices. But it will continue to play on other alexa devices. I am not quite sure about the cause but I think it might be the hardware where you installed HA on. It might be also the a connection issue as well. What kind of hardware are you using for your system? I have mine on an old nuc with 16 gig of ram with proxmox as the main base.

one more thing, if you have apple music, try to play the adthan from their service instead of from your HA assisstant local server.

im running my HA on a raspberry pi 3b+, the speakers are homepods gen 1, i have an amazon echo dot and google home mini i need to set up but i wanted to try and set up remote access without nabu casa and then do the other 2 speakers.

I have apple music, ill have to try and tie that into HA then is that through the itunes integration do you know? ill do some googling as well.

i put a 25 min delay on the asr time so going to see if that goes off at a better time today

Since you have apple music, create a playlist and put on it an adthan. Then follow image. This is just like what the person did on youtube
! That might help the audio playing.
I only own echo devices and I did setup the remote access without the nabu casa. It took time but you have to follow the exact steps related to configure your amazon account and also to HA. There are plenty of videos to show you how to do that. At first, I chose the duckdns. Then I swiched to a different domain name provider.

ill give that shot with apple music i forgot about that cuz the first time i used it with apple music it didnt work but curious if that is because the code wasnt right

side note which method did you end up using for the echo out of the 4 options the guide gives you. going to try and set up remote access now if i can… the video i watched had the free domain site as not allowing new domains right now so will have to find another

I am not sure what you meant by “echo out of the 4 options”. But, I added alexa to home assistant after reading and watching at leat 4 videos. Some of them are outdated. Just search on youtube to add alexa (free) to home assistant. It will be a long process and you have to be focused.
But before that, you need to set up the remote access. Again, duckdns still offer free domain along with freenom. Search how to that and it s easy comparing to the Alexa process.

started the process last night and failed lol, got locked out of my home assistant and had to restore back up. freenom currently doesnt work and i was trying duck dns but my router doesnt allow for port forwarding the 443 for google and alexa like the video said. the 4 options were from the alexa integration guide on home assistants page.

edit: so i tried maghrib with the APPLE MUSIC chosen and my play list as Smart Athan and nothing happened. I put the code into developer to try it and even then it doesnt play not sure what i missed

alias: Athan Call2
description: ""
trigger:
  - platform: time
    id: maghrib
    at: sensor.maghrib_prayer
condition: []
action:
  - service: media_player.play_media
    data:
      media_content_id: Smart Athan
      media_content_type: APPLE MUSIC
      enqueue: play
    target:
      entity_id: media_player.living_room_3
mode: single

Not quite sure. I just saw the video from the operator using apple music but with alexa device For homepods, I dont own them nor have apple music. It could be that you need homekit integration. I suggest to start working on the remote access first. If you can’t afford the nabu casa service, check how can you make your router accept port forwarding. What model of router do you own?
As a side of note, always check the HA configuration before doing a restart by going to developer tools.

ill ask on discord, i do have homekit integrated but didnt see anything for music ill take another look. my router is the crappy ISP one they give you its a shaw blue curve gateway. ill have to try and get a different router with more freedoms. the way they have me do port forwarding as well is in an app not a web browser and you can only select the device and set the port so i cant set it up like most of the videos show. i was able to have remote access but then i couldnt use google speaker with is so i removed it lol.

also i always run the config for restart once i saw it in a video just incase. im too new to this to trust what i wrote in lol

Dont expect port forwarding to be exactly as you see it on any video unless you have the same device. My advice is check the name and the model of your the router that your isp provided you and google it. You should be able to login into it via the browser. I personally bought my own modem and router even though my isp does provide them. I can tweak them according to my needs.

ya you cant loginto the browser it literally takes you to a page that says its easier then ever to port forward and tells you to use the app… which is trash lol. ill get a router down the road, sucks i had one from when we were in our suite and then when we got our own place i sold it cuz i figured we have this now we dont need the router (it was for boosting landlords signal downstairs)… big mistake now apparently

How do we add the volume feature to the blueprint? I have google nest devices where volume needs to be increased or decreased for playing Azan

It seems working but when it comes time to play it says “sorry I’m having trouble accessing simon skill right now”

Any idea what or why? I’m very new to home assisstant.

@hassanz07 You will get that message if the encoding of the mp3 file is not compatible with Alexa standards. It may also be the length of the audio file exceeding the 240 seconds.
You can convert the audio file with ffmpeg with the following command:

ffmpeg -y -i az.mp3 -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 az-converted.mp3

Let me know if you need assistance converting the athan file.

For playing sound on Alexa I understand that you have to add the Amazon Alexa integration from HACS

For the Spotify or Apple Music what is needed to add them … shall it be a service or what.?

try Smart Azan Automation For Alexa for a full automated experience for alexa azan.

1 Like