Python Plugin: Chromecast Topic is solved

Python and python framework

Moderator: leecollings

Post Reply
pele
Posts: 3
Joined: Friday 21 December 2018 10:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10304
Contact:

Re: Python Plugin: Chromecast

Post by pele »

Now I don't get any error, but the whole thing just freezes.
I have installed the plugin according to the steps provided on github. I am able to successfully query my google devices using the pychromecast lib directly.
I am logging in to domoticz, add hardware and get the following:

Code: Select all

Status: (Google) Started.
And then nothing, the website does not respond, log file (/tmp/domoticz.txt) is not updated after that - nothing. Chrome is notifying me that website does not respond and whether to wait or close it.
Tried restarting domoticz, but after bootstrapping, the effect is the same. `htop` doesn't show any concerning data like high cpu usage by domoticz or anything like that.

The only way to make domoticz work again is to stop it, remove the folder, then start and remove the hardware from GUI. Otherwise I can't even open the hardware page in domoticz.
After one restart I got `Error: Domoticz(pid:5811, tid:5817('PluginMgr')) received fatal signal 11 (Segmentation fault)` when plugin was loaded, but not sure if this was related.

Please advise.

Domoticz ver 4.10304, Build Hash: 30480b21
Python Version: 3.4.2 (default, Sep 26 2018, 07:50:08) [GCC 4.9.2]
Plugin version: 3.1.4
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Ewaldharmsen »

EddyG wrote: Monday 31 December 2018 9:43 Same here on plugin version 3.1.4. and Domoticz 4.10302
Solved in 3.1.5 Nasty bug to find, but now it should work.
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Ewaldharmsen »

pele wrote: Monday 31 December 2018 11:42 Now I don't get any error, but the whole thing just freezes.
I have installed the plugin according to the steps provided on github. I am able to successfully query my google devices using the pychromecast lib directly.
I am logging in to domoticz, add hardware and get the following:

Code: Select all

Status: (Google) Started.
And then nothing, the website does not respond, log file (/tmp/domoticz.txt) is not updated after that - nothing. Chrome is notifying me that website does not respond and whether to wait or close it.
Tried restarting domoticz, but after bootstrapping, the effect is the same. `htop` doesn't show any concerning data like high cpu usage by domoticz or anything like that.

The only way to make domoticz work again is to stop it, remove the folder, then start and remove the hardware from GUI. Otherwise I can't even open the hardware page in domoticz.
After one restart I got `Error: Domoticz(pid:5811, tid:5817('PluginMgr')) received fatal signal 11 (Segmentation fault)` when plugin was loaded, but not sure if this was related.

Please advise.

Domoticz ver 4.10304, Build Hash: 30480b21
Python Version: 3.4.2 (default, Sep 26 2018, 07:50:08) [GCC 4.9.2]
Plugin version: 3.1.4
I use Python 3.5.3, can you update and test again?
pele
Posts: 3
Joined: Friday 21 December 2018 10:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10304
Contact:

Re: Python Plugin: Chromecast

Post by pele »

Ewaldharmsen wrote:I use Python 3.5.3, can you update and test again?
Thanks @Ewaldharmsen, it is working with 3.5.3 - worth putting somewhere in readme
User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Python Plugin: Chromecast

Post by sincze »

Ewaldharmsen wrote: Tuesday 20 November 2018 8:24 I created a plugin to retrieve Chromecasts statuses and control the Chromecasts from Domoticz.
See https://github.com/Tsjippy/ChromecastPlugin/
Easy setup. It all works, except for the notifications. I guess this is due to the same reason as mentioned here:
http://www.domoticz.com/forum/viewtopic ... 40#p192275

IOT devices -> chromecasts are on separate VLAN and the main LAN (domoticz) is only able to talk to the VLAN. (one-way)
So the VLAN is not able to request the "playback sample file" to play from the main LAN domoticz machine on the specified port.

So I consider this my problem, as this is not a plugin issue. Great job!
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
gerbenvanasselt
Posts: 74
Joined: Friday 07 September 2018 14:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta 4.1
Location: Netherlands
Contact:

Re: Python Plugin: Chromecast

Post by gerbenvanasselt »

Ewaldharmsen wrote: Tuesday 20 November 2018 20:21 Just add a value to the created variabele and the text will be spoken.
I use it voor voice messages and fill the variable from a lua script
Hi there Ewald,

I am not into programming yet :roll: But can you give a (script) example on how to fill the text value for speech?
Have looked throughout the forum, but could't find any examples...

Would be great to learn from you.

Gr.
Gerben
mark.sellwood
Posts: 101
Joined: Tuesday 04 March 2014 10:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Surrey, UK
Contact:

Re: Python Plugin: Chromecast

Post by mark.sellwood »

This is a sample LUA script

Code: Select all

