Python Plugin: Spotify

Python and python framework

Moderator: leecollings

Lanr
Posts: 2
Joined: Sunday 17 May 2015 12:43
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: The Neterlands
Contact:

Re: Python Plugin: Spotify

Post by Lanr »

PeterFleur wrote: Friday 25 January 2019 18:04
assenzuid wrote: Sunday 30 December 2018 0:02 Get this errpr

Code: Select all

Error calling 'http://localhost:8081/json.htm?vvalue=&vname=Spotify-refresh_token&vtype=2&param=saveuservariable&type=command'
I have exactly the same error.
It looks like the string of the Code part is too long for the user variables. So it cannot be stored there

Anybody resolved this?

Peter
I have exactly the same error. What is the solution for this. Please help. Have tried everything but found no solution! Thanx

René
PeterFleur
Posts: 32
Joined: Sunday 08 March 2015 13:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.4739
Contact:

Re: Python Plugin: Spotify

Post by PeterFleur »

Lanr wrote:
PeterFleur wrote: Friday 25 January 2019 18:04
assenzuid wrote: Sunday 30 December 2018 0:02 Get this errpr

Code: Select all

Error calling 'http://localhost:8081/json.htm?vvalue=&vname=Spotify-refresh_token&vtype=2&param=saveuservariable&type=command'
I have exactly the same error.
It looks like the string of the Code part is too long for the user variables. So it cannot be stored there

Anybody resolved this?

Peter
I have exactly the same error. What is the solution for this. Please help. Have tried everything but found no solution! Thanx

René
I've deleted all user variables and reinstalled the plugin. Now it all seems to work.

Peter

Sent from my SM-G930F using Tapatalk

RaspberryPI
ZWave
RFXtrx433E
Lanr
Posts: 2
Joined: Sunday 17 May 2015 12:43
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: The Neterlands
Contact:

Re: Python Plugin: Spotify

Post by Lanr »

Thank you for the quick response Peter.

Have, as you say, discarded all user variables in the Domoticz Spotify plug-in. I also thrown away the installation of the plug-in in the folder "/volume1/@appstore/domoticz/var /plugins/domoticz-spotify-master".
I have placed a downloaded (clean) version afterwards.
User variables are re-entered and the plugin is started, but now (still) the log file is displaying: "Error: (Spotify) Error calling" http: // localhost: 8084 / json.htm? Vvalue = & param = saveuservariable & type = command & vtype = 2 & vname = Spotify-refresh_token ".

Log:

Code: Select all

2019-03-03 19:30:15.687 (Spotify) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2019-03-03 19:30:15.687 (Spotify) Calling domoticz API: http://localhost:8084/json.htm?param=getuservariables&type=command
2019-03-03 19:30:15.688 (Spotify) Add authentification for user: XXXXXXX
2019-03-03 19:30:15.697 (Spotify) User Variable retrievaldate,refresh_token,access_token,searchTxt does not exist. Creation requested
2019-03-03 19:30:15.697 (Spotify) Calling domoticz API: http://localhost:8084/json.htm?vvalue=&param=saveuservariable&type=command&vtype=2&vname=Spotify-retrievaldate
2019-03-03 19:30:15.697 (Spotify) Add authentification for user: XXXXXXX
2019-03-03 19:30:15.434 Status: (Spotify) Started.
2019-03-03 19:30:15.644 Status: (Spotify) Entering work loop.
2019-03-03 19:30:15.645 Status: (Spotify) Initialized version 0.2, author 'djj'
2019-03-03 19:30:15.699 Error: (Spotify) Error calling 'http://localhost:8084/json.htm?vvalue=&param=saveuservariable&type=command&vtype=2&vname=Spotify-retrievaldate' 
Are there any other tips on how I can solve this?

Please HELP, René
PeterFleur
Posts: 32
Joined: Sunday 08 March 2015 13:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.4739
Contact:

Re: Python Plugin: Spotify

Post by PeterFleur »

