OpenHAB won't reconnect if Squeezebox server goes offline...

139 views
Skip to first unread message

Tommy Sharp

unread,
Mar 11, 2015, 6:39:02 AM3/11/15
to ope...@googlegroups.com
If the squeezebox server goes offline for a short period of time then I have to start openhab to get this binding to work again.... Anyway to overcome this?

Ben Jones

unread,
Mar 11, 2015, 4:17:01 PM3/11/15
to ope...@googlegroups.com
The binding is designed to check the connection state before each command is sent, and attempt to re-connect if it is found to be down. I am pretty sure this works on my system, I haven't noticed the binding going offline, but then I probably haven't restarted my Squeezeserver for a long time...what is reported in the Squeezeserver IO/binding logs?

Tommy Sharp

unread,
Mar 11, 2015, 10:22:34 PM3/11/15
to ope...@googlegroups.com
Hi Ben....

If I manually shut down the Squeeze Box server I see this which is understandable...

[WARN ] [io.squeezeserver.SqueezeServer] - Squeeze Server listener exiting.
[WARN ] [squeezebox.internal.Squeezebox] - Not connected to the Squeeze Server. Please check your config and consult the openHAB WIKI for instructions on how to configure. Ignoring action.

I then start it up again.... Send some music to a speak using my phone app and that works fine...

Try make OpenHAB "say" something and I get this in the logs...

[WARN ] [squeezebox.internal.Squeezebox] - Not connected to the Squeeze Server. Please check your config and consult the openHAB WIKI for instructions on how to configure. Ignoring action.

It looks like it doesn't restart the "listener" at any time in the logs?

Ben Jones

unread,
Mar 11, 2015, 10:36:19 PM3/11/15
to ope...@googlegroups.com
Yep - that looks like a bug. If you do something via the Squeezebox binding it should re-connect, and then your action will work. But if the first thing you attempt to do after a disconnect is a Squeezebox action it will not re-connect. So by 'binding' I mean send a command via an item binding - rather than an action in one of your rules.

The bug is that in the action code we are checking the connection state and stopping if it is found to be down, before sending anything to io.squeezeserver. However in the binding it will send the command down to io.squeezeserver regardless, which is where the reconnection logic is.

So I think all the tests in the action code to see if a player id is valid, should be removed. The only issue with that is we don't know if the command was successful so we should really be returning a bool from all the server commands - indicating if they were successfully processed or not.

Unfortunately I have no dev environment currently (on going issues with trying to get openHAB building on my new Windows machine!) so can't code this up and test locally.

You feel up to getting your hands dirty on some Java code...? ;)
--
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/WTz_Tg9_V_g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
To view this discussion on the web visit https://groups.google.com/d/msgid/openhab/515bb712-dd50-4a7c-91bc-9e446b2ab70b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tommy Sharp

unread,
Mar 12, 2015, 12:15:22 AM3/12/15
to ope...@googlegroups.com

Thanks Ben! If I knew the first thing about Java I'd be straight in there... My background is in SQL programming so I have a decent grasp of logic. I'll try put in a rule that runs every 15 minutes and performs some arbitrary item binding command and that should at least ensure it's connected every 15 minutes...

Tommy Sharp

unread,
Mar 12, 2015, 3:48:41 PM3/12/15
to ope...@googlegroups.com
Hi Ben, have given this a try... I was hoping to put in a rule that does something with the Squeezebox binding ever 15 minutes, thus waking it up if it's not properly connected.

About the most unobtrusive thing I could see whas maybe adjusting the volume down by 1% and then back up by 1% but this doesn't seem to force a reconnect. If I update the "play" to off and then back on then it properly re-establishes the connect. But if I did this every 15 minute's I'd be sure to get some complaints from the rest of the family :-)

Will keep an eye out and hopefully you get your dev environment back up and running some time.

Thanks again! 

Ben Jones

unread,
Mar 12, 2015, 3:51:32 PM3/12/15
to ope...@googlegroups.com
Are you adjusting the volume via an item binding, or the Squeezebox action?

I would have thought it should have worked if using the item binding.

Perhaps someone else with a dev environment can have a look at this?

I propose just removing the checks in each Squeezebox action to see if
the player id is valid (which first checks to see if the controller is
online).

Ideally we still want the actions to return true/false depending on
whether the action was successful, but the server bundle doesn't return
any ACK so this is not currently possible with any certainty anyway.

Ben Jones

unread,
Apr 30, 2015, 4:52:27 AM4/30/15
to ope...@googlegroups.com
Hey Tommy - just a heads up - I finally got around to fixing this bug!


Don't think it will make it into the 1.7 release unfortunately but at least it should be a bit more robust going forward!

Cheers,
Ben

Tommy Sharp

unread,
Apr 30, 2015, 7:38:15 AM4/30/15
to ope...@googlegroups.com
Hey Ben thanks for the update!
Reply all
Reply to author
Forward
0 new messages