If the first rule works I would have expected the second to work as well. There are a few posts on this board somewhere about issues around executing commands on windows, there were issues with spaces, etc. they might shed some light.
I use receivedCommand rather than the item stat since sometimes the item take some time to update, but that doesn’t sound like the issue here.
val resp = executeCommandLine("/usr/bin/python /etc/openhab2/scripts/spotify.py " + receivedCommand.toString, 200000)
Try setting the rule manually to play. And try running the command in the quotes on cmd to see if it works there.
val resp = executeCommandLine("C:/Python27/python.exe C:/openhab2/conf/scripts/spotify.py play", 5000)
Otherwise buy a raspberry pi, they are dead cheap and probably a much better setup than running it on a windows box. If it’s too much then pm me your address and I’ll buy you one.
@Dominic_Bonneau
Try openhabianpi.local:7070/static/spotify-auth.html or whatever you computer is called on your network. I don’t think using your public ip would work here, maybe your local ip would but I’m not sure.
Edit: @Dominic_Bonneau I managed to get the same error as you. In myopenhab.py the port is defined in init, change that to 127.0.0.1:7070 then it should work,
i do have a couple of RPI here, but decided to use the windows server for the extra power and the fact it’s already on. But it has been a bit of headache.
C:\Users\Administrator>"C:/Python27/python.exe C:/openhab2/conf/scripts/spotify.
py"
The filename, directory name, or volume label syntax is incorrect.
and without quotes
C:\Users\Administrator>C:/Python27/python.exe C:/openhab2/conf/scripts/spotify.p
y
Successfully got state from OpenHab: ←[0;37mspotify_client_id←[0m
Successfully got state from OpenHab: ←[0;37mspotify_client_secret←[0m
Successfully got state from OpenHab: ←[0;37mspotify_access_token←[0m
Successfully got state from OpenHab: ←[0;37mspotify_refresh_token←[0m
Successfully got state from OpenHab: ←[0;37mspotify_token_issued←[0m
Successfully got state from OpenHab: ←[0;37mspotify_token_expiry←[0m
-- Calling Service: Update
Successfully posted state to OpenHab: ←[0;37mspotify_current_track ←[0m= ←[0;36m
Keep That Ligh - 7 "←[0m
Successfully posted state to OpenHab: ←[0;37mspotify_current_artist ←[0m= ←[0;36
mThe Tamlins←[0m
Successfully posted state to OpenHab: ←[0;37mspotify_current_cover ←[0m= ←[0;36m
https://i.scdn.co/image/80be2195a004f1bc742dd02a680a5354e9b9d650←[0m
Successfully posted state to OpenHab: ←[0;37mspotify_current_duration ←[0m= ←[0;
36m226346←[0m
Successfully posted state to OpenHab: ←[0;37mspotify_current_progress ←[0m= ←[0;
36m218472←[0m
Successfully posted state to OpenHab: ←[0;37mspotify_current_playing ←[0m= ←[0;3
6mON←[0m
Successfully posted state to OpenHab: ←[0;37mspotify_current_device ←[0m= ←[0;36
mG-PC←[0m
Successfully posted state to OpenHab: ←[0;37mspotify_current_volume ←[0m= ←[0;36
m100←[0m
Successfully posted state to OpenHab: ←[0;37mspotify_current_context_uri ←[0m= ←
[0;36mspotify:album:36q2E7Z20V7mI07ZD9zPdg←[0m
Successfully posted state to OpenHab: ←[0;37mspotify_current_device_id ←[0m= ←[0
;36m5e2540bc0eb417d3a5a650b9fe8a3afec6bbe404←[0m
Successfully posted state to OpenHab: ←[0;37mspotify_current_progress_percent ←[
0m= ←[0;36m96.52←[0m
-> Success
Successfully posted state to OpenHab: ←[0;37mspotify_lastConnectionDateTime ←[0m
= ←[0;36m2018-03-05T21:46:37←[0m
Done in 2.10400009155 seconds
I just get the same results, it just updates and that’s what I see. I need to do some reading on running python on windows as whatever I add after the .py will give [Errno 2] No such file or directory.
So I don’t know if its spacing, or quotes, or what, it must be different to running it on linux.
I tried using the script from windows and I got it working fine. I just mounted the linux folder to Y and ran the windows version of python over the script. Note the slashes are the other way.
I had to make one change to myopenhab.py because I was running script on a different computer than openhab, but other than that I didn’t have any issues. I changed the ip in myopenhab from 127.0.0.1 to openhabianpi or whatever your computer is called.
I finally got this thing working, though couple of issues still to work out. One, I don’t see any of the svg icons and don’t know how to set that up. I downloaded the cheaper version of the squidink icons (1,000 vs 2,000). There is no big one large svg file in that download pack so I’m trying to understand how svg works and I can get these icons in here. Any ideas of where I can look to learn that? All my svg icons are saved as separate files.
One other question hoping someone can help with. My playlists are empty when I click on them, and when I click on the devices drop-down I get my devices yet when I click on them the device it’s playing on doesn’t change.
if I do sudo apt-get install python-requests then I get this error
Successfully got state from OpenHab: spotify_client_id
Successfully got state from OpenHab: spotify_client_secret
Successfully got state from OpenHab: spotify_access_token
Successfully got state from OpenHab: spotify_refresh_token
Successfully got state from OpenHab: spotify_token_issued
Successfully got state from OpenHab: spotify_token_expiry
– Calling Service: Update
-> Failure: <type ‘exceptions.ValueError’>
Successfully posted state to OpenHab: spotify_lastConnectionDateTime = 2018-03-07T08:37:24.000+0000
Done in 0.539511919022 seconds
Hi all, trying to set this up - new to rest and curl…
Trying to set the client ID and secret via curl and get this error:
curl: (6) Could not resolve host: text
curl: (6) Could not resolve host: application
curl: (1) Protocol ““http” not supported or disabled in libcurl
very strange my -> Failure: <type ‘exceptions.ValueError’> just dissapeared. I did not change any thing. The only differance was that I was now playing music on Spotify when I run the script
I
I used the code below, usually it works great but some times not - I do not understand why. I do not know if the sleeps are required
rule "Spotify Test"
when
Item SpotifyTest received command OFF
then
{
spotify_current_device_id.sendCommand("2546d8ce80580c473293d30e2c3477afaf985613") //Shield
Thread::sleep(50)
spotify_action.sendCommand("transfer_playback")
Thread::sleep(50)
spotify_action.sendCommand("play spotify:user:spotify:playlist:37i9dQZF1DWTMYgB8TqtmR") //Hits Idag
Thread::sleep(50)
spotify_action.sendCommand("play")
}
end
I just started using this integration yesterday and it was really easy to set up and works great so thanks to everyone who’s put work into it!
Does anybody else have issues with certain chromecast devices not ‘showing’ themselves to Spotify?
I have a Google Home as well as a standard Chromecast, plugged into my TV. When I use ‘transfer_playback’, it only works if I used Spotify on that chromecast device recently. I checked the spotify_device_list and the chromecasts disappear from the list after a while (when I use ‘get_devices’ to update)
I guess the problem is on Spotify’s end rather than anything to do with the openhab integration as a lot of the time I can’t see my chromcast devices in the Spotify app either.