commandArray = {}
--
-- Turn the Front Lights on if the Front Door PIR is activated.
if (devicechanged['Front Door PIR'] == 'On') then
	commandArray['Front Lights']='On FOR 4'
	commandArray['Variable:Lounge Speaker']='Motion detected outside the front'
end
--
return commandArray
"Front Door PIR" is a motion detector
"Front Lights" are the front outside lights
"Lounge Speaker" is the Google Home Mini in the Lounge
When the motion sensor detects motion the outside lights come on & I get a notification.

I hope this points you in the right direction.
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
gerbenvanasselt
Posts: 74
Joined: Friday 07 September 2018 14:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta 4.1
Location: Netherlands
Contact:

Re: Python Plugin: Chromecast

Post by gerbenvanasselt »

mark.sellwood wrote: Tuesday 01 January 2019 22:09 This is a sample LUA script

Code: Select all

commandArray = {}
--
-- Turn the Front Lights on if the Front Door PIR is activated.
if (devicechanged['Front Door PIR'] == 'On') then
	commandArray['Front Lights']='On FOR 4'
	commandArray['Variable:Lounge Speaker']='Motion detected outside the front'
end
--
return commandArray
"Front Door PIR" is a motion detector
"Front Lights" are the front outside lights
"Lounge Speaker" is the Google Home Mini in the Lounge
When the motion sensor detects motion the outside lights come on & I get a notification.

I hope this points you in the right direction.
Thanks alot that helped me very much! I wrote the scripts with the domo event module. When i use Lua scripts in domo filesystem i get errorcodes like 32512, 512 etc. With the event module it works. Even when i give the right permissions for the files (0777).
mark.sellwood
Posts: 101
Joined: Tuesday 04 March 2014 10:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Surrey, UK
Contact:

Re: Python Plugin: Chromecast

Post by mark.sellwood »

Below is the contents of my script named script_device_PIR.lua

Code: Select all

commandArray = {}
--
-- Turn the Front Lights on if the Front Door PIR is activated.
if (devicechanged['Front Door PIR'] == 'On') then
	commandArray['Front Lights']='On FOR 1'
	commandArray['Variable:Lounge display']='Motion detected outside the front'
end
--
return commandArray
This works fine for me.
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
mark.sellwood
Posts: 101
Joined: Tuesday 04 March 2014 10:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Surrey, UK
Contact:

Re: Python Plugin: Chromecast

Post by mark.sellwood »

I've been testing 3,1.5 today and its working fine, thanks @Ewaldharmsen
I did see an error when I asked my Mini to play Magic Radio

Code: Select all

2019-01-03 11:39:59.090 (Chromecast) The app of 'Office speaker' has changed to TuneIn Free
2019-01-03 11:39:59.387 (Chromecast) The title of Office speaker has changed to TuneIn
2019-01-03 11:39:59.417 (Chromecast) Update Office speaker: 0 - 'TuneIn'
2019-01-03 11:39:59.091 Error: (Chromecast) Error on line 107 Error is 'TuneIn Free'
2019-01-03 11:40:20.311 (Chromecast) The playing mode of Office speaker has changed to PLAYING
2019-01-03 11:40:20.346 (Chromecast) Update Office speaker: 10 - '10'
2019-01-03 11:40:20.655 (Chromecast) The title of Office speaker has changed to Magic Radio UK
2019-01-03 11:40:20.685 (Chromecast) Update Office speaker: 0 - 'Magic Radio UK'
2019-01-03 11:40:34.911 (Chromecast) Updated volume to 51
This doesn't affect the operation of the plugin.

On a totally separate note is there any way to make the plugin play an audio file?
I can set a variable to say someone at the front door when they ring the bell but it would be nice if I could play a mp3 file "Ding Dong"
Just a nice to have.

Thanks for a great plugin
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Python Plugin: Chromecast

Post by EddyG »

Ewaldharmsen wrote: Monday 31 December 2018 23:49
EddyG wrote: Monday 31 December 2018 9:43 Same here on plugin version 3.1.4. and Domoticz 4.10302
Solved in 3.1.5 Nasty bug to find, but now it should work.
Tnx, it looks like it is working now. :D
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Python Plugin: Chromecast

Post by EddyG »

When I update the plugin on the Hardware page, for instance the directory for message files.
I get these errors.

Code: Select all

2019-01-05 15:50:43.632 Status: (Cast) Disconnected from Keuken
2019-01-05 15:50:43.630 Error: (Cast) Error on line 103 Error is 'NoneType' object has no attribute 'display_name'
2019-01-05 15:50:43.631 Error: (Cast) Status of 'Woonkamer'' is changed to ConnectionStatus(status='DISCONNECTED', address=NetworkAddress(address='192.168.x.xxx', port=8009))
2019-01-05 15:50:48.872 Status: (Cast) Stopping threads.
2019-01-05 15:50:48.872 Status: (Cast) Stopped.
2019-01-05 15:50:48.873 Status: (Cast) Started.
2019-01-05 15:50:48.590 Error: (Cast) Error on line 103 Error is 'NoneType' object has no attribute 'display_name'
2019-01-05 15:50:48.591 Error: (Cast) Status of 'Keuken'' is changed to ConnectionStatus(status='DISCONNECTED', address=NetworkAddress(address='192.168.x.xxx', port=8009))
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Python Plugin: Chromecast

