openHAB integration to Spotify Web Connect API (player)

I copied org.openhab.binding.spotify-2.2.0-SNAPSHOT_20170910.jar to \OPENHABIANPI\openHAB-share\openhab2-addons…That was all I did

On http://openhabianpi:8080/connectspotify I get no error but just a blank site

I’ve just seen, I must install from market place…now it works!

1 Like

Hi there,

I recently installed the spotify binding and i really do like it! I just have one thing i’ve been trying to figure out: is it possible for me to create an item called remaining and see the time remaining on the song there like M:ss? If yes, how do i do that?

Thanks in advance,


Hi i am new as well… and still at your point 5…

how you get it managed to write in the spotify_client_id and secret?

Thanks for help…


hey there=)

U can do it with the console however since I didn’t get that to work yet I recommend to just use spotify_client_id.sendCommand(“XXX”) and so on for the secret and then trigger this rule with a Switch Item


thanks for that integration.

Where can I find the custom Widget shown on the screenshots?
I somehow did not manage to find it on github.

The op isn’t that long has has like two links… Everything you want is clearly explained and has links.

Edit: I’m a dick the second link is dead. I thought it went here Matrix Theme for HABPanel

saidly the link is dead and the other Widget i found in the comments doesn’t show anything it all. What am i missing here?

Sorry my bad I just assumed it went here

@bulletprooffool saw your comments on shuffle.

I thought we could just send ‘shuffle’ or ‘shuffleoff’ to spotify_action but no?

Be keen to know how you do it. I’d like to create a button for shuffle. I copied your modified script but it broke things entirely! Couldnt even play, reverted back and its OK again.

Which sections are required to be added for shuffle support?


@bulletprooffool still alive :smiley:

@bulletprooffool can you tell us more about how you got shuffle to work? Ive tried for days LOL please!

Hi and sorry for not replying.

Did you replace the code in your python script? (see post 166 above) You need to make sure that the script remains executable etc.

You’ll need the exec binding (which I assume is already going for you to be able to run the python script)
Also, if you edit the script, make sure to verify the executable state and ownership of the file.

Once you have done that, create some items in your items file:

String spotify_shuffle_state

Switch spotify_shuffle

Shuffle on is:
/usr/bin/python /etc/openhab2/scripts/ shuffle

Shuffle off is:
/usr/bin/python /etc/openhab2/scripts/ shuffleoff

you could create simple rule like:

rule "Map and update spotify shuffle status"


Item spotify_shuffle_state changed


logInfo("INFO","spotify_shuffle_state : "+ spotify_shuffle_state.state);

if(spotify_shuffle_state.state == "True"){



if(spotify_shuffle_state.state == "False"){





rule "Map switch change to post spotify update"


Item spotify_shuffle changed


if(spotify_shuffle.state == ON){

    executeCommandLine("/usr/bin/python /etc/openhab2/scripts/ shuffle")


if(spotify_shuffle.state == OFF){

    executeCommandLine("/usr/bin/python /etc/openhab2/scripts/ shuffleoff")



If you really wanted you could reduce that to a single rule, or even just bind the actions to the items.

I now use the newer Spotify binding from Spotify Connect Binding available which works trial well, but if you are happy with what you are using, there is no real need to change it.

Good luck :slight_smile:

Fantastic! thank you :slight_smile:
Ill give this a go! Appreicate the informative reply Alan

Hi @bulletprooffool

Got it working! by sending True or False to the string item :slight_smile:


I cant seem to get this to function. Clearly I dont understand how to send this.

Ive managed to find the URI figures for each playlist, but the update or send command doesnt trigger the playlist.

smarthome:update spotify_action play “spotify:user:spotify:playlist:37i9dQZF1DX8jkCXwOBEz9”


smarthome:send spotify_action play “spotify:user:spotify:playlist:37i9dQZF1DX8jkCXwOBEz9”

Any guidance please :slight_smile:

Thanks @pmpkk ,
great work for this tutorial. I could keep it running :heart_eyes::heart_eyes:

OpenHab enthusiasts, has anybody solved the keep alive issue of Spotify devices? I tried to implement a rule that sends a volume command to the device every hour but still the device goes offline over night (my intention is to develop an alarm clock that plays music over a spotify connect device).

Hi Alan i assumed you used rules to do this, do you have examples of sending commands in rules to spotify_action, such as play with a URI because its not documented anywhere. Ive tried about 10 different ways, all fail.