[SOLVED] Feature Request: Squeezebox Binding add "sleep" Channel

Hi Folks,

I was wondering why the sleep function which is available in squeezeboxserver API is not available in the squeezebox binding.

the http looks like this:

http://192.168.1.100:9000/status.html?p0=sleep&p1=200&player=86%3A43%3A12%3A37%3A2e%3A3e&;cauth=e12e6db1c745g734ec2ca99b4302cf94

where the p0 is the sleep command and p1 is the time in seconds until stopping the playback.

I have no idea if this would be easy to implement… by the way, where can I find the sources of the binding to try to implement this? or should I ask the developers to do so?!?

cheers, Dan

Maybe because no one has ever asked for it. :wink:

Probably not too hard. Initial thought would be a sleep channel of type Number on the player thing. To activate you would send a command containing the number of minutes (or seconds) to an item linked to that channel. Oddly, I don’t see a way to cancel it.

The squeezebox binding source code is here. :grinning_face_with_smiling_eyes:

2 Likes

that makes sense :wink:

I only use this for sleeping, so cancelling is not neccesary for me… actually i have to use my android squeeze control app in addition to my sleeping automation - thats why I asked…
I’ll have a look at the code, thanks Mark :wink: if I run into problems I’ll post it here :smirk:

Not sure of your experience level… The learning curve for this platform is a little steep, unless you’re already a Java developer familiar with Git, Maven, Eclipse, etc.

The dev documentation is here. If it’s not something you want to tackle, it’s probably a pretty easy change for me to make.

1 Like

I only used a bunch of script languages, never had experiences with java…
If it’s ok for you please try to implement it, because I additionally have to get familar with the unknown syntax…
but I will have a look at the code because I’m interested in how things work.
I never had a look at any binding so far…

Sure. I’ll post something for you to try out in the next few days.

Are you on version 3.x, because that’s the code base that I’ll be changing?

1 Like

yep

thank you very much in advance for your effort :wink: this is very kind
and thanks for the links

BTW, should the sleep time units be minutes or seconds. Seems like it should be minutes.

I could live with seconds but If its easy to convert the values to minutes would be better to have minutes in my opinion.

It’s done (except for the documentation).

Seems to work on the SqueezePlay app on my MacBook. Haven’t tried it yet on a piCorePlayer.

What client (player) are you using?

2 Likes

Hmm. I think it’s pretty cool how it fades out the music for the last several seconds before it stops.

If I didn’t play white noise at night I’d be inclined to use this. :wink:

1 Like

Test version and installation instructions are here.

2 Likes

I use piCorePlayer and SB-Player for android devices…

I’m pretty amazed how fast you’ve made these modifications - a fadeout sounds very very nice!! :slightly_smiling_face:
thanks a lot

Don’t be. It was like 5 lines of code. LOL

1 Like

ok nice… 'cause I use configuration files could you please tell me the name of the new channel
I guess its Number: sleep??

Number Sb_Source1_Sleep "Sleep [%.0f]" { channel="squeezebox:squeezeboxplayer:server:source1:sleep" }
1 Like

thanks its installed I’ll test it now…

My Sitemap integration looks like this:

Selection item=SqueezeBedroomSleep mappings=[ 0='OFF',15='15',30='30',60='60',90='90']

tested it with 1 minute timer and works flawlessly :grinning:

So, does sending 0 cancel the sleep timer? If so, I’ll add that to the documentation.

Edit: On SqueezePlay on my Mac, it looks like it cancels the timer.

yes indeed :sweat_smile: tested it for android, will test it on pCP tonight…