Post by EddyG »

Sometimes, when I want to cast text from the variable, I get this error.

Code: Select all

2019-01-06 17:11:37.493 Error: (Cast) Error on line 312 Error is 'NoneType' object has no attribute 'display_name'
msvds
Posts: 5
Joined: Sunday 08 October 2017 12:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by msvds »

pele wrote: Monday 31 December 2018 11:42 Now I don't get any error, but the whole thing just freezes.
I have installed the plugin according to the steps provided on github. I am able to successfully query my google devices using the pychromecast lib directly.
I am logging in to domoticz, add hardware and get the following:

Code: Select all

Status: (Google) Started.
And then nothing, the website does not respond, log file (/tmp/domoticz.txt) is not updated after that - nothing. Chrome is notifying me that website does not respond and whether to wait or close it.
Tried restarting domoticz, but after bootstrapping, the effect is the same. `htop` doesn't show any concerning data like high cpu usage by domoticz or anything like that.

The only way to make domoticz work again is to stop it, remove the folder, then start and remove the hardware from GUI. Otherwise I can't even open the hardware page in domoticz.
After one restart I got `Error: Domoticz(pid:5811, tid:5817('PluginMgr')) received fatal signal 11 (Segmentation fault)` when plugin was loaded, but not sure if this was related.

Please advise.

Domoticz ver 4.10304, Build Hash: 30480b21
Python Version: 3.4.2 (default, Sep 26 2018, 07:50:08) [GCC 4.9.2]
Plugin version: 3.1.4

I have the exact same problem as described above. Only I am already runnning python 3.5.3. My Domoticz ver is 4.10329. Plugin version is 3.1.5.

The error I get is:

Status: (Google) Started.
Domoticz(pid:14948, tid:14966('PluginMgr')) received fatal signal 11 (Segmentation fault)

Any ideas?
vodor
Posts: 39
Joined: Friday 19 February 2016 14:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by vodor »

I installed per instructions.
I get as far as adding the hardware and it says it added to the devices tab. However at this point my domoticz becomes completely unresponsive to the point where I have to stop the service again and only when I "rm -rf" the plugin from CLI can I start my domoticz again.
I upgraded to latest beta V4.10362 with the same result.
Domoticz logs has nothing in it for the device I just added.

Anybody with a similar issue?
Any idea where I can look?
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Ewaldharmsen »

I am now on version domoticz V4.10362, python3 version 3.5.3, plugin version 3.3.0

here all works well. Is this different from your setup?
vodor
Posts: 39
Joined: Friday 19 February 2016 14:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by vodor »

Python 3.4.2
Plugin Latest. I assume 3.3.0

I will see if I can bump up my python to 3.5.3 and see if that changes anything.

Thanks
PeterFleur
Posts: 32
Joined: Sunday 08 March 2015 13:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.4739
Contact:

Re: Python Plugin: Chromecast

Post by PeterFleur »

I had the same with the hanging of Domoticz while saving and it was because i changed the "Directory for message files:" and did not know if i needed the trailing backslash. I deleted the hardware and the user variables it created and added the hardware again. Now it looks like it works without hanging.

But i have an error every 15 seconds in my logfile:
Error: Chromecast hardware (19) thread seems to have ended unexpectedly

And i'm not able to send a variable to the speaker. I hear it connects but then nothing happens. Which seems to be related to the hardware error.

Peter
RaspberryPI
ZWave
RFXtrx433E
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Ewaldharmsen »

PeterFleur wrote: Tuesday 22 January 2019 22:59 I had the same with the hanging of Domoticz while saving and it was because i changed the "Directory for message files:" and did not know if i needed the trailing backslash. I deleted the hardware and the user variables it created and added the hardware again. Now it looks like it works without hanging.

But i have an error every 15 seconds in my logfile:
Error: Chromecast hardware (19) thread seems to have ended unexpectedly

And i'm not able to send a variable to the speaker. I hear it connects but then nothing happens. Which seems to be related to the hardware error.

Peter
I have at least solved the trailing backslash problem in version 3.3.1.
The other problem I can't reproduce.

I have a test rpi, updated it to the latest version, installed the latest beta of Domoticz.
My plugin runs just fine
PeterFleur
Posts: 32
Joined: Sunday 08 March 2015 13:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.4739
Contact:

Re: Python Plugin: Chromecast

Post by PeterFleur »

It looks like I have the problem with all python plugins I install. Is there a way to debug python script? Cause when I start the script by ssh I do not get any output in the ssh of any failures.

Peter

Sent from my SM-G930F using Tapatalk

RaspberryPI
ZWave
RFXtrx433E
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest