Spotify Connect Binding

Hello, in the last weks i have start woth openhab. So i’m really a beginner :wink:
Today i want to implement the spotify bridge. I found the binding and install it. I also crate a Client and secret ID and i enter the Redirect URIs.
Currently i have the problem taht i dont find the binding on the paperui.
I have try to create the binding manuelle in visualcode because im not sure i have configre the connecten correctly. Because i didn’t know where to put a user name and password.

@hilbrand did you find anything related to the ‘Weak chiper suite’ warning?

1 Like

I had to cleanup the openhab cache. After that spotify binding seemed to be uninstalled. Installed it via paper ui (Spotify Binding Beta (market:binding-4326451 - 1.0)) . First it complained that gson is not found Unresolved requirement: Import-Package: com.google.gson; installed it with bundle:install. Not it fails with other class not found errors:

Caused by: java.lang.ClassNotFoundException: org.eclipse.smarthome.core.thing.binding.BaseDynamicStateDescriptionProvider cannot be found by org.openhab.binding.spotify_2.5.0.201911072000

Perhaps this version 2.5.0.201911072000 is meant for openhab 2.5 ?

EDIT: ok, for now compiled from source from https://github.com/Hilbrand/openhab2-addons.git and spotify_2.4.0 branch

@Jonas88 I’ve updated the binding in the Marketplace it now handles devices status better.

If you have the official installation it’s openHAB version 2.4. The binding is not yet available in that version. But you can install it via the MarketPlace. In PaperUI go to Configuration -> System -> and Enable MarketPlace Select Maturity Level Beta. Then you should be able to install Spotify in Add-ons.

@rkrisi I did look into it. The binding uses a common client initialized by openHAB core. A client can be initialized to just accept any ssl connection, but the default, used, is more strict. I don’t know why it now gives this error or if it is related to the more strict handling. In that case I would expect to see it more often. So I’m not sure how to research this better for now.

I had uploaded a 2.5.0 only version. I’ve fixed that and uploaded a new version. It’s made me realize this can be a real problem for installations. The marketplace has no version history. So when a new version in the marketplace is published it just replaces the existing version and if that is not compatible with the previous version it can break users installations.

Maybe this can help?

and my issue:

Hi, first of all: Nice work!

Im running the binding on 2.5M4 and if i try to use any item linked to a devicechannel i get this error:

2019-11-13 19:07:13.421 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.spotify.internal.handler.SpotifyDeviceHandler@1f33d6a': Client service is closed

org.openhab.binding.spotify.internal.api.exception.SpotifyAuthorizationException: Client service is closed

	at org.openhab.binding.spotify.internal.api.SpotifyApi.request(SpotifyApi.java:289) ~[?:?]

	at org.openhab.binding.spotify.internal.api.SpotifyApi.requestPlayer(SpotifyApi.java:261) ~[?:?]

	at org.openhab.binding.spotify.internal.api.SpotifyApi.requestPlayer(SpotifyApi.java:248) ~[?:?]

	at org.openhab.binding.spotify.internal.api.SpotifyApi.setVolume(SpotifyApi.java:168) ~[?:?]

	at org.openhab.binding.spotify.internal.handler.SpotifyHandleCommands.handleCommand(SpotifyHandleCommands.java:116) ~[?:?]

	at org.openhab.binding.spotify.internal.handler.SpotifyDeviceHandler.handleCommand(SpotifyDeviceHandler.java:68) ~[?:?]

	at sun.reflect.GeneratedMethodAccessor94.invoke(Unknown Source) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [133:org.openhab.core:2.5.0.M4]

	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [133:org.openhab.core:2.5.0.M4]

	at com.sun.proxy.$Proxy446.handleCommand(Unknown Source) [?:?]

	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:74) [185:org.openhab.core.thing:2.5.0.M4]

	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:48) [185:org.openhab.core.thing:2.5.0.M4]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [133:org.openhab.core:2.5.0.M4]

	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [133:org.openhab.core:2.5.0.M4]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

	at java.lang.Thread.run(Thread.java:748) [?:?]

Caused by: org.eclipse.smarthome.core.auth.client.oauth2.OAuthException: Client service is closed

	at org.eclipse.smarthome.auth.oauth2client.internal.OAuthClientServiceImpl.getAccessTokenResponse(OAuthClientServiceImpl.java:318) ~[?:?]

	at org.openhab.binding.spotify.internal.api.SpotifyApi.request(SpotifyApi.java:277) ~[?:?]

	... 23 more

If Spotify eg is running on my iPhone i can controll it with the player items. Device items perform the Error.
I noticed that all Device in PaperUI got the Error-Bridge_Offline tag until i for example open the Spotify app on my phone, then theyll show as online.

Thank you for your effort! I’ll check it out soon and report back!

Stupid question maybe… but would it be possible to fake a multiroom setup by sending the same stream to multiple Spotify Connect devices at the same time?

hi, why my chromecast device not show in device list? when i connect spotify to it by smartphone, i see the device, but after changed it, i don’t see the deive in device list. Why?

Only if you connect each device to a different Spotify account and configure a bridge for each account. Otherwise it will just switch from device to device when you would start on all devices at the same time.

A chromecast is in sleep mode when not active. Once it’s not active it drops connection to Spotify and then Spotify won’t report it on the api and it will not show up in openHAB. To work around this people use other means to keep the chromecast in an awake state. But I don’t know how well that works.

I will check it out.
I just updated to 2.5 M5. is it merged there or do i need to use the beta from the marketplace to verify if the processor load bug is gone?

thank you!

The market place binding is the same as the 2.5M5 version.

ok great.
I’ll install and report back.

Afternoon - I am running 2.5M1 with the latest update of the Spotify binding from the marketplace.
I have read somewhere that there may be a conflict with the amazon Echo binding, that prevents Playlists being updated (and therefore means that the only way to change playlist is to specify the playlist ID, rather than name?)

I can issue the playlist id direct against the item: SpotifyPlayerBridge_Playlists - but not the name of the playlist.
also, if I push the name (or even the id) of playlist at item SpotifyPlayerBridge_PlaylistName it has no effect.

Does the patch for this issue live in the Spotify binding, or was this supposed to be fixed by the Echo binding code? What os the path of least resistance to resolve this?

Thanks

Actually, looking at my config, it seems that since I removed my bridge, upgraded the binding and re-added my bridge and some devices, that the array SpotifyPlayerBridge_ActiveDevices is also not getting populated, so I can no lomnger change device either?

Any advice?

Still got the issue.
I don’t know where to look at to help debugging this.
Setting the log to debug for this did not show anything unusual last time.

Hmm… so then I’d set up a rule that would send the same stream to both devices in different bridges/accounts, right?
Can you think of a way that we could make a random Spotify Connect device available as a Multiroom speaker for Alexa?

I too am getting this - is there a fix?

Yes I also still has this warning, even on M5

@hilbrand

Now I had an internet outage for a longer time. When the internet was down, I was getting the weak chiper suite error every second, so it seems like it is happening when it tries to connect to Spotify API. Maybe this can help you debug this. Basically if you disable the internet for some minutes it will flood your log completely.