Hmm it looks like i answered in the wrong plugin. My chromecast started working after deleting the user variables. Spotify is not working for me. I think the cause is the length of the API key Spotify generates. The key is too long to store in the user variables.

Peter
RaspberryPI
ZWave
RFXtrx433E
Tobbo
Posts: 13
Joined: Monday 08 October 2018 13:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Tobbo »

Can't seem to get this plugin to work anymore. It worked fine a few months ago but now I'm getting this error message.

Code: Select all

(SpotifyPlugin) Error calling 'http://localhost:8080/json.htm?vtype=2&vvalue=&param=saveuservariable&type=command&vname=SpotifyPlugin-retrievaldate'
I'm not sure if the problem is related to me updating Domoticz to beta version. Any ideas?
cdv4
Posts: 1
Joined: Thursday 09 May 2019 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by cdv4 »

Egregius wrote: Wednesday 04 July 2018 7:44 Hi, I'm having troubles retrieving the code. After entering the code I get this in the logfile:

Code: Select all

Error: (Spotify) Bad request to spotify, code entered in hardware parameters could one be used once. Please get a new one
Any ideas?
make sure the redirect URI you're using is exactly http://localhost , not http://localhost/ or anything else.. I was having the same problem because I kept putting the wrong redirect.
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Python Plugin: Spotify

Post by Egregius »

Thanks for the reply, I'm not using this anymore.
Since I have several Bose Soundtouch speakers I can control everything thru them.
vodor
Posts: 39
Joined: Friday 19 February 2016 14:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by vodor »

Giving your plugin a try. I was looking for something like this.
Unfortunately I am stuck with the following errors in my log.
It's also worth noting that the variables did not create themselves. So I manually created them all (as strings). This got past the error for not finding spotify-refresh_token

I am sure the error below might be related to manually creating these variables. Any ideas?

2019-07-10 10:17:45.861 Error: (spotify) Seems something with wrong with token response from spotify
2019-07-10 10:17:46.162 (spotify) JSON Returned from spotify listed available devices: None
2019-07-10 10:17:46.160 Error: (spotify) Unkown error: code: 401, msg: ()
2019-07-10 10:17:46.162 Error: (spotify) 'onStart' failed 'TypeError':''NoneType' object is not subscriptable'.
2019-07-10 10:17:46.162 Error: (spotify) ----> Line 491 in '/home/pi/domoticz/plugins/spotify/plugin.py', function onStart
2019-07-10 10:17:46.162 Error: (spotify) ----> Line 99 in '/home/pi/domoticz/plugins/spotify/plugin.py', function onStart
2019-07-10 10:17:46.162 Error: (spotify) ----> Line 110 in '/home/pi/domoticz/plugins/spotify/plugin.py', function checkDevices
2019-07-10 10:17:46.162 Error: (spotify) ----> Line 141 in '/home/pi/domoticz/plugins/spotify/plugin.py', function buildDeviceSelector
2019-07-10 10:17:55.665 (spotify) Pushing 'onHeartbeatCallback' on to queue
2019-07-10 10:17:55.687 (spotify) Processing 'onHeartbeatCallback' message
2019-07-10 10:17:55.687 (spotify) Calling message handler 'onHeartbeat'.
Eraser78
Posts: 3
Joined: Thursday 02 August 2018 14:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Eraser78 »

Same here, plugin worked fine for months
Since 11/07 I get errors.
I reinstalled the plugin but no solution
Errors:
2019-07-19 09:26:44.423 (Spotify) Pushing 'onHeartbeatCallback' on to queue
2019-07-19 09:26:44.443 (Spotify) Processing 'onHeartbeatCallback' message
2019-07-19 09:26:44.443 (Spotify) Calling message handler 'onHeartbeat'.
2019-07-19 09:26:44.444 (Spotify) Polling
2019-07-19 09:26:44.444 Error: (Spotify) 'onHeartbeat' failed 'ValueError'.
2019-07-19 09:26:44.444 Error: (Spotify) ----> Line 495 in '/home/pi/domoticz/plugins/spotify/plugin.py', function onHeartbeat
2019-07-19 09:26:44.444 Error: (Spotify) ----> Line 404 in '/home/pi/domoticz/plugins/spotify/plugin.py', function onHeartbeat
2019-07-19 09:26:44.444 Error: (Spotify) ----> Line 369 in '/home/pi/domoticz/plugins/spotify/plugin.py', function spotCurrent
2019-07-19 09:26:44.444 Error: (Spotify) ----> Line 160 in '/home/pi/domoticz/plugins/spotify/plugin.py', function spotGetBearerHeader

