Page 3 of 5
Re: Python Plugin: Spotify
Posted: Tuesday 30 October 2018 11:21
by Sjaakios
bartbosch wrote: ↑Sunday 28 October 2018 23: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
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.
Re: Python Plugin: Spotify
Posted: Tuesday 04 December 2018 16:22
by Tobbo
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
Re: Python Plugin: Spotify
Posted: Tuesday 04 December 2018 19:00
by snellejellep
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
Re: Python Plugin: Spotify
Posted: Tuesday 04 December 2018 21:33
by Tobbo
snellejellep wrote: ↑Tuesday 04 December 2018 19: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.
Re: Python Plugin: Spotify
Posted: Thursday 06 December 2018 9:29
by Sjaakios
Tobbo wrote: ↑Tuesday 04 December 2018 16: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
Re: Python Plugin: Spotify
Posted: Thursday 06 December 2018 14:03
by Tobbo
Sjaakios wrote: ↑Thursday 06 December 2018 9:29
Tobbo wrote: ↑Tuesday 04 December 2018 16: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.
Re: Python Plugin: Spotify
Posted: Thursday 06 December 2018 14:42
by Sjaakios
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.
Re: Python Plugin: Spotify
Posted: Thursday 06 December 2018 18:56
by Tobbo
Sjaakios wrote: ↑Thursday 06 December 2018 14: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
Re: Python Plugin: Spotify
Posted: Friday 07 December 2018 10:31
by mrminning
Tobbo wrote: ↑Thursday 06 December 2018 18: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?
Re: Python Plugin: Spotify
Posted: Monday 24 December 2018 12:48
by Tobbo
mrminning wrote: ↑Friday 07 December 2018 10:31
Tobbo wrote: ↑Thursday 06 December 2018 18: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?
I've made little progress.
1. From Domoticz, Starting up Harmony Hub Scene "Music" = TV Start, Surround Sound System Start, Switch to HMDI Imput for Chromecast.
2. I'm able to start any playlist on Spotify on a unit which already has Spotify running as an app from Domoticz.
Me and a friend is currently working with what is available to us using
* PyChromecast
https://github.com/balloob/pychromecast
* Spotipy
https://spotipy.readthedocs.io/en/latest/#
* Domoticz Spotify
https://github.com/DaanJJansen/domoticz-spotify
We are currently trying to solve the issue of starting a app on the Chromecast from any type of code/script file using any type of programming language in a external script file. Currently we are writing on a file in Python.
I have contacted both Spotify here in Sweden and Google senior support without any help unfortunately. Best case scenario would be to get contact with some software developer for the chromecast and ask them how to use the "push" feature that you have on any apps to launch an app manually or via script file.
Re: Python Plugin: Spotify
Posted: Wednesday 26 December 2018 12:25
by Dnpwwo
@Tobbo,
There are a number of plugin developments going on in this area, all seem to be taking slightly different approaches (which is great because someone may create the perfect solution
).
My (early dev version) might help because it allows you to select Spotify from a Domoticz script or 'Source' device but I have yet to add being able to trigger a specific playlist although I understand how that could be done.
Have a look at
https://github.com/dnpwwo/Domoticz-Goog ... /plugin.py, line 354 starts Spotify if you pass in 'CC32E753' which is defined on line 52 or invoke 'Audio' from Blockly or Lua you can switch to Spotify.
The Chromecast API (from Balloob) would suggest that once the application has been selected all you need is the URL of the media (or playlist)
Code: Select all
def play_media(self, url, content_type, title=None, thumb=None,
current_time=0, autoplay=True,
stream_type=STREAM_TYPE_BUFFERED,
metadata=None, subtitles=None, subtitles_lang='en-US',
subtitles_mime='text/vtt', subtitle_id=1):
I plan to match this with the 'Trigger' script command if I can. I'm assuming the URL can be found be triggering the URL through the Spotify App itself then looking in the 'Messages.log' to see what the URL actually is (TBC).
Re: Python Plugin: Spotify
Posted: Saturday 29 December 2018 17:21
by Tobbo
Dnpwwo wrote: ↑Wednesday 26 December 2018 12:25
@Tobbo,
There are a number of plugin developments going on in this area, all seem to be taking slightly different approaches (which is great because someone may create the perfect solution
).
My (early dev version) might help because it allows you to select Spotify from a Domoticz script or 'Source' device but I have yet to add being able to trigger a specific playlist although I understand how that could be done.
Have a look at
https://github.com/dnpwwo/Domoticz-Goog ... /plugin.py, line 354 starts Spotify if you pass in 'CC32E753' which is defined on line 52 or invoke 'Audio' from Blockly or Lua you can switch to Spotify.
The Chromecast API (from Balloob) would suggest that once the application has been selected all you need is the URL of the media (or playlist)
Code: Select all
def play_media(self, url, content_type, title=None, thumb=None,
current_time=0, autoplay=True,
stream_type=STREAM_TYPE_BUFFERED,
metadata=None, subtitles=None, subtitles_lang='en-US',
subtitles_mime='text/vtt', subtitle_id=1):
I plan to match this with the 'Trigger' script command if I can. I'm assuming the URL can be found be triggering the URL through the Spotify App itself then looking in the 'Messages.log' to see what the URL actually is (TBC).
I'm still not sure how to launch spotify from an external source, like domoticz or any scriptfile. That is were the core of the problem currently resides. I need to start spotify somehow on the chromecast before I can send music to it.
Re: Python Plugin: Spotify
Posted: Saturday 29 December 2018 23:46
by Dnpwwo
@Tobbo,
The same Chromecast object has a start_app API for that. Try something like:
Code: Select all
your_chromecast_object.start_app('CC32E753') # yep, Google uses magic codes for apps
or have a look at line 376 in the most recent version (1.2.1) of my plugin. That is linked to a Domoticz selector device that allows you to switch between the standard apps.
Not extensively tested but worked fine for an idle device, I don't know if you can send the play_media command right after or if you need to wait.
Re: Python Plugin: Spotify
Posted: Sunday 30 December 2018 0:02
by assenzuid
Get this errpr
Code: Select all
Error calling 'http://localhost:8081/json.htm?vvalue=&vname=Spotify-refresh_token&vtype=2¶m=saveuservariable&type=command'
Re: Python Plugin: Spotify
Posted: Sunday 30 December 2018 13:38
by Ewaldharmsen
Dnpwwo wrote: ↑Wednesday 26 December 2018 12:25
@Tobbo,
There are a number of plugin developments going on in this area, all seem to be taking slightly different approaches (which is great because someone may create the perfect solution
).
My (early dev version) might help because it allows you to select Spotify from a Domoticz script or 'Source' device but I have yet to add being able to trigger a specific playlist although I understand how that could be done.
Have a look at
https://github.com/dnpwwo/Domoticz-Goog ... /plugin.py, line 354 starts Spotify if you pass in 'CC32E753' which is defined on line 52 or invoke 'Audio' from Blockly or Lua you can switch to Spotify.
The Chromecast API (from Balloob) would suggest that once the application has been selected all you need is the URL of the media (or playlist)
Code: Select all
def play_media(self, url, content_type, title=None, thumb=None,
current_time=0, autoplay=True,
stream_type=STREAM_TYPE_BUFFERED,
metadata=None, subtitles=None, subtitles_lang='en-US',
subtitles_mime='text/vtt', subtitle_id=1):
I plan to match this with the 'Trigger' script command if I can. I'm assuming the URL can be found be triggering the URL through the Spotify App itself then looking in the 'Messages.log' to see what the URL actually is (TBC).
Hi, you know I have also created a plugin like this?
https://github.com/Tsjippy/ChromecastPlugin
Maybe we can join forces?
Re: Python Plugin: Spotify
Posted: Saturday 05 January 2019 13:49
by Tobbo
Dnpwwo wrote: ↑Saturday 29 December 2018 23:46
@Tobbo,
The same Chromecast object has a start_app API for that. Try something like:
Code: Select all
your_chromecast_object.start_app('CC32E753') # yep, Google uses magic codes for apps
or have a look at line 376 in the most recent version (1.2.1) of my plugin. That is linked to a Domoticz selector device that allows you to switch between the standard apps.
Not extensively tested but worked fine for an idle device, I don't know if you can send the play_media command right after or if you need to wait.
Hey again, thanks for the response but all I get when running this script on my chromecast object is
Code: Select all
chromecasts.launch_app('CC32E753')
AttributeError: 'Chromecast' object has no attribute 'launch_app'
also tried
Code: Select all
start_app('CC32E753')
AttributeError: 'SpotifyController' object has no attribute 'start_app'
Ewaldharmsen wrote: ↑Sunday 30 December 2018 13:38
Dnpwwo wrote: ↑Wednesday 26 December 2018 12:25
@Tobbo,
There are a number of plugin developments going on in this area, all seem to be taking slightly different approaches (which is great because someone may create the perfect solution
).
My (early dev version) might help because it allows you to select Spotify from a Domoticz script or 'Source' device but I have yet to add being able to trigger a specific playlist although I understand how that could be done.
Have a look at
https://github.com/dnpwwo/Domoticz-Goog ... /plugin.py, line 354 starts Spotify if you pass in 'CC32E753' which is defined on line 52 or invoke 'Audio' from Blockly or Lua you can switch to Spotify.
The Chromecast API (from Balloob) would suggest that once the application has been selected all you need is the URL of the media (or playlist)
Code: Select all
def play_media(self, url, content_type, title=None, thumb=None,
current_time=0, autoplay=True,
stream_type=STREAM_TYPE_BUFFERED,
metadata=None, subtitles=None, subtitles_lang='en-US',
subtitles_mime='text/vtt', subtitle_id=1):
I plan to match this with the 'Trigger' script command if I can. I'm assuming the URL can be found be triggering the URL through the Spotify App itself then looking in the 'Messages.log' to see what the URL actually is (TBC).
Hi, you know I have also created a plugin like this?
https://github.com/Tsjippy/ChromecastPlugin
Maybe we can join forces?
Surething, I did not know about your plugin, but I'm trying out anything that's out there right now. Nice to see that there is more people working on a solution to this.
Edit: @Dnpwwo
Also I can't seem to get your plugin to work properly, I did follow the instructions you've listed for in the installation section and also took note of the domo and python versions required. Devices won't show up in domo unfortunatly.
Re: Python Plugin: Spotify
Posted: Friday 25 January 2019 18:04
by PeterFleur
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¶m=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
Re: Python Plugin: Spotify
Posted: Tuesday 29 January 2019 11:21
by GreenSmart01
Hi,
I have tried to add this plugin to my domoticz installation on my rapberry pi. If I add this hardware to domoticz and fill in the data, and save it, domoticz will crash. I have been reasonably patient. but the webpage domoticz is no longer available. Only when I restart the raspberrypi and remove the folder cd ~ / domoticz / plugins / spotify does domoticz work.
how can I solve this
?
Re: Python Plugin: Spotify
Posted: Tuesday 29 January 2019 12:10
by PeterFleur
I had the same but when I restarted domoticz the plugin worked. So you don't have to remove the plugin.
But it looks like the code Spotify is giving is too long for the user variables in Domoticz
Peter
Sent from my SM-G930F using Tapatalk
Re: Python Plugin: Spotify
Posted: Wednesday 30 January 2019 8:00
by renerene
what is the status 2019?
Can I use this plugin to make a button (dashticz, alexa, harmony hub) that will start my playlist on my stereo, with th click of one dedicated button?