Python Plugin: Chromecast Topic is solved

Python and python framework

Moderator: leecollings

User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin: Chromecast

Post 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
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
Frelinde
Posts: 3
Joined: Wednesday 25 April 2018 10:15
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sweden
Contact:

Re: Python Plugin: Chromecast

Post 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.
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin: Chromecast

Post 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.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
OedzesG
Posts: 106
Joined: Monday 11 March 2019 0:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by OedzesG »

@OedzesG,
I will add new aplications (as they are used) to the Source device in the next version.
@kniazio, thnx!
OedzesG
Posts: 106
Joined: Monday 11 March 2019 0:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by OedzesG »

@Dnpwwo Thnx! ofcourrse!!
Frelinde
Posts: 3
Joined: Wednesday 25 April 2018 10:15
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sweden
Contact:

Re: Python Plugin: Chromecast

Post 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.
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin: Chromecast

Post by Dnpwwo »

@EdwinK,

Added support for groups in version 1.10.2
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Chromecast

Post by EdwinK »

Thanks :)
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
DutchHans
Posts: 230
Joined: Friday 03 April 2015 20:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany (near dutch border)
Contact:

Re: Python Plugin: Chromecast

Post 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?
Frelinde
Posts: 3
Joined: Wednesday 25 April 2018 10:15
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sweden
Contact:

Re: Python Plugin: Chromecast

Post 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.
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post 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
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post 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
schulpr
Posts: 137
Joined: Thursday 01 January 2015 9:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Python Plugin: Chromecast

Post 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
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post 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
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post 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.
snellejellep
Posts: 241
Joined: Tuesday 16 May 2017 13:05
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Neterlands
Contact:

Re: Python Plugin: Chromecast

Post 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
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
sstolk
Posts: 28
Joined: Tuesday 03 December 2013 9:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post 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.
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post 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
wvries
Posts: 31
Joined: Sunday 05 March 2017 11:49
Target OS: Raspberry Pi / ODroid
Domoticz version: latest B
Location: Lo Santiago, Murcia, Spain
Contact:

Re: Python Plugin: Chromecast

Post 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.
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post 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()
Post Reply

Who is online

Users browsing this forum: RNEE and 1 guest