Wanted to have some minimal control via Openhab without reverting to Spotify client, so created a custom Spotify Widget from which you can play your playlists on selected player (also supports simple spotify search).
The Spotify binding is available in the Eclipse Market Place and can be installed directly from PaperUI if you have enabled eclipse market place. The binding is not yet part of the standard openHAB installation.
Do not install any other jar youāll find anywhere on this forum.These are all outdated and very likely have bugs
have you configured the spotify bindings? āSet access tokenā means that you either did not configure the binding or when you added the widget, you did not specify which items contains that access token
I configured my spotify binding but unclear about instructions about what item I add to the spotify binding track play:ā¦ field. Does that make sense? I added the widget but nothing shows up when I did even after selecting the access token to the widget.
I believe I have everything linked. I can play through the paper ui control. I also used a different widget someone else created for spotify and that works. Not sure why this wonāt.
Iām not sure why it doesnāt work. The widget requires the binding channels accessToken and trackPlay to be linked to an item. The other binding doesnāt require the accessToken. One thing I saw was the accesstoken was not set in my thing. I reinstalled the binding and then it was back. Iām not sure if this is a bug or if it was related to the fact I have been reinstalling different development versions in the past. But itās something Iāll be looked at and see it that does reappear or if it was unrelated.
Okay I removed the old binding and used your 2.4 binding jar file. I have the access token in there and itās pulling up my playlist. I canāt figure out how I setup the trackPlay to the songs. If I go into the paperUI control it wonāt play the songs either. I assume itās because I need to setup some type of player to play the files? Any suggestions on where to look to set this part of it up?
Can you provide a link ? This plugin needs just two OpenHAB items - one String item which would have spotify access token and another - to which you could send spotify url to play. So as long as you can get that from api script it should be good
Yes, you need a player set up. E.g. I have a Squeezebox player which is configured as Spotify Connect Device thing which has a channel āTrack To Playā (note that you have to click āshow moreā because it is hidden initiallyā:
This is great thank you for the guidance Iāve got it working now on my Mac. When I bring it up on my iPad only the search bar shows up and I donāt get any of my playlists. Iām sure Iām missing something here just dont know what?
AFAIK you need spotify_access_token - this should render the playlist and allow you to search.
Now playing wonāt work out of the box afaik. The item we are interested in is spotify_action BUT with spotify binding you just send the spotify playlist url while with this spotify_action you must also add play keyword. So I see two options:
Create some sort of intermediate item which you can use in the widget and then a simple rule which would transform the command by adding play to the received command and forwarding it to spotify_action
I would have to tune my widget to add a flag that the item is actually not a binding but this api wrapper so it would send full command instantly
Option 1 would look something like this (untested)
/* .item file*/
String spotify_action_for_widget (gSpotify)
/* .rule file */
rule "Spotify Wiget Play Action"
when
Item spotify_action_for_widget received update
then
val playlist = spotify_action_for_widget.state.toString
spotify_action.sendCommand("play " + playlist)
end
That is probably a bug on my side, used some unsupported js function on Safari. What IOS version is that iPad running?
I have the latest which I believe is 12.2. I also tried it on an Android device I have (not sure what version itās running) and same thing happened, Iām just not able to get the playlist items to show up and nothing shows up after searching too. Iām planning to build this into a wall mounted iPad mini likely so would be awesome to get this working.
Well I have tested it on iOS 11 and 12 Simulators, all work fine. On ipad mini also - no problems. And I have this on Amazon Fire tablet on my wallā¦ so no problems there. Is this the same habpanel that you tested on mac? Do the settings look ok on the ipad ? Do you see the loading bar bellow the search bar when you open the habpanel?
I donāt see the loading bar when opening it either. All setting when accessing from other devices are the same I have persistence setup and the config changes are saved and loaded on each device. I must be doing something wrong however this works perfect on the computer in chrome and safari.
I would love to learn more about the code behind widgets like these so I can learn how to add additional functionality. Iām a good front end developer and understand html and css but I definitely need to learn the js code and how the widget was created with json. Any suggestions for where I might get started down this path? I hope to be able to contribute much more in the future to the openHAB community.