Python Plugin: Spotify

Python and python framework
eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 12:34

Ok, now we are getting somewhere :

root@diskstation:/volume1/@appstore/domoticz/var# curl -v -L "http://127.0.0.1:8084/json.htm?type=com ... rvariables"
> GET /json.htm?type=command&param=getuservariables HTTP/1.1
> Host: 127.0.0.1:8084
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Length: 56
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-cache
< Pragma: no-cache
< Access-Control-Allow-Origin: *
<
{
"status" : "OK",
"title" : "GetUserVariables"
}



total logging from the plug :
2018-07-05 12:31:05.642 Status: (Spotify) Started.
2018-07-05 12:31:06.024 Status: (Spotify) Entering work loop.
2018-07-05 12:31:06.024 Status: (Spotify) Initialized version 0.1, author 'djj'
2018-07-05 12:31:06.095 Error: (Spotify) Cannot read the uservariable holding the persistent variables

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

Re: Python Plugin: Spotify

Post by Sjaakios » Thursday 05 July 2018 12:40

Ahh, so you have no variables at all at the moment? Try adding one manually in your domoticz. Maybe that’s causing the issue. (Should solve that in the code of that is the case...)


Verzonden vanaf mijn iPhone met Tapatalk

eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 12:43

ehm ???
no idea what you mean and how to do that ...
I have 9 devices running smooth for months, no problems with them ...

eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 12:48

adding a var named test with a value of 1 did the trick...
Perhaps you should modify your code to ignore uservars if there are none ...

Now I get an other error

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 incorred. Please note that the code received from Spotify could only be used once. Please get a new one from spotify.

let me re-initialize the codes

eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 12:52

After re-init the code something is happening. I get a device, but only one ...
Screen Shot 2018-07-05 at 13.00.14.png
Screen Shot 2018-07-05 at 13.00.14.png (51.43 KiB) Viewed 686 times
I expected more controls ???

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

Re: Python Plugin: Spotify

Post by Sjaakios » Thursday 05 July 2018 14:28

Cool! I'll fix that in the code... [update]fixed in new version[/update]

For the usage, now update your user variable Spotify-searchTxt with for instance 'artist coldplay'. After the update. select on the device ebook, it should start playing spotify on this device.

eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 14:57

Ok, that works ..

after adding a search string in that var I can switch between iPad and MacBook running spotify.
Some more controls would be nice but this is a start ...
It always sets the volume on the iPad 100% too

Eddie

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

Re: Python Plugin: Spotify

Post by Sjaakios » Thursday 05 July 2018 15:04

Nice that it works!

Good feature requests :-)

eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 15:15

like
volume controls
display playing track
search from control
;-)

no hurry

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

Re: Python Plugin: Spotify

Post by Sjaakios » Thursday 05 July 2018 15:28

eddieb wrote:
Thursday 05 July 2018 15:15
like
volume controls
display playing track
search from control
;-)

no hurry
I did think about this... however i don't really see the use case for this. Real control of spotify I would always do via my spotify app. I'll will never go to my domoticz to do this.
Use case that i see, is that you enter home, wake up... you can start your favorite tune. Or in my case, i have a google home, were i will say what i would like to listen, via IFTTT it will update my user variable, en press play and it will play the tune on my receiver. (by default google home only allows Spotify playback on the google home device :? )

dlefol
Posts: 47
Joined: Monday 21 December 2015 17:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by dlefol » Wednesday 11 July 2018 9:52

Hi,

Thanks a lot for the plugin. I tested it yesterday and it works fine.
I have a similar use case as yours but a bit different:

I want to be able to launch automatically some of my playlists using scenes (for instance to have background music when I activate the scene "cooking" which triggers other things too).

I also want to use it as a simple spotify control for my kids so they can play music without giving them access to the phone/tablet. I'm planning to use the Xiaomi smart cube for that: shake would start spotify, rotate clockwise / anti clockwise would change the volume (I can control my sound system directly for that so not via spotify).

The controls I haven't figured out how to do yet are:
- skip to next / previous songs (for the kids who like to repeat the same song over and over again, a movement of the cube could allow that)
- Shuffle mode on / off for playlist

Thanks again for this plugin.

dlefol
Posts: 47
Joined: Monday 21 December 2015 17:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by dlefol » Monday 23 July 2018 21:51

Hello,

As I said in my previous post, I tested the plugin on my test machine and all worked fine. When I try to do the same on my production server, I have a problem unfortunatelly. As soon as the spotify hardware is activated my whole domoticz hangs up. No more response of the web interface at all.
I am obliged to restart the service and quickly deactivate the hardware to restore a running domoticz. I tried several times and it s really the activation of the hardware linked to the spotify plugin which causes the problem.

I have nothing in the log except the line saying Status (Spotify) Started and the one saying " Status: PluginSystem: Entering work loop".

Idon't know what to do to help solve this issue. I can test different things if you want but don't know which way to go...

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

Re: Python Plugin: Spotify

Post by Sjaakios » Tuesday 24 July 2018 10:10

Aiii, i honestly have no clue...

What kind of system is your test vs your production? What version of domoticz? OS running? python version?
Did you turn on the debug of the plugin? As it doesnt spit out any logging, which i find odd... as i understand from the plugin framework, It would first start with executing the code in the start command, that should spit out some logging already. After that it will go into the loop, looping every 30 seconds and running the heartbeat code.

dlefol
Posts: 47
Joined: Monday 21 December 2015 17:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by dlefol » Wednesday 25 July 2018 23:00

Hello again,

I had the time to investigate a bit more and the problem had nothing to do with the spotify plugin itself but was a more general issue with python plugins on my production machine. I updated the image of my RPi to stretch (production was still in jessie) and updated domoticz to the latest beta and it works now on my production as well.

Thanks

corederoma82
Posts: 76
Joined: Saturday 14 January 2017 22:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by corederoma82 » Monday 13 August 2018 10:29

I'm sorry,
the "readme" of plugin says:

- Create a client ID at spotify (https://developer.spotify.com/dashboard/applications)
- Enter all fields as desired
- Enter IP address on which domoticz can be reached (but where is this field, in the plugin settings in domoticz)??????


Thanks
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826

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

Re: Python Plugin: Spotify

Post by Sjaakios » Tuesday 14 August 2018 9:35

Yes, in domoticz hardware setting indeed..
I can understand why the readme is confusing here, i've updated it.

corederoma82
Posts: 76
Joined: Saturday 14 January 2017 22:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by corederoma82 » Tuesday 14 August 2018 10:51

Thanks
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest