Spotify Connect Binding

You don’t. So I’ve updated the binding and now it shows in the title when the binding was created. You should see in PaperUI if you update now: Spotify Binding (Beta 30/04/2019 18:00)

I uninstalled the binding, installed it again and rebooted the Raspberry.

It worked a few times but now it’s hanging again.
The picture is also not working (was already working the first version)

Ok… I thought I fixed it. But I can reproduce it when the progress channel is linked and I click like a madman on the next/previous button :crazy_face:
So I’ve created an update (timestamp 21:00) and I think I’ve finally addressed the issue…

1 Like

Seems to be fixed, perfect!

The problem with the missing picture is still there, it worked before you started to modify sth.

It does show now. Thanks.

  I have noticed in that last version that you have 2 channels

named “Active Device Name” which is somehow confusing. I believe
that one is the device name and the other one is the device ID.

  I am using the selection widget in HabPanel to select the active

spotify device using the “Spotify player Active Device Name”. The
widget gives the choice to choose the device through a list
automatically provided by the channel or defined by hand and I
have noticed that when using the first option the widget does not
provide a list of devices to choose from. The second option is
however working ok

Ah that is not correct. I’ve changed the selection channel to: Active Devices

Hi Hilbrand, congrats and thank you and everyone who has contributed to this great binding.

In PaperUI Control and BasicUI everything is working perfectly only in the IOS app I am having trouble with the Active Devices and Playlists selection field. If I push on e.g. Active Devices the selection window opens but there is nothing in it so I cannot select e.g. a different speaker. Also the current selected device and playlist is not shown. I assume that everything is correctly configured since it is working in the BasicUI but maybe I am missing something. Has someone experienced the same problem and has a “fast” fix for that problem?

I have this in BasicUi as well - at one point everything stopped updating and a binding remove was my only option

I must be completely missing something here as I can’t get anything to appear in either the Active device or Playlists selections…

Regardless of browser I use, chrome or safari, in Basic UI the screen just goes a kind of shadowy grey without a list appearing.

Any clues?

@lampml16 @Andrew_Pawelski @Mark_Webster Make sure you have the latest version of the binding installed. The latest version uses device name as identifier. If you had an earlier beta version that used id as identifier you need to remove and re-add the things. An older beta version of the binding had lockup problems causing it to not give updates. If you had such problems you need after you’ve updated the binding restart openHAB to clear any locked threads. The correct version can be seen in the title of the binding when installed. See the first post in this thread for up-to-date information on what version is the correct version.

I had the latest binding installed… But in order to test/confirm I have just done the following…

Removed all my items (by renaming the item file)
Removed the sitemap (by renaming the sitemap file)
Deleted the Bridge thing
Removed the binding

Then

Shutdown openhab
Cleared cache & tmp
Logged onto developer.spotify.com and created a new client Secret

After this

