@nairb wrote:
I am trying to get Sonos to play an MP3 file when triggered by a sensor, a topic that has been aired a couple of times. Here is the relevant part of the script
- service: media_player.play_media data_template: entity_id: "{{ sonos_entity|default('media_player.kitchen') }}" media_content_id: "{{ file|default('https://www.ha-belmont.duckdns.org:8123/local/dog.mp3') }}" media_content_type: music
No error is being raised on HA and the Sonos app on the PC receives the file request ,but responds with “Unable to play ‘dog-barking.mp3’ - the song is not encoded correctly.” A bit of research via the Sonos Forum suggests that this typically because of network problems.
Via the Developer tool I have called media_player.play_media with every possible form of file format I could come up with and also tried content type as music and audio/mp4 with each combination.
I am running HA version 101.3
I have an HA script to play TTS messages which is working fine
Sonos software is up to date
The mp3 file plays correctly on Sonos when selected via Sonos, so the format of the file is ok.
I suspect that the answer is blindingly obvious but I am not sure what to try next.
Posts: 1
Participants: 1