Page 8 of 11

Re: Python Plugin: Chromecast

Posted: Wednesday 13 March 2019 1:36
by Dnpwwo
@kniazio,

Have a look at the wiki for details around scripting events or click on the 'Events' menu option in the Domoticz web interface. Scripts can be triggered in a number of ways.

@EdwinK,

I haven't played with the grouping function yet. Good news is it looks like the plugin is made aware of their existence :!:

I have a second Google Home that I will turn on this weekend and create a group to see what the pychromecast library allows us to do

Re: Python Plugin: Chromecast

Posted: Wednesday 13 March 2019 9:08
by Frelinde
Dnpwwo wrote: Monday 11 March 2019 13:12 There are a number of Chromecast/Home plugins if this one is not doing what you want.

Mine is here: https://github.com/dnpwwo/Domoticz-Google-Plugin but I believe other users have created some as well.

mine doesn't use user variables at all but does handle notificatons from scripts or devices directly.
Any idea why i receive this error message after activating the plugin at the hardware tab?

2019-03-13 09:03:41.712 Error: (GoogleDevs) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Domoticz-Google-Plugin/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2019-03-13 09:03:41.712 Error: (Google Home) Module Import failed, exception: 'ImportError'
2019-03-13 09:03:41.712 Error: (Google Home) Module Import failed: ' Name: pychromecast'
2019-03-13 09:03:41.712 Error: (Google Home) Error Line details not available.

Re: Python Plugin: Chromecast

Posted: Wednesday 13 March 2019 10:09
by Dnpwwo
@Frelinde,

Either the beta version of Domoticz is not update to date enough or pychromecast is not installed in line with the instructions.

I would suggest moving to the current beta and executing

Code: Select all

sudo pip3 install pychromecast
just to be sure.

Re: Python Plugin: Chromecast

Posted: Wednesday 13 March 2019 10:51
by OedzesG
@OedzesG,
I will add new aplications (as they are used) to the Source device in the next version.
@kniazio, thnx!

Re: Python Plugin: Chromecast

Posted: Wednesday 13 March 2019 10:55
by OedzesG
@Dnpwwo Thnx! ofcourrse!!

Re: Python Plugin: Chromecast

Posted: Wednesday 13 March 2019 14:45
by Frelinde
Dnpwwo wrote: Wednesday 13 March 2019 10:09 @Frelinde,

Either the beta version of Domoticz is not update to date enough or pychromecast is not installed in line with the instructions.

I would suggest moving to the current beta and executing

Code: Select all

sudo pip3 install pychromecast
just to be sure.
Thanks. My Domoticz version was to low. After updating to latest beta the plugin loaded as it should.

Re: Python Plugin: Chromecast

Posted: Sunday 17 March 2019 11:21
by Dnpwwo
@EdwinK,

Added support for groups in version 1.10.2

Re: Python Plugin: Chromecast

Posted: Sunday 17 March 2019 16:17
by EdwinK
Thanks :)

Re: Python Plugin: Chromecast

Posted: Sunday 17 March 2019 16:47
by DutchHans
just tried it and my notifications time out

2019-03-17 16:46:25.381 (Google Devices - Downstairs Volume) Updating device from 2:'50' to have values 2:'33'.
2019-03-17 16:46:25.387 (Google Devices) [Google Devices - Living Room speaker Volume] Update 2(2):'50'(49): 0(0)
2019-03-17 16:46:25.387 (Google Devices - Living Room speaker Volume) Updating device from 2:'49' to have values 2:'50'.
2019-03-17 16:46:25.565 (Google Devices) [Google Devices - Downstairs Volume] Update 0(2):'33'(33): 0(0)
2019-03-17 16:46:25.565 (Google Devices - Downstairs Volume) Updating device from 2:'33' to have values 0:'33'.
2019-03-17 16:46:25.140 Status: User: Admin initiated a switch command (1743/TestSwitch/On)
2019-03-17 16:46:25.142 Status: Notification: This is a testmessage
2019-03-17 16:46:28.683 (Google Devices) Pushing 'onHeartbeatCallback' on to queue
2019-03-17 16:46:28.739 (Google Devices) Processing 'onHeartbeatCallback' message
2019-03-17 16:46:28.739 (Google Devices) Calling message handler 'onHeartbeat'.
2019-03-17 16:46:35.401 (Google Devices) [Google Devices - Living Room speaker Volume] Update 2(2):'49'(50): 0(0)
2019-03-17 16:46:35.401 (Google Devices - Living Room speaker Volume) Updating device from 2:'50' to have values 2:'49'.
2019-03-17 16:46:35.437 (Google Devices) [Google Devices - Downstairs Volume] Update 2(0):'33'(33): 0(0)
2019-03-17 16:46:35.438 (Google Devices - Downstairs Volume) Updating device from 0:'33' to have values 2:'33'.
2019-03-17 16:46:35.382 Error: (Google Devices) Notification 'This is a testmessage', sent to 'Downstairs' timed out

