Python Plugin: Spotify

Python and python framework
Sjaakios
Posts: 24
Joined: Saturday 04 June 2016 23:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Sjaakios » Tuesday 30 October 2018 12:21

bartbosch wrote:
Monday 29 October 2018 0:49
Hi,

I have been able to find everything, but not my code

Code: copy the code received from the spotify redirect in the query parameters
Image

is there anyone who can help me with this problem?


My error in the log:
Spoiler: show
2018-10-28 23:13:09.674 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.
So you went to this url? https://accounts.spotify.com/authorize? ... back-state

After succesful login to your spotify account it it will redirect to page http://localhost.... and you get a white page.
In the url http://localhost/?code=[USE_THIS_CODE], there should be a code parameter, use that one to enter in your domoticz parameters.

Tobbo
Posts: 6
Joined: Monday 08 October 2018 13:11
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Tobbo » Tuesday 04 December 2018 17:22

I managed to get it to work, but I was wondering if anyone has managed to send a spotify playlist to a chromecast device using this plugin? If so, how did you get it to work?

What I would like to do is to set up a timed event that sends and starts the selected spotify playlist on my chromecast device.

Thanks

snellejellep
Posts: 132
Joined: Tuesday 16 May 2017 13:05
Target OS: Raspberry Pi
Domoticz version: 4.1xxxx
Location: The Neterlands
Contact:

Re: Python Plugin: Spotify

Post by snellejellep » Tuesday 04 December 2018 20:00

i am getting this and no devices are created, am i doing something wrong?

Code: Select all

2018-12-04 18:58:11.337 Status: (Spotify) Entering work loop.
2018-12-04 18:58:11.338 Status: (Spotify) Initialized version 0.2, author 'djj'
2018-12-04 18:58:12.013 Error: (Spotify) 'onStart' failed 'AttributeError'.
2018-12-04 18:58:12.013 Error: (Spotify) ----> Line 491 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function onStart
2018-12-04 18:58:12.013 Error: (Spotify) ----> Line 99 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function onStart
2018-12-04 18:58:12.013 Error: (Spotify) ----> Line 110 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function checkDevices
2018-12-04 18:58:12.013 Error: (Spotify) ----> Line 127 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function buildDeviceSelector
2018-12-04 18:58:12.013 Error: (Spotify) ----> Line 181 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function spotDevices
and this

Code: Select all

2018-12-04 19:03:23.933 Error: (Spotify) 'onHeartbeat' failed 'URLError'.
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 495 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function onHeartbeat
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 404 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function onHeartbeat
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 369 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function spotCurrent
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 163 in '/usr/lib/python3.5/urllib/request.py', function urlopen
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 466 in '/usr/lib/python3.5/urllib/request.py', function open
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 484 in '/usr/lib/python3.5/urllib/request.py', function _open
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 444 in '/usr/lib/python3.5/urllib/request.py', function _call_chain
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 1297 in '/usr/lib/python3.5/urllib/request.py', function https_open
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 1260 in '/usr/lib/python3.5/urllib/request.py', function do_open
raspberry pi | xiaomi gateway/vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ

Tobbo
Posts: 6
Joined: Monday 08 October 2018 13:11
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Tobbo » Tuesday 04 December 2018 22:33

snellejellep wrote:
Tuesday 04 December 2018 20:00
i am getting this and no devices are created, am i doing something wrong?

Code: Select all

2018-12-04 18:58:11.337 Status: (Spotify) Entering work loop.
2018-12-04 18:58:11.338 Status: (Spotify) Initialized version 0.2, author 'djj'
2018-12-04 18:58:12.013 Error: (Spotify) 'onStart' failed 'AttributeError'.
2018-12-04 18:58:12.013 Error: (Spotify) ----> Line 491 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function onStart
2018-12-04 18:58:12.013 Error: (Spotify) ----> Line 99 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function onStart
2018-12-04 18:58:12.013 Error: (Spotify) ----> Line 110 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function checkDevices
2018-12-04 18:58:12.013 Error: (Spotify) ----> Line 127 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function buildDeviceSelector
2018-12-04 18:58:12.013 Error: (Spotify) ----> Line 181 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function spotDevices
and this

Code: Select all

2018-12-04 19:03:23.933 Error: (Spotify) 'onHeartbeat' failed 'URLError'.
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 495 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function onHeartbeat
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 404 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function onHeartbeat
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 369 in '/home/pi/domoticz/plugins/domoticz-spotify/plugin.py', function spotCurrent
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 163 in '/usr/lib/python3.5/urllib/request.py', function urlopen
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 466 in '/usr/lib/python3.5/urllib/request.py', function open
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 484 in '/usr/lib/python3.5/urllib/request.py', function _open
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 444 in '/usr/lib/python3.5/urllib/request.py', function _call_chain
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 1297 in '/usr/lib/python3.5/urllib/request.py', function https_open
2018-12-04 19:03:23.933 Error: (Spotify) ----> Line 1260 in '/usr/lib/python3.5/urllib/request.py', function do_open
For me I had to reset my spotify client secret, re-enter domoticz ip (localhost in my case), port (8080 in my case), username and password (I have a username and password), entered the new client id, client secret and the new code from the url (https://accounts.spotify.com/authorize? ... back-state) Don't forget to put your client ID where it says "Your client id".
I assume you already did follow the steps on https://github.com/DaanJJansen/domoticz-spotify.

Sjaakios
Posts: 24
Joined: Saturday 04 June 2016 23:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Sjaakios » Thursday 06 December 2018 10:29

Tobbo wrote:
Tuesday 04 December 2018 17:22
I managed to get it to work, but I was wondering if anyone has managed to send a spotify playlist to a chromecast device using this plugin? If so, how did you get it to work?

What I would like to do is to set up a timed event that sends and starts the selected spotify playlist on my chromecast device.

Thanks
Do you see your chromecast as option in the newly created device selector/e.g. does it support spotify connect? If so, update your user variable with the the search string you would like to play. And create a new timer event which selects the chromecast as option on the device selector

Tobbo
Posts: 6
Joined: Monday 08 October 2018 13:11
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Tobbo » Thursday 06 December 2018 15:03

Sjaakios wrote:
Thursday 06 December 2018 10:29
Tobbo wrote:
Tuesday 04 December 2018 17:22
I managed to get it to work, but I was wondering if anyone has managed to send a spotify playlist to a chromecast device using this plugin? If so, how did you get it to work?

What I would like to do is to set up a timed event that sends and starts the selected spotify playlist on my chromecast device.

Thanks
Do you see your chromecast as option in the newly created device selector/e.g. does it support spotify connect? If so, update your user variable with the the search string you would like to play. And create a new timer event which selects the chromecast as option on the device selector
Thanks for the reply. What you are saying is already working just fine. I can play music on any device that has already spotify started. What I want to do is to trigger spotify to start on the chromecast before I start playing music. You can not send / push a song, playlist or other from Domoticz to Spotify unless the spotify client is already running on the unit.

Sjaakios
Posts: 24
Joined: Saturday 04 June 2016 23:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Sjaakios » Thursday 06 December 2018 15:42

Ahha, i c... Cannot help you with that..
I have an onkyo receiver, which is always 'awake' for spotify connect. If I start spotify on the onkyo, it wakes up on its own.

Tobbo
Posts: 6
Joined: Monday 08 October 2018 13:11
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Tobbo » Thursday 06 December 2018 19:56

Sjaakios wrote:
Thursday 06 December 2018 15:42
Ahha, i c... Cannot help you with that..
I have an onkyo receiver, which is always 'awake' for spotify connect. If I start spotify on the onkyo, it wakes up on its own.
I see, might look into getting one of does then. But I did find a plugin called SpotyPi, together with PyChromecast and this plugin I might be able to start the chromecast, then send the push to start songs via Domoticz. I'll return with an answer if I manage to solve it. Thanks anyway

mrminning
Posts: 1
Joined: Friday 07 December 2018 11:03
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by mrminning » Friday 07 December 2018 11:31

Tobbo wrote:
Thursday 06 December 2018 19:56
I see, might look into getting one of does then. But I did find a plugin called SpotyPi, together with PyChromecast and this plugin I might be able to start the chromecast, then send the push to start songs via Domoticz. I'll return with an answer if I manage to solve it. Thanks anyway
I am also very keen to make a "press one button to play certain Spotify playlist on Chromecast audio group of speakers". Did you make any progress?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests