matust
September 22, 2017, 10:19am
1
Hi,
I cant play a local file to my chromecast audio. This is the current setup in my automation.yaml
- alias: 'test alarm sound'
trigger:
platform: state
entity_id: input_boolean.input_boolean_test
from: 'off'
to: 'on'
action:
- service: media_player.play_media
data:
entity_id: media_player.audio_chromecast
media_content_id: '/home/homeassistant/.homeassistant/media/alarm.mp3'
media_content_type: 'audio/mp3'
I’ve also tried media_content_type: 'music'
but that hasn’t worked either.
The input boolean works as I tested it with a push message and it worked fine.
Any ideas?
You can’t play local files, there is a bug report for this.
At this time you need to use your external url:
https://YOUR-URL.duckdns.org/alarm.mp3
atomicpapa
(Glenn Morrison)
September 23, 2017, 1:18pm
3
Should also note that you would need to drop alarm.mp3 into your /home/homeassistant/.homeassistant/www forlder for this workaround to work. Also, I would think that you would be able to reference it with
http://:8123/alarm.mp3, but maybe not since there is a bug involved
matust
September 23, 2017, 1:57pm
4
Ok thanks. I spent a while trying to work it out. I don’t think the external url will work for me as it’s not exposed to internet.
matust
September 23, 2017, 2:00pm
5
I have since tried moving the file from /media to /www with no success but I haven’t tried referencing it through http://mylocalip:8123/alarm.mp3 since being in the /www folder so I’ll try. Cheers
frelev
November 19, 2017, 10:37am
6
Did you solve this?
I have my file in www folder of hass but all I get is 404: Not Found. Both using internal/external URL
matust
November 19, 2017, 11:17am
7
No, I didn’t figure it out. If you can find a way please let me know
cameron
November 19, 2017, 11:18am
8
Try
media_content_id: http://hass_ip:8123/local/test.mp3
media_content_type: ‘music’
matust
November 19, 2017, 11:47am
9
That doesn’t seem to work either. I think it might be an issue with casting to chromecast audios
frelev
November 19, 2017, 2:20pm
10
As an initial test, shouldnt I be able to put http://hass_ip:8123/local/test.mp3 in browser and be able to access file?
cameron
November 19, 2017, 5:51pm
11
Yes if you put in your own IP address in and have the mp3 file in the www directory.
The other thing you can try is.
http:
base_url: http://hass_ip:8123
matust
November 21, 2017, 11:03pm
12
I have just got it working using this
- alias: 'test alarm sound'
trigger:
platform: state
entity_id: input_boolean.input_boolean_test
from: 'off'
to: 'on'
action:
- service: media_player.play_media
data:
entity_id: media_player.lounge_speakers
media_content_id: https://myduckdns.duckdns.org/local/alarm.mp3
media_content_type: 'audio/mp3'
4 Likes