thanks ill take a look at your code and give it a shot. i havent set up the alex and google home mini yet as i was debating trying to setup remote access without subscription for cloud access havent had time yet. Ill look into sonos but right now funds are a little tight so im using what i got lol. Ill take a look for some of the tutorials and see if i can make it work… might just have it come out the apple homepods if it seems too difficult to run off the 3 different types… thinking id maybe need 3 different scripts set up for it maybe… thanks for the advice ill give it a go this weekend
You can check the following video from youtube even you don’t understand the language (which what I did). He is using apple music to play adthan in alexa but the process is the same for homepods (when he is choosing the media player, you will choose your homepods. The code I posted above is inspired from the person on the video. I tweaked a little for my needs. Just make sure your homepods are integrated in the HA.
Click here to see the video.
so finally trying to set this up i followed the video but it wouldnt let me save giving me an error so ive started going visual to yaml and trying to match yours. my media is confusing me. I have an athan downloaded from apple music but cant figure out how to link it. so was going to put an mp3 in my media folder. however i have samba installed and ive accessed the media folder before to add a photos folder. now i want to add an audio folder and it wont open my HA on windows just wants to open the webpage. getting verty confused here with this set up
alias: Athan Call
description: ""
trigger:
- platform: time
id: dhuhr
at: sensor.dhuhr_prayer
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: dhuhr
sequence:
- service: media_player.media_pause
data: {}
target:
entity_id:
- media_player.living_room_2
- media_player.living_room_3
- service: media_player.play_media
data:
message: <audio src='https://homeassistant.local:xxxx/local/ZuhrAthan.mp3'/>
target:
entity_id:
- media_player.living_room_2
- media_player.living_room_3
mode: single
so i set this up and ran the test and it doesnt work… not sure what i did wrong
1- Which media player devices are you trying to play adthan on? Alexa devices or apple homepods? Also, make sure they are connected to HA?
2- Check the following screenshot and follow it
Also, to be able to play the adthan from your own home assistant server, you will need to have it configured to connect to it remotely from outside. The easy way is through Nabucasa.
If you are still facing challenges, I will be happy to assist you if you prefer doing it one on one.
so i just tested dhuhr with my working call service from the developer tools but i think i messed up my trigger
alias: Athan Call
description: ""
trigger:
- platform: time
id: dhuhr
at: sensor.dhuhr_prayer
condition: []
action:
- service: media_player.play_media
data:
media_content_id: http://homeassistant.local:####/local/ZuhrAzan.mp3
media_content_type: music
annouce: true
target:
entity_id:
- media_player.living_room_2
mode: single
edit: so i retried and got this:
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
the only problem i forsee is for instance asr time is still about 30min off which is frustrating… debating if i should set the time and then change it manually every day or 2… havent decided yet
If you got it to work and just need to offset the time for Asr prayer, you can add delay command in the actions.
alias: Athan Call
description: ""
trigger:
- platform: time
id: asr
at: sensor.asr_prayer
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: asr
sequence:
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
- 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
You can do this way above or follow what this person mentioned here
oh that seems simple thank you… at least from a quick glance how you did it verse the other post lol. I wrote down my mosque times and HA times yesterday and going to do that for the week and see if its the same time everytime then itll make it alot easier.
side question if you can delay the time is there a way to play it earlier? some of them go off 5-10min late but if the times are the same offset every day then i thought maybe i could have them play early as well if possible
To play it earlier, I am going to quote @123 from this post.
Here is his code:
trigger:
- platform: template
value_template: >
{{ now().timestamp() | int(0) + 600 in expand('sensor.fajr_prayer', 'sensor.dhuhr_prayer',
'sensor.asr_prayer', 'sensor.isha_prayer', 'sensor.maghrib_prayer')
| map(attribute='state') | map('as_timestamp') | list }}
ok thanks ill start with the delay and see how that works out and then move to the earlier. YAML really confuses me lol just need more practice i guess
So…… I didn’t even try a offset yet I just decided to
Make a second automation for Maghrib and make sure that one worked as well. The first time asr went off it worked now today it starts maybe 10-15 sec then stops and maghrib did the same so back to the drawing board not sure what went wrong
You mean the audio file for adthan started on time but it did not go through the whole time length? what device:Alexa or homepods?
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 . 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.