tung256
(tung)
May 12, 2024, 12:48pm
1
this is my code and it refuses to work so im thinking it’s my syntax:
the file is located here on the HA machine:
where did i go wrong?
action:
- service: media_player.media_play
data:
media_content_id: media-source://media_source/local/media/ding2.mp3
media_content_type: audio/mpeg
target:
entity_id: media_player.basement_speaker
123
(Taras)
May 12, 2024, 1:00pm
2
This is the service call you should use:
media_player.play_media
Besides the comment from Taras above you need to put the media
folder under the www
folder
tung256
(tung)
May 12, 2024, 2:59pm
4
i put in the mp3 file in the path you suggested
code updated to new path as seen below. still no luck. do i have to set permission to this “media” folder in www?
action:
- service: media_player.play_media
data:
media_content_id: media-source://media_source/local/www/media/ding2.mp3
media_content_type: audio/mpeg
target:
entity_id: media_player.basement_speaker
the Google Mini at least seems to respond this time with a tone…but still cant play that mp3 file. i can confirm that mp3 file is not corrupt because it plays fine in browser
is there an error in the logs?
tung256
(tung)
May 12, 2024, 3:36pm
6
tung256
(tung)
May 12, 2024, 3:50pm
7
happy to say this works now thanks to a Reddit post.
MP3 file located in www folder as you suggested
action:
- service: media_player.play_media
data:
media_content_id: http://192.168.1.99:8123/local/media/ding2.mp3
media_content_type: audio/mpeg
target:
entity_id: media_player.basement_speaker
now, will this action always work, even when my Mini is offline? or it still needs cloud connection to work?
123
(Taras)
May 12, 2024, 4:06pm
8
Then the path to the mp3 file is incorrect.
If you use media-source://
then the path should be relative to it (i.e. not relative to the www
folder).
action:
- service: media_player.play_media
data:
media_content_id: media-source://media_source/local/media/ding2.mp3
media_content_type: audio/mpeg
target:
entity_id: media_player.basement_speaker
You mean, from internet. I would guess yes but I have not tried it (if I recall) since it’s locally stored. Try to disconnect internet and you will see
tung256
(tung)
May 12, 2024, 6:52pm
10
using pfsense, i blocked it from getting online.
the Mini acknowledges it is not connected to the net.
but my automation to play the mp3 file works fine still woohoooo
You need to drop Google DNS requests in whatever firewall you’re running and force the mini to use a different DNS.