###################################
## Grandfather Clock simulation.
## Plays Westminster Chimes on the hour and chimes 1 time on the half
## Script from CCOSTAN cuckoo clock but modified for the grandfather
###################################
- alias: Grandfather Clock
trigger:
- platform: time
minutes: 45
seconds: 00
- platform: time
minutes: 30
seconds: 00
condition:
- condition: time
after: '00:08:00'
before: '21:30:00'
action:
- service: media_player.volume_set
entity_id:
- media_player.living_room
data:
volume_level: 0.50
- service: media_player.play_media
data_template:
entity_id:
- media_player.living_room
media_content_id: >
{% if now().strftime("%M")|int == 30 %}
/config/sound/GrandFatherChime01.mp3
{% else %}
/config/sound/westminster.mp3
{% endif %}
media_content_type: audio/mp3
Yes I know I have it set for 45 after because I’ve been testing it out
But whenever it runs it throws
2018-01-01 18:45:01 ERROR (SyncWorker_7) [soco.services] UPnP Error 714 received: Illegal MIME-Type from 192.168.7.125
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/soco/services.py", line 404, in send_command
self.handle_upnp_error(response.text)
File "/usr/lib/python3.6/site-packages/soco/services.py", line 465, in handle_upnp_error
error_xml=xml_error
soco.exceptions.SoCoUPnPException: UPnP Error 714 received: Illegal MIME-Type from 192.168.7.125
2018-01-01 18:45:01 ERROR (SyncWorker_7) [homeassistant.components.media_player.sonos] Error on play_media with UPnP Error 714 received: Illegal MIME-Type from 192.168.7.125
I"ve searched around and all I can find related to it is just SPOTIFY stuff. There’s gotta be something stupid that I’m missing in my config to have sonos play a file. Or maybe I screwed up by putting the files locally on the box? I just moved my config from a VM to a PI the other day. Thanks for your help.
BTW finally put in the right magical search terms in Google and figured this out. I had to put the files for the chimes in a www folder and then used the following code to make the calls to the files
Hi, could you please help me identifying problem with the approach to play an mp3 file on Sonos through automation? I am running Hassio 0.75.3 with below code which is bundled with alarm clock that turns on hue bulb at alarm time. Alarm is working with bulb but not at all playing mp3 file below:
wake_up script simply turns on hue bulb with preset bringhtness. Mp3 file doorbell is placed under www folder in config directory. I am also able to access & play media file via web browser via the address http://192.168.0.214:8123/local/doorbell.mp3. There is no error associated with Sonos in log file. I also have TTS script for Sonos that works very well with text messages.
I tried www instead of local doesn’t work, even accessing it from web browser gives error 404: Not Found .
I tried reformatting audio file to 44.1KHz sampling/16bit it started working (using local) with both mp3 and wav format but still there is something that doesn’t allow 4 second audio file to run fully and finishes in less than a second. I had similar experience with Sonos while playing text messages with google TTS, it was playing those messages partly and chopping off last portion of it.
Thanks for your inputs, it is working with audio/mp3 as well as with music. I also figured out the reason for output getting chopped, it was due to sonos.restore service that not letting file to play completely. I added 5 seconds delay just before -service: media_player.sonos_restore in my code and it played well but with the condition of mp3 or wav audio file with 44.1KHz sampling rate/16bit conversion.
Thanks for bringing this problem of sonos restore up. I spent half a day in order to figure out why my script (which worked fine in v0.60) does no longer work in v0.78.
I have put an additional wait command which prevents the restore to happen before longer audio files have finished.
Just got this error by updating from 0.116.2 to 2020.12.
Anyone got a clue what to do? Playing short and long mp3s worked flawlessly with that version (I’ve initially set this up in like Nov. 2020) but by updating to 2020.12 today its not working anymore and in the logs I see the following:
Error on play_media with UPnP Error 701 received: Transition not available from 192.168.178.35
6:17:46 PM – Sonos (ERROR) - message first occurred at 6:17:45 PM and shows up 3 times