any ideas?

Re: Python Plugin: Chromecast

Posted: Monday 18 March 2019 9:55
by Frelinde
I had some issues with Dnpwwo's plugin that was located on my side.

When I sent one notification it worked perfectly. But when trying to send another one right after that, it didn't play instantly. It could play a few minutes later.

In my home network I have an USG (Unifi Security Gateway) with IPS (Intrusion Prevention System) enabled. And in that log i found that it was handling those request as potential malware and therefore interfered with the communication. After creating a rule to suppress those packages everything worked like a charm.

Just wanted to share the solution if anyone else experience similar problems with an USG in there network.

Re: Python Plugin: Chromecast

Posted: Monday 18 March 2019 10:40
by Ewaldharmsen
OedzesG wrote: Monday 11 March 2019 0:25 Like almost everyone I get the error: [(Chromecast) Could not create 'TV attic', result was ERR. Url used is http: //XXX.XXX.X.X: 8080 / json.htm? Type = command & param = saveuservariable & vname = TV attic & vtype = 2 & vvalue =]

But the big problem why this plugin does not work is:
[Error: (Chromecast) Error on line 319 Error is not join thread before it is started]

Can someone please help me?
This error is because of a new beta version, I will look into it

Re: Python Plugin: Chromecast

Posted: Wednesday 20 March 2019 7:40
by Ewaldharmsen
OedzesG wrote: Monday 11 March 2019 0:25 Like almost everyone I get the error: [(Chromecast) Could not create 'TV attic', result was ERR. Url used is http: //XXX.XXX.X.X: 8080 / json.htm? Type = command & param = saveuservariable & vname = TV attic & vtype = 2 & vvalue =]

But the big problem why this plugin does not work is:
[Error: (Chromecast) Error on line 319 Error is not join thread before it is started]

Can someone please help me?
Fixed in version 3.3.4

Re: Python Plugin: Chromecast

Posted: Monday 25 March 2019 17:39
by schulpr
Hi,

I have the same error as mentioned by DutchHans ''Error: (Google Devices) Notification 'This is a testmessage', sent to 'Downstairs' timed out''. Is a solution already found?

Thanks for any suggestions!

Kind regards, Rob

Re: Python Plugin: Chromecast

Posted: Monday 25 March 2019 19:36
by Ewaldharmsen
schulpr wrote: Monday 25 March 2019 17:39 Hi,

I have the same error as mentioned by DutchHans ''Error: (Google Devices) Notification 'This is a testmessage', sent to 'Downstairs' timed out''. Is a solution already found?

Thanks for any suggestions!

Kind regards, Rob
Please use another Topic, this topic is about the Chromecasts plugin not the Domoticz-Google-Plugin

Re: Python Plugin: Chromecast

Posted: Monday 25 March 2019 19:44
by Ewaldharmsen
I just released version 4.0.0.

Here is what changed:
  • Spotify support
  • If you start Spotify or Youtube from the appname device, it automatically starts playing the track or playlist you lastly used.
  • Auto-resume after text is played
  • Possible to go back one track or go to the next one
How to upgrade
  • Update PyChromecast
  • Install spotify-token
  • Install spotipy.git
  • Remove at least the app-control devices.
  • Update your hardware settings, optionally add a Spotify username and password.

Re: Python Plugin: Chromecast

Posted: Monday 25 March 2019 19:58
by snellejellep
thank you for the great work! (ps. add a paypal.me link so people can buy you a beer)

i updated and got this in my log:

Code: Select all

2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
don't know if this will hurt anything?

also other plugins are reporting errors now, did you change anything that may affect these?

Code: Select all

2019-03-25 19:57:27.039 Error: xiaomi vacuum hardware (19) thread seems to have ended unexpectedly
2019-03-25 19:57:27.044 Error: Spotify hardware (27) thread seems to have ended unexpectedly
2019-03-25 19:57:27.044 Error: Buienradar hardware (29) thread seems to have ended unexpectedly

Re: Python Plugin: Chromecast

Posted: Monday 25 March 2019 21:12
by sstolk
I've installed the script and I can control a lot! But voice messages from notifications is the thing that doesn't work...

I've got a notification when the door of the mancave opens with a custom text Hello there and only Google ticked and this is the result in the log:

Code: Select all

2019-03-25 21:07:47.202 Error: (Google Casting) Notification 'Hello there', sent to 'Mancave' timed out
The Google Home mini adjusts his volume and notification jingle for stream starts but then after 5 seconds it mutes back to the original volume and the above error appears.

Re: Python Plugin: Chromecast

Posted: Monday 25 March 2019 21:24
by Ewaldharmsen
snellejellep wrote: Monday 25 March 2019 19:58 thank you for the great work! (ps. add a paypal.me link so people can buy you a beer)

i updated and got this in my log:

Code: Select all

2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
don't know if this will hurt anything?

also other plugins are reporting errors now, did you change anything that may affect these?

Code: Select all

2019-03-25 19:57:27.039 Error: xiaomi vacuum hardware (19) thread seems to have ended unexpectedly
2019-03-25 19:57:27.044 Error: Spotify hardware (27) thread seems to have ended unexpectedly
2019-03-25 19:57:27.044 Error: Buienradar hardware (29) thread seems to have ended unexpectedly
I think the update of PyChromecast was not successful, please unstall it and install it again with with sudo pip3 install pychromecast

Re: Python Plugin: Chromecast

Posted: Monday 25 March 2019 21:52
by wvries
Ewaldharmsen wrote: Monday 25 March 2019 21:24
snellejellep wrote: Monday 25 March 2019 19:58 thank you for the great work! (ps. add a paypal.me link so people can buy you a beer)

i updated and got this in my log:

Code: Select all

2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
don't know if this will hurt anything?

also other plugins are reporting errors now, did you change anything that may affect these?

Code: Select all

2019-03-25 19:57:27.039 Error: xiaomi vacuum hardware (19) thread seems to have ended unexpectedly
2019-03-25 19:57:27.044 Error: Spotify hardware (27) thread seems to have ended unexpectedly
2019-03-25 19:57:27.044 Error: Buienradar hardware (29) thread seems to have ended unexpectedly
I think the update of PyChromecast was not successful, please unstall it and install it again with with sudo pip3 install pychromecast
Same issue here.
Re-installed PyChromecast - not resolved.

I see another strange result. When I look at the processes running, with the plugin enabled and the errors, I get more and more processes of Domoticz.

Code: Select all

root     22150     1 24 21:48 ?        00:00:07 /home/pi/domoticz/domoticz -daemon -www 8900 -sslwww 443
root     22227 22150  0 21:48 ?        00:00:00 /home/pi/domoticz/domoticz -daemon -www 8900 -sslwww 443
root     22326 22150  3 21:49 ?        00:00:00 /home/pi/domoticz/domoticz -daemon -www 8900 -sslwww 443
looks like the plugin is respawning / crashing DZ. This will go on until the system becomes unstable and unresponsive.
When disabling the plugin (and restarting DZ) this issue is gone.

Re: Python Plugin: Chromecast

Posted: Tuesday 26 March 2019 7:01
by Ewaldharmsen
wvries wrote: Monday 25 March 2019 21:52
Ewaldharmsen wrote: Monday 25 March 2019 21:24
snellejellep wrote: Monday 25 March 2019 19:58 thank you for the great work! (ps. add a paypal.me link so people can buy you a beer)

i updated and got this in my log:

Code: Select all

2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
2019-03-25 19:56:14.795 Error: (Chromecasts) Error on line 611 Error is 'Chromecast' object has no attribute 'start'
don't know if this will hurt anything?

also other plugins are reporting errors now, did you change anything that may affect these?

Code: Select all

2019-03-25 19:57:27.039 Error: xiaomi vacuum hardware (19) thread seems to have ended unexpectedly
2019-03-25 19:57:27.044 Error: Spotify hardware (27) thread seems to have ended unexpectedly
2019-03-25 19:57:27.044 Error: Buienradar hardware (29) thread seems to have ended unexpectedly
I think the update of PyChromecast was not successful, please unstall it and install it again with with sudo pip3 install pychromecast
Same issue here.
Re-installed PyChromecast - not resolved.

I see another strange result. When I look at the processes running, with the plugin enabled and the errors, I get more and more processes of Domoticz.

Code: Select all

root     22150     1 24 21:48 ?        00:00:07 /home/pi/domoticz/domoticz -daemon -www 8900 -sslwww 443
root     22227 22150  0 21:48 ?        00:00:00 /home/pi/domoticz/domoticz -daemon -www 8900 -sslwww 443
root     22326 22150  3 21:49 ?        00:00:00 /home/pi/domoticz/domoticz -daemon -www 8900 -sslwww 443
looks like the plugin is respawning / crashing DZ. This will go on until the system becomes unstable and unresponsive.
When disabling the plugin (and restarting DZ) this issue is gone.
Strange.

Just to be sure can you do the following in your terminal?
Python3
Import pychromecast
Chromecasts = pychromecast.get_chromecasts()
for Chromecast in self.Chromecasts:
Chromecast.start()