jak / homebridge-sonos-announcer

Announce things via Homebridge and Sonos
MIT License
3 stars 0 forks source link

Sonos plays music but not specified soundfile #3

Open arne-conrad opened 1 year ago

arne-conrad commented 1 year ago

Describe Your Problem:

Changed configuration in homebridge to my Sonos speaker and left soundfile the same. However, the speaker only starts playing the music last played on it instead of playing the desired soundfile. Music keeps playing for some seconds, then skips to next track, after some seconds skips to next track again and then keeps playing the music like usual. Specified soundfile is never played. No matter if I leave the standard soundf (someone is at the door) or if I enter any other.

Logs:

CLOSED [22/07/2023, 10:09:21] [SonosAnnouncer] Switch state was set to: ON [22/07/2023, 10:09:31] [SonosAnnouncer] Switch state was set to: ON [22/07/2023, 10:09:32] [SonosAnnouncer] Doorbell Chime Homebridge on Outside completed. [22/07/2023, 10:09:32] [SonosAnnouncer] Switch state was set to: OFF [22/07/2023, 10:09:42] [SonosAnnouncer] Doorbell Chime Homebridge on Outside completed. [22/07/2023, 10:09:42] [SonosAnnouncer] Switch state was set to: OFF

Plugin Config:

"switches": [ { "deviceNames": [ "Outside" ], "switchName": "Doorbell Chime Homebridge", "trackUri": "https://soundbible.com/grab.php?id=1466&type=mp3", "timeout": 10, "volume": 30, "delayMs": 100 } ], "platform": "SonosAnnouncer" }

Environment:

MarshallErPunkt commented 1 year ago

hey i think the problem is the path (trackUri) to the mp3 file. I had a similar problem. A URL is required which points directly to the MP3 file and not a download URL. If you search on Google: doorbell.mp3 "index of" some MP3 files will be displayed - for example this one: https://downloads.nymea.io/notification-sounds/doorbell.mp3 (i think this is the same mp3 that you tried to play)

If you store this as a trackUri it works for me.

Try it out with this one. I solved it by creating my own MP3 and making it available on the Raspberry Pi via FTP: https://github.com/jak/homebridge-sonos-announcer/discussions/2

Thanks & Greetings Marshall

arne-conrad commented 1 year ago

Hi Marshall,

thanks for the tip - it worked! Next I would like to do the same as you and have the sound played locally from the RaspberryPi. Do you have any tutorial on how to do so = what worked for you best? I already briefly saw your comments on the original plugin and will go through them this weekend.

Thanks and best regards drarco

MarshallErPunkt commented 1 year ago

So for the web server I used lighttpd and set port 88.

here are instructions: https://linuxhint.com/setup-lighttpd-server-raspberry-pi/

I then filed the Mp3 under /var/www/html in my case i created an extra folder named sounds

in the plugin you can then simply control the files via your raspberry ip: _http://{RASPBERRY_IP}:88/sounds/Test.mp3_

I hope it helps :)

greeting Marshall

arne-conrad commented 9 months ago

Hey marshall,

thank you very much for your answer and sorry for not getting back earlier. I just found the time to play around with this plugin once again but have a question right at the beginning: do you also run homebridge on your Pi and if so, how did you manage to install the lightttp webserver simultaneously? Did you use the terminal/console within the homebridge UI using pi@homebridge and following the commands from your previous link?

Thanks for clarification!

cirrusflyer commented 8 months ago

I'm seeing the same thing. It played what was in the queue already, but not the TTS URL I provided in the plugin:

https://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&tl=en&q=The%20alarm%20will%20sound%20in%20ten%20seconds

It does work if the URL is a mp3 file on a local webserver.