Your post with the file path implied that doorbell.mp3 is in your OH sounds directory. sendCommand() doesn’t serve up local OH2 files. To do this you have to use playSound() as suggested. The FILE:// syntax is used when playing from a remote player like LMS, not local.
Thanks for all help but now i’m into a new problem error messeag saying no audiosink I don’t know wath to choose since players ar several diffrent?
In PaperUI, Configuration, System, Audio you can select a default Audiosink.
In your rules you can use any Player you want, just as @mhilbush explained in his previous post:
I guess I might have figured out where my problem is but really dont now how to fix it I had default audio system spekaer with mp3 support in paper ui and added in textual cfg enchancedjava… or what’s supposed to be. But when i look att my player theres no UID in properties and in example there seems to be a uid in uppercase with - between series. What have I been doing wrong?
And heres how a channel is set up for the same player
Look what it says below the Channel “Volume” in your Screenshot, that is the UID and then do this:
Try this in your rule instead (replacing the string with your player thing UID):
var string player = "squeezebox:squeezeboxplayer:YOUR-UID" playSound(player, "doorbell.mp3")
Yes this is my rule for now but still gets error no audio sink even though I set it bot textual and in paper ui. Is there om MP3 support och codec that could be mising, I usally only plays spotify and web radio.
Item gDO_kokknapp changed from OFF to ON
var string player "squeezebox:squeezeboxplayer:571ee880:c4e984dbd489"
Strange. In PaperUI, Configuration, System, Audio set any of your Squeezeboxes as default.
Save and quite frankly, after that I would go for IT problem solver #1:
Perform a reboot and then try again
But how do I set my squeezeboxes as default audiosink the only options availible is systemspeakre systemspeaker with mp3 support and webaudio, maybe this is the problem?
Aha now we are getting somewhere. If you don’t get the option, you are probably on the Stable Release. This feature is currently only available in the Snapshot release. You need to update. See here for details:
Good that we finally came to some conclusion in this cas butI think it a bit of a hassle to upgrade mostly since my Linux skills are quite poor. Since I’ve done some configuration in paper UI I guess that those settings will be lost due to upfrading to snapshot? I’ve configured all channels and so on textual way but have all bridges set up in Paper UI, and to be honest I’m just to lacy to redo all of that. I can host the file on my web server but that seems slow a delay at almost 5 seconds before it starts to play. I’m intereset in sett up door bells in several places in our house either as a squeezebox or chromecast. But I alos ound a cheap set of Wifi speaker thats sold under the brnd Roxcore her in sweden but I haven’t seen any support for it here but a small wifi speaker is just around 90USD That schould be nice option
When I migrated to OH2 I fell into the same trap. Set up the stable version and found i lack exactly this function. I upgraded to Snapshot as explained in previous post and I did not loose anything, neither did something brake. It was a 10 minutes operation.
As no two setups are the same, YMMW, but i would say the risk is low, the gain is big.
Now I followed your advice and it seems like evreything is working as it’s supposed to. Only troble where to ad on } at the end of sitemap since OH didn’t recognized them. From push at the door button to playing audio is about 3seconds so not so much faster than my HHTP server but atleast it works at its supposed to. I made apt-get update and then apt-get upgrade but maybe I could do someting simplier to only upgrade OH.
I’m running theese machines on HP thin client (got a surplus of them) os Lubuntu 14 running from 16GB USB drive and using internal storage of 1GB for swap. One machines hostes openhab and serves as a squeezeplayer. Could there be some trick to shorten the delay from buttonpush to audio playing or to make it play the file like 4 times in a row or is it easier to just make a new file with loops inside?
Glad you got it working.
3 seconds is not that bad i think. Still, you could check with the “top” command if this is maxing out your cpu. if so, the only speed gain would be better Hardware.
As for playing the sound several times, i would say a an mp3 with loops is the cleanest solution.
On a sidenote: If you are really running Lubuntu 14 you definitely should upgrade to something more recent.
Latest is Lubuntu 16.10 so you are running a real security risk there.
That sounds about right. Unfortunately, I’ve not found a way to optimize this any further. The primary cause of the delay is the time to add the notification URL to the LMS playlist then switch to that item in the playlist, which takes some time. That’s the way the OH1 binding did it, and I haven’t found another (quicker) way to do it (without losing the currently playing item and the entire playlist).
Glad you got things working!
Yeah now it works really nice I use my old Nexa doorbell pushbuttons and let my squeezlite player play som sounds. I start svereal rule simultanously to play it faster on multiple players got for in a total. Maybe in the future I could put in some motion detectors that maybe keep track of where I am or not so basement wouldn’t alway play doorbell if I’m not there just an idea. I noticed in the updated versions there’s seem to be som new channels for instance notification volume is that a separate volume control that could be used for playsound() that should be rally nice.
My openHAB keeps dropping its connection to my Squeezebox server so it no longer can control it or receive updates. Just seen this in the log;
openhab_1 | Exception in thread “Squeeze Server Listener” java.lang.ArrayIndexOutOfBoundsException: 2
openhab_1 | at org.openhab.binding.squeezebox.handler.SqueezeBoxServerHandler$SqueezeServerListener.handlePlaylistMessage(SqueezeBoxServerHandler.java:811)
openhab_1 | at org.openhab.binding.squeezebox.handler.SqueezeBoxServerHandler$SqueezeServerListener.handlePlayerUpdate(SqueezeBoxServerHandler.java:555)
openhab_1 | at org.openhab.binding.squeezebox.handler.SqueezeBoxServerHandler$SqueezeServerListener.run(SqueezeBoxServerHandler.java:432)
Any ideas… this never used to be an issue, but has been for the last few weeks, maybe a bit longer.
If I update the .things file it refreshes and comes back to life. Sometimes it’s good for days, others just minuets.
@jmccoy555 I see area in the code where it’s failing. What’s odd is that this part of the code hasn’t changed in well over a year.
What version of openHAB are you running, and what version of the LMS are you running? Has anything changed recently in your environment?
Hi @mhilbush , I’m glad you can see something is wrong as it been driving me crazy!!! If’s funny how quickkly you miss the automation of the radio coming on in the morning and turning off when you leave the house
I’m running openhab/openhab:2.3.0-amd64-debian, but have also tried gong back to 2.2.0 and forward to the 2.4.0 snapshot today, and the alpine versions. I get the same issue.
Logitech Media Server Version: 7.9.2 - 1539951408 @ Fri Oct 19 14:46:40 CEST 2018 which is the latest, but I was also getting this problem with previous version too.
The only thing I can think of is I switched from docker run scripts to docker-compose but can’t see why that would change anything. Maybe this pulled down different versions or something, I don’t know. But my docker host has been rebuilt a few times in the last year so nothing could have been that old.
If you need anything else or something testing just shout!!
I agree. Should not be an issue.
I could build a version of the binding that defends against this issue. But I’d really like to get to the root cause.
When the problem occurs, does it correlate with you performing some type of action on a playlist – such as hitting play/pause, loading a playlist, modifying a playlist, shuffle, repeat, etc.?
To help track it down, you could try this:
- put the squeezebox binding into TRACE mode (note this will generate a lot of log messages
- change to the logs directory
- in a shell, run the following, letting it run until the problem occurs (note you may need to install expect in order to get the unbuffer command)
tail -f openhab.log | unbuffer -p grep -e "Message received: [a-zA-Z0-9%]* playlist" | tee /tmp/playlist.log
It will generate something like this whenever a playlist operation occurs.
2018-10-24 07:58:50.479 [TRACE] [rnal.handler.SqueezeBoxServerHandler] - Message received: 00%3A04%3A20%3A16%3A5e%3Ae2 playlist pause 1 2018-10-24 07:58:52.867 [TRACE] [rnal.handler.SqueezeBoxServerHandler] - Message received: 00%3A04%3A20%3A16%3A5e%3Ae2 playlist pause 0 2018-10-24 07:58:53.621 [TRACE] [rnal.handler.SqueezeBoxServerHandler] - Message received: 00%3A04%3A20%3A16%3A5e%3Ae2 playlist pause 1 2018-10-24 07:58:54.440 [TRACE] [rnal.handler.SqueezeBoxServerHandler] - Message received: 00%3A04%3A20%3A16%3A5e%3Ae2 playlist pause 0 2018-10-24 07:59:02.190 [TRACE] [rnal.handler.SqueezeBoxServerHandler] - Message received: 00%3A04%3A20%3A16%3A5e%3Ae2 playlist pause 1 2018-10-24 07:59:08.941 [TRACE] [rnal.handler.SqueezeBoxServerHandler] - Message received: 00%3A04%3A20%3A16%3A5e%3Ae2 playlistcontrol cmd%3Aload playlist_id%3A13633 count%3A135 2018-10-24 07:59:08.943 [TRACE] [rnal.handler.SqueezeBoxServerHandler] - Message received: 00%3A04%3A20%3A16%3A5e%3Ae2 playlist stop 2018-10-24 07:59:08.952 [TRACE] [rnal.handler.SqueezeBoxServerHandler] - Message received: 00%3A04%3A20%3A16%3A5e%3Ae2 playlist loadtracks playlist.id%3D13633 index%3A0 2018-10-24 07:59:08.981 [TRACE] [rnal.handler.SqueezeBoxServerHandler] - Message received: 00%3A04%3A20%3A16%3A5e%3Ae2 playlist jump 0
When the problem occurs again, I’d like to see the playlist.log file.
No, not from me anyway, I can start something playing and then come back to adjust the volume or something and nothing happens.
Ok, I’ll get the logs going and revert back once its happened again.