Page 5 of 5

Re: Python Plugin: Spotify

Posted: Sunday 31 May 2020 13:15
by renerene
update: it works! found out that
1) not use the complete URL return as code, but only the code part (my stupidity)
2) do NOT replace localhost with 192.168.1.xxx

3) change saveuservariable into adduservariable
4) make sure 'new device are allowed for 5 minutes' after activating hardware
5) not the modification of the user variable activates spotify but selecting the output speaker in devices

status june 2020: useless / does not work. Not supported anymore on GitHub, as illustrated by post september 2019 So change saveuservariable into adduservariable
Would be great to have domoticz start my playlist on Echo

Error occured in request for getting acces_tokens from Spotify, error code: 400, reason: Bad Request. Seems either client_id, client_secret or code is incorrect. Please note that the code received from Spotify could only be used once. Please get a new one from spotify.

Code: Select all

 2020-05-31 13:50:41.865 (Zwave.me USB) Temp (tempZolder)
2020-05-31 13:50:43.275 (spotify) Pushing 'onStopCallback' on to queue
2020-05-31 13:50:43.318 (spotify) Processing 'onStopCallback' message
2020-05-31 13:50:43.318 (spotify) Message handler 'onStop' not callable, ignored.
2020-05-31 13:50:43.883 (spotify) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2020-05-31 13:50:43.883 (spotify) Calling domoticz API: http://192.168.0.107:8080/json.htm?type=command&param=getuservariables
2020-05-31 13:50:43.902 (spotify) {'LastUpdate': '2020-05-31 12:56:00', 'Name': 'spotify-access_token', 'Type': '2', 'Value': '', 'idx': '70'}
2020-05-31 13:50:43.902 (spotify) {'LastUpdate': '2020-05-31 12:56:00', 'Name': 'spotify-refresh_token', 'Type': '2', 'Value': '', 'idx': '71'}
2020-05-31 13:50:43.902 (spotify) {'LastUpdate': '2020-05-31 12:56:00', 'Name': 'spotify-retrievaldate', 'Type': '2', 'Value': '', 'idx': '72'}
2020-05-31 13:50:43.902 (spotify) {'LastUpdate': '2020-05-31 13:41:05', 'Name': 'spotify-searchTxt', 'Type': '2', 'Value': 'jan smit', 'idx': '73'}
2020-05-31 13:50:43.902 (spotify) Not all spotify token variables are available, let's get it
2020-05-31 13:50:43.902 (spotify) Getting tokens using data: {'grant_type': 'authorization_code', 'code': 'AQCvlHzprbKAdmFoIzIKv4kAXVMFwT1TgOC5qrXPVDBcC0W0zB6DE5M7v322dmjNm8flHTnLMEOIJ7Je2_X52TXqcwZ7U1vPaT7ZyJx6gnSACMCJlBLBzpoHtxdI4J1Gm_mf_m2aMvI8efsKtiWjyZN5l3my-EmPt4nD3pNa8VmAYCj7UF_194Rl1mgFL9PuVYscOgtMdVy5uuHzjRIOk8jAapZYT7QXYV4bX7TB_2GIg3U#', 'redirect_uri': 'http://localhost'}
2020-05-31 13:50:43.903 (spotify) For basic headers using client_id: 43d3f37d8143461198c8c3cd864a3169, client_secret: 0a7edc072b524835b972c06a6c14276b
2020-05-31 13:50:43.903 (spotify) Getting tokens using header: {'Authorization': 'Basic NDNkM2YzN2Q4MTQzNDYxMTk4YzhjM2NkODY0YTMxNjk6MGE3ZWRjMDcyYjUyNDgzNWI5NzJjMDZhNmMxNDI3NmI='}
2020-05-31 13:50:43.275 Status: (spotify) Stop directive received.
2020-05-31 13:50:43.275 Status: (spotify) Exiting work loop.
2020-05-31 13:50:43.576 Status: (spotify) Stopping threads.
2020-05-31 13:50:43.576 Status: (spotify) Stopped.
2020-05-31 13:50:43.576 Status: (spotify) Started.
2020-05-31 13:50:43.881 Status: (spotify) Initialized version 0.2, author 'djj'
2020-05-31 13:50:43.880 Status: (spotify) Entering work loop.
2020-05-31 13:50:43.960 Error: (spotify)Error occured in request for getting acces_tokens from Spotify, error code: 400, reason: Bad Request. Seems either client_id, client_secret or code is incorrect. Please note that the code received from Spotify could only be used once. Please get a new one from spotify.
2020-05-31 13:50:45.552 (stroommeter-USB1) P1 Smart Meter (Stroom)

Re: Python Plugin: Spotify

Posted: Thursday 26 November 2020 22:50
by zabinskiwojciech
hello, did you manage to run spotify on domoticz again because i'm struggling and failing

Re: Python Plugin: Spotify

Posted: Tuesday 06 April 2021 19:56
by TJgettingSmart
I'm trying to add Spotify to Domoticz by using this plugin, but I'm struggling. I've installed the plugin on my raspberry and I've giving all files in de Spotify folder the execute permissions. However: I can't find the Spotify plugin on the hardware page (drop down menu) from Domoticz. What am I doing wrong?

Re: Python Plugin: Spotify

Posted: Tuesday 06 April 2021 20:09
by zabinskiwojciech
this plugin is not supported anymore, you can forget about it.

Re: Python Plugin: Spotify

Posted: Tuesday 06 April 2021 20:14
by TJgettingSmart
To bad. Do you know of any other options to control Spotify by Domoticz?

Re: Python Plugin: Spotify

Posted: Tuesday 06 April 2021 20:54
by zabinskiwojciech
I think it would be better to switch to Home Assistant, I am testing for now and I am positively surprised by the quantity and quality of plugins. So far, I am only testing plugins for sensors, I have not started yet.

Re: Python Plugin: Spotify

Posted: Tuesday 06 April 2021 21:47
by waltervl
To switch over to another home automating system is a little bit too drastic in my opinion.
You could use the Dashticz dasbiard addon that can add a spotify block.
You can use a Python library like https://github.com/plamere/spotipy and program your own interface with dummy devices and a Python script.
Or someone decides to make a new plugin that works. Someone is also free to fork the current plugin, make enhancements and publish this updated plugin here.

Re: Python Plugin: Spotify

Posted: Tuesday 06 April 2021 23:29
by zabinskiwojciech
It would be very nice if people who know how to write plugins for Domoticz correct this plug.

Re: Python Plugin: Spotify

Posted: Wednesday 07 April 2021 19:43
by TJgettingSmart
I've got the Dashticz plugin, that works fine. But what I want to do is use Spotify in an automation: when the TV is switched on, the music has to stop. Can't do that in Dashticz nor in Home Assistant (I guess).