There is nothing wrong with the widget, as mentioned this was working fine before.
I use the widget to enter the client id and secret, it authenticates correctly. But when I go back into the Open Auth link, it seems its not authenticated.
I also cannot see the token and so on being stored in Influx DB
The static/spotify-auth.html page will not be clear that it has been authorised. But once you done it once you should never need to do it again. Here mine is fully authorised and work and this is what the auth link looks like.
I fixed the issue, found an article on Stackoverflow.
Your URI must match in the spotify script and the Web Dev console. I had my private, internal IP address in the script but my external dns name in the Web dev.
Are the large logs an issue?
Why not comment out the log info statements like you suggested?
You don’t need any of the logs unless something is wrong. So you could define DEBUG at the top of the rules and put IF statements around the logInfo statements. So if you have a problem you can then enable later on.
If you want more control you can edit spotify,py and myopenhab.py and comment out print statements to achieve what you want.
i followed this tutorial step by step but i do not know where i can do in point 5:
" Give the client id and secret to OpenHab
Save the Client ID to spotify_client_id in OpenHab (e.g. through openhab CLI smarthome:update spotify_client_id {your_id})
Copy the Client Secret to spotify_client_secret in OpenHab (e.g. through the rest API)"
When I send a command it takes a good 5 seconds for anything to happen. Is this normal or is there an issue with my setup? If so any ideas what could be making it slow?
I have a problem with the “spotify action rule”. For some reason it doesn’t send the python command to the spotify-script. The spotify_action-string is updating with every press on my touchscreen, but nothing happens. Here is my .rules file:
rule "Spotify run script"
when
Time cron "0/30 * * * * ? *" or
Item spotify_forceupadte received update
then
val resp = executeCommandLine("/usr/bin/python /volume1/@appstore/openHAB/conf/scripts/spotify.py", 5000)
logInfo("Spotify", resp)
end
rule "Spotify Action"
when
Item spotify_action received update
then
val resp = executeCommandLine("/usr/bin/python /volume1/@appstore/openHAB/conf/scripts/spotify.py" + spotify_action.state.toString, 5000)
logInfo("Spotify", resp)
end
The “Spotify run script rule” is working fine! Does anybody know the solution?
That looks fine but I often have issue when using an items state, I always try and use receivedCommand if possible. You can throw a loginfo in to see what command it’s trying to perform
rule "Spotify Action"
when
Item spotify_action received command
then
logInfor("Spotify", "command {}", receivedCommand.toString)
val resp = executeCommandLine("/usr/bin/python /etc/openhab2/scripts/spotify.py " + receivedCommand.toString, 500)
end
@thejayo It should be pretty much straight away. Play/Pause shouldn’t take much more than a second. Try running the script directly to see where the delay is.
[12:12:54] openhabian@openHABianPi:~$ /usr/bin/python /etc/openhab2/scripts/spotify.py
Traceback (most recent call last):
File “/etc/openhab2/scripts/spotify.py”, line 10, in
from myopenhab import openhab
ImportError: No module named myopenhab
pip install myopenhab doesn’t find any package named that
Any ideas?
Edit:
Nevermind, got it sorted by putting myopen.hab from matrix-theme github in the /etc/openhab2/scripts folder as well
I am able to execute with full success the script (/usr/bin/python /etc/openhab2/scripts/spotify.py) and it updates everything in HabPanel however it doesnt keep all the playlists and devices there, they seem to disappear after a while.
This was working quite well before but seems to have broken when I reinstalled OH2.3.
My persistance is fine, as the file is the same as what I was using before also.
@unparagoned you’re quite experienced on this
Any thoughts
Script appears to work all fine from the console but HabPanel wont hold the display of the devices, playlists etc.
No sound comes out either . I used to see logs in the console constantly of things being refreshed and updated but now only when I execute the script manually do i see that " /usr/bin/python /etc/openhab2/scripts/spotify.py"
The sound comes out of the Spotify program, so that needs to be running. Start playing music with Spotify and then start controlling it with openhab.
I added refresh buttons for Spotify, playlists and devices. So when you press the refresh button it assigns the item to the display item again. There should be code in my previous posts