Spotify Connect Binding

It should print in the log what scope, or else when enable debug log. scope can also be a problem on Spotify side. Google turns up several suggestions, but depends on the error. I don’t know if you get this message with a free account.

HI @hilbrand,

I did integrating the binding today. So far all works but I get the same issues @Andrew_Pawelski and @nolan_garrett had regarding playlists and active devices. For both I can see and select values in paper UI under “Control” but I can’t select and see sth. in Basic UI. There those lists are blank.

I don’t have the alexa binding running. I assume it is the same problem they had. Do you have any idea what could face the issue?

Furthermore I did not reach to incorporate the Sonos speaker into the binding. Hope this will be possible in the future by softwareupdate from sonos or spotify…

kindly,
woogi

Did you configure the items as Selection on the sitemap?

I think the free account may be the case.

@hilbrand
After upgrading to M3 I just realized that the Spotify binding stopped working. Spotify devices says:

Missing configuration from the Spotify Bridge (UID:null). Fix configuration or report if this problem remains.

Looking at /connectspotify it says that my account is authorized, however clicking on Authorize Player gives me ‘Invalid redirect URI’. What should I do?

It could be the bridge needs to be recreated, due to changes in the configuration. There were some changes. Can you removing the bridge and readd it.

Yes I will try, thanks!

It worked, but the redirect URIs in the App settings (on the Spotify Developer Console) need to be updated, because only the http://openhabianpi:8080/connectspotify was added, but now it wanted to authenticate with the IP address. After adding http://:8080/connectspotify it worked as it should!

yes I did.

.items
String spotifyPlaylists     "Playlists [%s]"       {channel="spotify:player:OpenHab:playlists"}

.sitemap
Selection item=spotifyPlaylists 

So it should work, but nothing is shown.

If it does work in PaperUI than it’s not the same problem as reported earlier. As that would result in not showing playlists or devices anywhere. So I don’t know what the problem might be. Try editing the sitemap file and see it it gives any errors in the log when you save the file.

I’m a bit lost with all those bridges and devices. How can I switch playing to a certain device via a rule? Which channel should I use ? From the readme it seems that i need devices channel, but what is the full path ? e.g. spotify:device:spotify:ddf0:devices ? Should I then configure a string item and sendCommand to that item?

Thanks for your reply, but this didn’t change anything, obviously. As you can see, playlists are shown, in Basic UI not:

08

I checked the sitemap, it is the same as shown in the binding examples - so it should work. No error messages after saving etc.

When removing the “s” in the item file I get

Exception while formatting value 'spotify:playlist:0fa5pNuP68eDpD9aajqaYz' of item spotifyPlaylists with format '%': Conversion = '%'

After entering the “s” into [%s] the message is not shown any longer, but still not list for devices nor playlist. How is your configuration for that?

You always need an item linked to a channel, and send a command to the rule. You have several options:

  • when you have configured a thing device you can send a play command to a item linked to the channel devicePlayer
  • when you send the name of the device to the bridge channel deviceName it will start playing on that device. (If the device is connected with Spotify)
  • when you send the Spotify device id to the bridge channel devices it will start playing on that device. (If the device is connected with Spotify).
    Then there are options on what to play. The mentioned command will just start playing was is selected or transfer play to the device.

I don’t know why it doesn’t work. Do you have the latest version of the binding? That the only thing I can think of or a typo in the sitemap causing it not to load (correctly)

I have Version 2.5.0.201909061126.

Gerade mal einen Test im HabPanel gemacht, hier geht es auch. Bekomme 9 Playlists angezeigt. Devices ebenfalls.

Here is the hole config:


// Spotify

Player spotifyTrackPlayer   "Player"               {channel="spotify:player:ABC:trackPlayer"}
String spotifyDevices       "Active device [%s]"   {channel="spotify:player:ABC:devices"}
Switch spotifyDeviceShuffle "Shuffle mode"         {channel="spotify:player:ABC:deviceShuffle"}
String spotifyTrackRepeat   "Repeat mode: [%s]"    {channel="spotify:player:ABC:trackRepeat"}
String spotifyTrackProgress "Track progress: [%s]" {channel="spotify:player:ABC:trackProgress"}
String spotifyTrackDuration "Track duration: [%s]" {channel="spotify:player:ABC:trackDuration"}
String spotifyTrackName     "Track Name: [%s]"     {channel="spotify:player:ABC:trackName"}
String spotifyAlbumName     "Album Name: [%s]"     {channel="spotify:player:ABC:albumName"}
String spotifyArtistName    "Artist Name: [%s]"    {channel="spotify:player:ABC:artistName"}
Image  spotifyAlbumImage    "Album Art"            {channel="spotify:player:ABC:albumImage"}
String spotifyPlaylists     "Playlists [%s]"       {channel="spotify:player:ABC:playlists"}
String spotifyPlayName      "Playlist [%s]"        {channel="spotify:player:ABC:playlistName"}

String device1DeviceName    {channel="spotify:device:ABC:device1:deviceName"}
Player device1Player        {channel="spotify:device:ABC:device1:devicePlayer"}
Dimmer device1DeviceVolume  {channel="spotify:device:ABC:device1:deviceVolume"}
Switch device1DeviceShuffle {channel="spotify:device:ABC:device1:deviceShuffle"}
String device1DeviceID      {channel="spotify:device:ABC:device1:deviceId"}

The ABC is only for demonstration

sitemap:

	Text label="Spotify"{
		Frame label="Spotify Player Info" {
			Selection item=spotifyDevices       label="Active device [%s]"
			Default   item=spotifyTrackPlayer   label="Player"
			Switch    item=spotifyDeviceShuffle label="Shuffle mode:"
			Text      item=spotifyTrackRepeat   label="Repeat mode: [%s]"
			Text      item=spotifyTrackProgress label="Track progress: [%s]"
			Text      item=spotifyTrackDuration label="Track duration: [%s]"
			Text      item=spotifyTrackName     label="Track Name: [%s]"
			//Image     item=spotifyAlbumImage    label="Album Art" 
			Text      item=spotifyAlbumName     label="Currently Played Album Name: [%s]"
			Text      item=spotifyArtistName    label="Currently Played Artist Name: [%s]"
			Selection item=spotifyPlaylists     label="Playlists"
			Text	  item=spotifyPlayName
		}

		Frame label="My Spotify Device 1" {
			Text    item=device1DeviceName label="Device Name [%s]"
			Default item=device1Player
			Slider  item=device1DeviceVolume
			Switch  item=device1DeviceShuffle
			Text	item=device1DeviceID label="device ID"
		}

Hope you have an idea :slight_smile:

1 Like

Thanks, works flawlessly :slight_smile:

Another issue, how to set volume to 0 (or mute it?) ? I’ve created
Dimmer Spotify_Squeezebox_Volume "Squeezebox" ["Volume"] { channel="spotify:device:spotify:ddf0:deviceVolume" } and values from 1 to 100 work ok, but it does not react to 0 ?

The binding doesn’t do anything special for the value 0. Either sqeezebox doesn’t handle it or the Spotify Api doesn’t handle it correctly. You could enable log level trace to see what command is send to Spotify and what Spotify returns when sending 0. The Spotify api hasn’t an option for mute.

No one a hint? I am running out of knowledge and ideas :wink:

Does anyone know why my inbox in the PaperUI keeps filling up, it is driving me a little crazy :crazy_face:

Any help would be much appreciated, thanks.

2019-09-28%2016_49_27-Paper%20UI

Which version of openHAB or which version of the binding? An earlier version of the binding used the Spotify Id as identification. Some services give a new Id each time you restart the device. The latest version of the binding uses the name so it should not rediscover the same device multiple times.