Started openhab
Re-installed the binding
Created the bridge (Interestingly, at this point I didn’t need to go to http://your.openHAB.address::8080/connectspotify and authorise, the bridge went straight to online)

Re-created the items (by naming the file correctly)
Re-created the sitemap (by naming the file correctly)

Tested the sitemap, still cannot see a list of devices or playlists (Screen still just goes a kind of grey in both Chrome and Safari)

I would guess it’s either the configuration or the lists are not populated. The configuration in the sitemap should be something like:
Selection item=spotifyDevices label="Active device [%s]"

To see if the lists are populated at all you could set the log level to trace in the karaf console ( log:set TRACE org.openhab.binding.spotify , and back when done: log:set DEFAULT org.openhab.binding.spotify ). Maybe it gives more information.

–Edit: the example configuration contained a typo.

I was not usning the beta binding, so have done the same as @Mark_Webster and get the same results - all works but the Selection items which gives me a full screen “greyed out” overlay with nothing in it for playlists and devices - the single versions of these work great - I will up the logging and see if I get anything

OK man it logs a lot!
so here are my items:

String spotifyPlaylists     "Playlists: [%s]"   (gSpot)    {channel="spotify:player:spotifybridge:playlists"}

and sitemap

Selection item=spotifyPlaylists

log shows this:

2019-05-07 22:29:30.173 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value 'spotify:playlist:abc123xxxxxxx' of item spotifyPlaylists with format '%': Conversion = '%'

I can see the data is coming through for the device list and the playlists so it must be a (simple?) formatting issue of the item or sitemap

And there seems to be values in each item

I can only reproduce it by in the label using [%]. That is incorrect it should be [%s]. I had this actually incorrect in my given example, which I took from the readme, that contained the same typo. I’ve created a fix for the documentation. But you might check if you have the same typo somewhere.

think ive tried every combination with the same results each time currently I have:

Selection item=spotifyPlaylists label="aa [%s]"

String spotifyPlaylists     "Playlists: [%s]"   (gSpot)    {channel="spotify:player:spotifybridge:playlists"}

I tried to reproduce this. But I can’t get it to not work. However I did realize the playlists list is not related to the item configuration. So the item configuration has no impact on if the list if populated or not. Also it seems the playlists item doesn’t need the [%s]. So i’m not sure what is causing this. It might be some caching problem, and than cleaning tmp/cache might help. But i’m not sure if that fixes it. What version of openHAB are you running?

running on nightlies

How can this string get converted to the playlists?

Hi All,
I am having troubles setting a remote device to cast to (Google minis). I have tried setting both the deviceId and the deviceName with no success:

sendCommand(spotify_player_Paul_deviceId, “92a19431959273XXXXXXXXXX912f3bbd”)
sendCommand(spotify_player_Paul_deviceName, “Family speaker”)

In addition, if I try to start Spotify via Openhab (send PLAY to trackPlayer), i get this error:

2019-05-14 23:44:10.498 [vent.ItemStateChangedEvent] - spotify_player_Paul_trackPlayer changed from PAUSE to PLAY
2019-05-14 23:44:10.552 [hingStatusInfoChangedEvent] - ‘spotify:player:Paul’ changed from ONLINE to OFFLINE: Device not found
2019-05-14 23:44:11.236 [hingStatusInfoChangedEvent] - ‘spotify:player:Paul’ changed from OFFLINE: Device not found to ONLINE
2019-05-14 23:44:11.243 [vent.ItemStateChangedEvent] - spotify_player_Paul_trackPlayer changed from PLAY to PAUSE

However, If i start Spotify on my phone, Openhab has no troubles playing or pausing the track.

On a side note (possibly related), I get this error every few seconds in the logs:
(ps. occurring has two "c"s :wink: )

==> /var/log/openhab/openhab.log <==
2019-05-14 23:37:31.051 [INFO ] [nternal.handler.SpotifyBridgeHandler] - Unexpected error during polling status, please report if this keeps ocurring:
java.lang.NullPointerException: null
at org.openhab.binding.spotify.internal.handler.SpotifyDeviceHandler.updateDeviceStatus(SpotifyDeviceHandler.java:107) ~[?:?]
at org.openhab.binding.spotify.internal.handler.SpotifyBridgeHandler.lambda$7(SpotifyBridgeHandler.java:389) ~[?:?]
at java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90) ~[?:?]
at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1469) ~[?:?]
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127) ~[?:?]
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230) ~[?:?]
at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:528) ~[?:?]
at org.openhab.binding.spotify.internal.handler.SpotifyBridgeHandler.lambda$6(SpotifyBridgeHandler.java:389) ~[?:?]
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176) ~[?:?]
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1492) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
at org.openhab.binding.spotify.internal.handler.SpotifyBridgeHandler.updateDevicesStatus(SpotifyBridgeHandler.java:390) ~[?:?]
at org.openhab.binding.spotify.internal.handler.SpotifyBridgeHandler.pollStatus(SpotifyBridgeHandler.java:342) ~[?:?]
at org.openhab.binding.spotify.internal.handler.SpotifyBridgeHandler.scheduledPollingRestart(SpotifyBridgeHandler.java:288) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.lang.Thread.run(Thread.java:844) [?:?]

Many thanks

This error can occurs when a spotify device thing isn’t correctly initialized. This can also be due to changes that have been made in the binding. It can be to recreate the spotify device thing, and possible clean the cache. Also make sure you have the latest version of the binding available. See the first post in this thread for what version that would be.