It seems like the user variables are not filled correctly anymore
Eraser78
Posts: 3
Joined: Thursday 02 August 2018 14:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Eraser78 »

Works again after update to Domoticz V4.11022
vodor
Posts: 39
Joined: Friday 19 February 2016 14:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by vodor »

Also tried an upgrade to latest 4.11 beta like Eraser78 but the problem still persists for me :-(
I will maybe try uninstall and retry the install process now that I am on 4.11 and see how that goes.

2019-07-22 08:47:56.371 Status: (spotify) Started.
2019-07-22 08:47:57.128 (spotify) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2019-07-22 08:47:57.128 (spotify) Calling domoticz API: http://localhost:8080/json.htm?param=ge ... pe=command
2019-07-22 08:47:57.132 (spotify) Add authentification for user: admin
2019-07-22 08:47:57.169 (spotify) {'Name': 'spotify-retrievaldate', 'Type': '2', 'idx': '40', 'LastUpdate': '2019-07-10 09:56:41', 'Value': '1'}
2019-07-22 08:47:57.169 (spotify) {'Name': 'spotify-access_token', 'Type': '2', 'idx': '39', 'LastUpdate': '2019-07-10 10:15:58', 'Value': '1'}
2019-07-22 08:47:57.169 (spotify) {'Name': 'spotify-refresh_token', 'Type': '2', 'idx': '38', 'LastUpdate': '2019-07-10 10:17:21', 'Value': '2'}
2019-07-22 08:47:57.170 (spotify) {'Name': 'spotify-searchTxt', 'Type': '2', 'idx': '41', 'LastUpdate': '2019-07-10 09:56:57', 'Value': 'Lindsey'}
2019-07-22 08:47:57.170 (spotify) Checking if devices exist
2019-07-22 08:47:57.170 (spotify) Spotify devices selector does not exist, creating device
2019-07-22 08:47:57.170 (spotify) Token expired, getting new one using refresh_token
2019-07-22 08:47:57.170 (spotify) For basic headers using client_id: xxxxxxxxxxxxxxxxxxxxxxx, client_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2019-07-22 08:47:57.122 Status: (spotify) Entering work loop.
2019-07-22 08:47:57.123 Status: (spotify) Initialized version 0.2, author 'djj'
2019-07-22 08:47:57.881 Error: (spotify) Seems something with wrong with token response from spotify
2019-07-22 08:47:57.973 Error: (spotify) 'onStart' failed 'AttributeError'.
2019-07-22 08:47:57.973 Error: (spotify) ----> Line 491 in '/home/pi/domoticz/plugins/spotify/plugin.py', function onStart
2019-07-22 08:47:57.974 Error: (spotify) ----> Line 99 in '/home/pi/domoticz/plugins/spotify/plugin.py', function onStart
2019-07-22 08:47:57.974 Error: (spotify) ----> Line 110 in '/home/pi/domoticz/plugins/spotify/plugin.py', function checkDevices
2019-07-22 08:47:57.974 Error: (spotify) ----> Line 127 in '/home/pi/domoticz/plugins/spotify/plugin.py', function buildDeviceSelector
2019-07-22 08:47:57.974 Error: (spotify) ----> Line 181 in '/home/pi/domoticz/plugins/spotify/plugin.py', function spotDevices
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: Python Plugin: Spotify

Post by pvklink »

it is def. a problem with the domoticz uservariables!
i created a user variable and tried to cut and paste my spotify code in it, and i get an error...
thats why the plugin cant create the uservars...
my code =
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx is this big !!!
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
wiho
Posts: 2
Joined: Saturday 14 September 2019 17:18
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by wiho »

On the problem of the user variables not being created.
saveuservariable doesn't exit anymore, see the Domoticz API.
Change in plugin.py the following in the method getUserVar(self) on line 209 :

Code: Select all

  DomoticzAPI({"type": "command", "param": "adduservariable",
                                     "vname": Parameters["Name"] + '-' + variable, "vtype": "2", "vvalue": ""})
So change saveuservariable into adduservariable
Maybe the developer can update this in his code on git to.
jaaap
Posts: 59
Joined: Sunday 28 July 2019 22:59
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by jaaap »

wiho wrote: Tuesday 17 September 2019 15:40 On the problem of the user variables not being created.
saveuservariable doesn't exit anymore, see the Domoticz API.
Change in plugin.py the following in the method getUserVar(self) on line 209 :

Code: Select all

  DomoticzAPI({"type": "command", "param": "adduservariable",
                                     "vname": Parameters["Name"] + '-' + variable, "vtype": "2", "vvalue": ""})
So change saveuservariable into adduservariable
Maybe the developer can update this in his code on git to.
Thank you so much for this! I overlooked your comment the first time and spent all night trying to get it to work. But thanks to your comment I got it working. Thanks!
jaaap
Posts: 59
Joined: Sunday 28 July 2019 22:59
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by jaaap »

So I've played around with this plugin, and it is very nice!

However, I'm still looking for some extra functionality. I would like to be able to select pauze, play, next song in domoticz. This way, I can connect it to my Xiaomi Magic Cube. I know it is working in Dashticz, but I was wondering if someone knows a way to make it work in Domoticz as well? (or in any other way it can connect to the magic cube).
renerene
Posts: 316
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by renerene »

Just found this thread.
Question: can this script be used to start playlist A in random order on device B by just turning on some dummy switch?
zabinskiwojciech
Posts: 79
Joined: Thursday 16 May 2019 16:23
Target OS: Linux
Domoticz version: 4.10776
Location: Warszawa
Contact:

Re: Python Plugin: Spotify

Post by zabinskiwojciech »

Hello
I have a problem with this plugin.
Spotify account I have Premium.
How do I paste a link with my ID, of course:
https://accounts.spotify.com/authorize? ... back-state
I get a refund on the browser: INVALID_CLIENT: Invalid redirect URI
My Domoticz server is installed on Ubuntu Server so I have no way to issue commands from the browser on the server because I only have CLI
Please help
zabinskiwojciech
Posts: 79
Joined: Thursday 16 May 2019 16:23
Target OS: Linux
Domoticz version: 4.10776
Location: Warszawa
Contact:

Re: Python Plugin: Spotify

Post by zabinskiwojciech »

I have already tried all options, I gave the IP address from the LAN of my server I gave the external IP address: Port from WAN and nothing is wrong with this link or I do not know that I need to install some desktop on Linux and from the browser on the server ??
zabinskiwojciech
Posts: 79
Joined: Thursday 16 May 2019 16:23
Target OS: Linux
Domoticz version: 4.10776
Location: Warszawa
Contact:

Re: Python Plugin: Spotify

Post by zabinskiwojciech »

I installed a graphical overlay on ubuntu but it also did not help, all the time I got a wrong URI
zabinskiwojciech
Posts: 79
Joined: Thursday 16 May 2019 16:23
Target OS: Linux
Domoticz version: 4.10776
Location: Warszawa
Contact:

Re: Python Plugin: Spotify

Post by zabinskiwojciech »

On the Spotify page in Dashboard, I did not add this footnote http: // localhost, I changed my IP address to my server where Domoticz is installed. After this task, a page appeared for approval, I approved and I did not receive the code number with the code. my server page has opened. What am I doing wrong that I don't want to work?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest