Spotify Connect Binding

I am not shure if this is the latest version JAR file: https://github.com/Hilbrand/openhab2-addons/releases/download/spotify/org.openhab.binding.spotify-2.5.0-SNAPSHOT.jar
Can anybody tell me if this is right. I don’t want to use the marketplace binding and instead install it directly as jar.

The market place actual downloads from that location :smile: it’s the lastest version.

No specific idea related to paperui. I did some testing today, but haven’t been able to reproduce the problem. So I’m going to see if I can build in some extra checks to tackle this problem.

Thank you very much. Maybe should I enable TRACE logging and send these logs?
Also I’m on 2.4 stable, maybe this can be a problem also…

Yes trace logging could help. Log during restart of the bundle as the problem seems to start when the things are initialized. 2.4 should not be a problem, I’m also on 2.4

So here is what I got now:

2019-07-18 21:46:33.473 [DEBUG] [org.openhab.binding.spotify         ] - ServiceEvent UNREGISTERING - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=530, service.bundleid=302, service.scope=singleton} - org.openhab.binding.spotify
2019-07-18 21:46:33.536 [DEBUG] [org.openhab.binding.spotify         ] - ServiceEvent UNREGISTERING - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=529, service.bundleid=302, service.scope=bundle, component.name=org.openhab.binding.spotify.internal.SpotifyHandlerFactory, component.id=348} - org.openhab.binding.spotify
2019-07-18 21:46:33.569 [DEBUG] [org.openhab.binding.spotify         ] - ServiceEvent UNREGISTERING - {org.openhab.binding.spotify.internal.SpotifyAuthService}={service.id=526, service.bundleid=302, service.scope=bundle, component.name=org.openhab.binding.spotify.internal.SpotifyAuthService, component.id=347} - org.openhab.binding.spotify
2019-07-18 21:46:33.623 [DEBUG] [org.openhab.binding.spotify         ] - ServiceEvent UNREGISTERING - {javax.servlet.ServletContext}={osgi.web.version=2.5.0.201904302100, osgi.web.contextpath=/, service.id=527, osgi.web.symbolicname=org.openhab.binding.spotify, service.bundleid=302, service.scope=singleton, osgi.web.contextname=default} - org.openhab.binding.spotify
2019-07-18 21:46:33.670 [DEBUG] [org.openhab.binding.spotify         ] - ServiceEvent UNREGISTERING - {org.eclipse.smarthome.core.thing.type.DynamicStateDescriptionProvider, org.openhab.binding.spotify.internal.handler.SpotifyDynamicStateDescriptionProvider}={service.id=528, service.bundleid=302, service.scope=bundle, component.name=org.openhab.binding.spotify.internal.handler.SpotifyDynamicStateDescriptionProvider, component.id=349} - org.openhab.binding.spotify
2019-07-18 21:46:33.677 [DEBUG] [org.openhab.binding.spotify         ] - BundleEvent STOPPING - org.openhab.binding.spotify
2019-07-18 21:46:33.913 [DEBUG] [org.openhab.binding.spotify         ] - BundleEvent STOPPED - org.openhab.binding.spotify
2019-07-18 21:46:33.928 [DEBUG] [org.openhab.binding.spotify         ] - BundleEvent UNRESOLVED - org.openhab.binding.spotify
2019-07-18 21:46:34.154 [DEBUG] [org.openhab.binding.spotify         ] - BundleEvent RESOLVED - org.openhab.binding.spotify
2019-07-18 21:46:34.169 [DEBUG] [org.openhab.binding.spotify         ] - BundleEvent STARTING - org.openhab.binding.spotify
2019-07-18 21:46:34.360 [DEBUG] [org.openhab.binding.spotify         ] - ServiceEvent REGISTERED - {javax.servlet.ServletContext}={osgi.web.version=2.5.0.201904302100, osgi.web.contextpath=/, service.id=532, osgi.web.symbolicname=org.openhab.binding.spotify, service.bundleid=302, service.scope=singleton, osgi.web.contextname=default} - org.openhab.binding.spotify
2019-07-18 21:46:34.379 [DEBUG] [org.openhab.binding.spotify         ] - ServiceEvent REGISTERED - {org.openhab.binding.spotify.internal.SpotifyAuthService}={service.id=531, service.bundleid=302, service.scope=bundle, component.name=org.openhab.binding.spotify.internal.SpotifyAuthService, component.id=350} - org.openhab.binding.spotify
2019-07-18 21:46:34.442 [DEBUG] [org.openhab.binding.spotify         ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=534, service.bundleid=302, service.scope=bundle, component.name=org.openhab.binding.spotify.internal.SpotifyHandlerFactory, component.id=351} - org.openhab.binding.spotify
2019-07-18 21:46:34.450 [DEBUG] [org.openhab.binding.spotify         ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.type.DynamicStateDescriptionProvider, org.openhab.binding.spotify.internal.handler.SpotifyDynamicStateDescriptionProvider}={service.id=533, service.bundleid=302, service.scope=bundle, component.name=org.openhab.binding.spotify.internal.handler.SpotifyDynamicStateDescriptionProvider, component.id=352} - org.openhab.binding.spotify
2019-07-18 21:46:34.454 [DEBUG] [org.openhab.binding.spotify         ] - BundleEvent STARTED - org.openhab.binding.spotify
2019-07-18 21:46:34.748 [DEBUG] [org.openhab.binding.spotify         ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=535, service.bundleid=302, service.scope=singleton} - org.openhab.binding.spotify
2019-07-18 21:46:35.054 [DEBUG] [ding.spotify.internal.api.SpotifyApi] - Request: (GET) https://api.spotify.com/v1/me/player/devices - 
2019-07-18 21:46:35.519 [INFO ] [oauth2client.internal.OAuthConnector] - grant type refresh_token to URL https://accounts.spotify.com/api/token success
2019-07-18 21:46:35.770 [DEBUG] [potify.internal.api.SpotifyConnector] - Response Code: 200
2019-07-18 21:46:35.774 [TRACE] [potify.internal.api.SpotifyConnector] - Response Data: {
  "devices" : [ {
    "id" : "1a7f98132773a8cc7d532b6afb461959c71c7cfd",
    "is_active" : false,
    "is_private_session" : false,
    "is_restricted" : false,
    "name" : "Bathroom",
    "type" : "Unknown",
    "volume_percent" : 16
  } ]
}
2019-07-18 21:46:36.040 [DEBUG] [ding.spotify.internal.api.SpotifyApi] - Request: (GET) https://api.spotify.com/v1/me/player - 
2019-07-18 21:46:36.092 [DEBUG] [potify.internal.api.SpotifyConnector] - Response Code: 204
2019-07-18 21:46:36.094 [TRACE] [potify.internal.api.SpotifyConnector] - Response Data: 
2019-07-18 21:46:36.096 [DEBUG] [ding.spotify.internal.api.SpotifyApi] - Request: (GET) https://api.spotify.com/v1/me/playlists - 
2019-07-18 21:46:36.225 [DEBUG] [potify.internal.api.SpotifyConnector] - Response Code: 200
2019-07-18 21:46:36.229 [TRACE] [potify.internal.api.SpotifyConnector] - Response Data: {

However this seemed very normal to me…
Tried it, and now it works… Don’t know what changed. I have restarted my Raspberry today, maybe that helped…

Did you ever find a solution to this? I just set this up a few hours ago - latest binding, followed the instructions, experienced no errors. I can see in the debug log that the playlists are being logged. But, I get no list in my Active Devices or Playlists Selection boxes. Media control, track info and so on is all working without issue.

Edit: can confirm that via the REST API only one playlist is shown in the state field - just the currently playing playlist.

1 Like

No looked like a few people had a similar issue but no solution

I have also been able to find any resolution to this issue.

@hilbrand I also get almost every time OFFLINE - BRIDGE_OFFLINE status on the devices, however the bridge shows ONLINE (and it is really online). I think it should be OFFLINE - GONE at these times…

Hi!

I just checked this binding out and it’s working so far.
I ran into one issue and i don’t know how to solve it:
In Spotify i have named my Echo in the kitchen “Küche” and now OH complains about the special character in my items file. But even if i type “küche” in the channel config the thing shows as “online” but i am getting warnings in the log. Is there a way to avoid that or do i have to rename the device in the alexa app? I would rather not do that because it is the most natural way the way it is right now.

org.eclipse.smarthome.model.item.BindingConfigParseException: ID segment 'Küche' contains invalid characters. Each segment of the ID must match the pattern [A-Za-z0-9_-]*.

@Andrew_Pawelski, @nolan_garrett, @rkrisi I’ve been looking into the playlists problem. It seems other bindings can cause problems here. I’m looking into this issue. But it might explain problems you’re seeing.

@Jonas88 I’m not familiar with alexa. But does this refer to the item name? and does it need the item name or can it also refer to some other name. Otherwise post it as a new question so other people who are familiar with alexa might see this question and give better help.

1 Like

Hi!

i was too busy copy/pasting :slight_smile:
it refers to the item name and i copy/pasted the wrong thing.
It works now :slight_smile:

I also wanted to note to you, that I have updated to 2.5M2 and installed the included Spotify binding not the marketplace one, and the same problem happens. Rarely I can see OFFLINE-GONE state, mostly OFFLINE-BRIDGE_OFFLINE can be seen which is not true, because the Bridge (API) is always ONLINE. Anything besides that, seems good for me.

Looking at the code this seems to be possible if for some reason the bridge temporary goes offline, and then the device becomes ‘restricted’ (meaning someone else has access to the device). In such case the channel deviceRestricted on the device should be ‘on’. Does that make sense?

I will re-read the docs about this binding and it’s channels. Never watched that switch if it is on or off…

Hello there!

I had some time to check out the new spotify binding. (I did some tweaking with the python based spotify in the past).
One thing i recognized:
spotify:player:user:devices channel returns the device ID not the name. is this intentionally? i mapped it to show my name given in the app. Maybe you could change that.
I want to set up a Selection in habpanel or sitemap and the devices item is a string. is there another way than mapping? Maybe Spotify returns the devices.
Thank you!

@Jonas88 See my older post:

Hi and thanks for the fast reply!
That describes my problem pretty precisely.
What that says is that i have to use rules and mapping, right. I can read current device / playlist and need the other item to select devices / playlists, right?

thank you!

You should not have to use rules I would assume. The deviceName has the name and can also be used to set a device by passing the name of a device. The devices channel should be made a Selection in a sitemap. Than it will display as a listbox where the deviceId is the key and device name the value. This is why is use a string type it will only show the id.