Idea for Binding: Spotify Connect binding

Anybody got any updates on this?

I am also looking at this and planning to see if it would be possible to use spotcontrol together with the exec binding. This would in theory at least enable me to launch a playlist on a Spotify Connect enabled device (my receiver). But it remains to be tested.

@bulletprooffool
My setup is echo connected to my amplifier, spotify linked up in the alexa app. Then you can tell her to play your playlist.

So I do not really see the point of making buttons in OH for spotify, however it would be nice to be able to play youtube videos with alexa on my tv. I read that pushbullet and tasker could be used for this, so I assume you can do the same approach for your spotify:)

I have several AV receivers plugged into and an Android TV box that us new repurposed as single Spotify server.
Plugging Alexa in directly is no good as I need the voice to work on the little speaker all the time and would not that voice going out over all 14 speakers!

I have tasker invoking Spotify on the android but now using the http binding as a trigger with auto remote.

I see IFTTT now can trigger events when a new Spotify track plays on the echo. So my idea is to control Alexa as usual, but whenever something plays via Spotify on Alexa, trigger an event that tells the android box to take over the Spotify stream.

In addition, I’ll use the hue binding to trigger the next button on the Spotify server every time I say something like “Alexa, turn track up” - with a simple rule on OH that then fire an ever to Automremote to tell tasker to invoke the ‘NEXT’ button on Spotify.

Slightly clunky - will let you know how I get on.

Wow, thats a big setup…
I have 5 echos, one in each room, where I only have speakers in living room and bathroom, but you have a point it would be nice to have her not stop music if you want to switch lights on for instance. So keep me posted on your progress.

I created a python-based integration to Spotify:

1 Like

There is also a binding:

https://github.com/astenlund74/openhab2-addons/tree/master/addons/binding/org.openhab.binding.spotify

Hey @ChrisA,

I tried the binding you suggested.
The data is comming in correctly and i can see which song is played.

But i cannot control the device (play/pause and volume)
Do you have an idea why this is not posible?

  • Jordo

@Jordo Where did you download the binding? I cannot find it. Can you provide a link?

@loovanloon

I downloaded it from gitHub (user: astenlund74)
The binding is called Spotify player bridge
It was hard to find the download.

https://raw.githubusercontent.com/astenlund74/org.openhab.binding.spotify-binary/master/org.openhab.binding.spotify-2.2.0-SNAPSHOT_20171005.jar

There is an “readme” om the binding page.

  • Jordi

EDIT:
You have to be spotify premium user to use the binding.

Is someone still using this binding?
It works great now at my openhab, but after an hour i still can control the playback only things like song title and artist will stop updating.

Someone with the same problem?

Jordo

Have the same problem with spotify connect binding. After an hour i still can control everything but the song, artist, album and duration will stop updating.
The binding is really great - can anybody fix this bugs?

Hey guys, I’ve taken over development of the spotify binding from @astenlund74

I’m just starting to dig into the code but I’ll see if I can fix this “after an hour” issue first :wink:

@Jordo @fuslwusl I’ve been testing the binding for a few hours now and I can’t reproduce what you two are describing.

I’ve added the binding into my Jenkins build server: org.openhab.binding.spotify-2.3.0-SNAPSHOT.jar

Can you guys update to the latest version and see if you still have the same issue?

Thanks!

Hi Matthew,

I’ve been in contact with Andreas @astenlund74 several times, regarding the spotify binding. I struggle with the same timeout problems. We were thinking that the problem occurred when starting playback from a mobile device, with screenlock function activated. But I got the same issues when starting playback from my htpc which is on 24/7. I have not spent too much time on this since then. I can provide some logs if you are interested?

Best regards
Christian

So now I’ve been able to reproduce this. I’ve setup a separate TRACE level log file on my OH2 instance to try and capture what’s going on here. We will get to the bottom of this :wink:

Sounds great you have reproduced the bug. If i can do something to test, let me know!

Note:
The song title and stuff will continue update (for another hour) after restart the binding. Looks like some sort of time out. The commands are event based. So they cannot time out i think.

Question:
How do i update the binding? I have added it manually.

The way I’ve always done it via the SSH console.

openhab> bundle:list | grep -i spotify
233 | Active   |  80 | 2.3.0.201804131657     | Spotify Binding

openhab> bundle:stop 233

openhab> bundle:update 233 https://jenkins.otr.mx/job/openhab2-spotify-binding/lastStableBuild/artifact/addons/binding/org.openhab.binding.spotify/target/org.openhab.binding.spotify-2.3.0-SNAPSHOT.jar

openhab> bundle:start 233

I’m not sure if this is the best way, but it has worked for me while developing the UniFi binding.

Thanks!
I’ll try it as soon as possible.

Another little question.
For the url of the song image i made a rule myself with xml transformation. After i made a custom request to the Spotify api.
Is it possible to do this inside the binding?

  • Jordo

Are you referring to the album artwork? I want to add support for this.

I’m still getting my feet wet with the Spotify API so I need to see what’s all exposed, but I know 100% the album artwork can be retrieved.