Python Plugin: Chromecast Topic is solved

Python and python framework

Moderator: leecollings

User avatar
Dnpwwo
Posts: 819
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 »

@Ewaldharmsen,

I couldn't get 'Chromecast.start()' to work either in my plugin and could not work it out.

I used 'Chromecast.socket_client.start()' instead and it did the trick. Still don't know why though...
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
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Ewaldharmsen »

Dnpwwo wrote: Tuesday 26 March 2019 10:58 @Ewaldharmsen,

I couldn't get 'Chromecast.start()' to work either in my plugin and could not work it out.

I used 'Chromecast.socket_client.start()' instead and it did the trick. Still don't know why though...
I think the best thing you can do is:
sudo rm -r /home/pi/domoticz/plugins/ChromecastPlugin/
sudo pip3 uninstall pychromecast
cd domoticz/plugins
git clone https://github.com/Tsjippy/ChromecastPlugin
sudo pip3 install pychromecast
sudo pip3 show pychromecast

make sure cd /usr/local/lib/python3.5/dist-packages/pychromecast/ exists.
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 »

something is still going wrong after reinstall, these are the switches it made:
Image
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
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: Tuesday 26 March 2019 15:38 something is still going wrong after reinstall, these are the switches it made:
Image
You have made a paste error. I think you used
cd /usr/local/lib/python3.5/dist-packages/pychromecast/
as a Chromecasts name in hardware settings
wvries
Posts: 28
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: Tuesday 26 March 2019 11:04
Dnpwwo wrote: Tuesday 26 March 2019 10:58 @Ewaldharmsen,

I couldn't get 'Chromecast.start()' to work either in my plugin and could not work it out.

I used 'Chromecast.socket_client.start()' instead and it did the trick. Still don't know why though...
I think the best thing you can do is:
sudo rm -r /home/pi/domoticz/plugins/ChromecastPlugin/
sudo pip3 uninstall pychromecast
cd domoticz/plugins
git clone https://github.com/Tsjippy/ChromecastPlugin
sudo pip3 install pychromecast
sudo pip3 show pychromecast

make sure cd /usr/local/lib/python3.5/dist-packages/pychromecast/ exists.
followed the instructions and when enabling the plugin, again it starts respawning.

Code: Select all

ps -ef | grep domoticz
root       690     1 16 15:48 ?        00:00:16 /home/pi/domoticz/domoticz -daemon -www 8900 -sslwww 443
root       912   690  0 15:48 ?        00:00:00 /home/pi/domoticz/domoticz -daemon -www 8900 -sslwww 443
root      1259   690  0 15:49 ?        00:00:00 /home/pi/domoticz/domoticz -daemon -www 8900 -sslwww 443
When disabling the plugin, it does disconnect from the devices with the following info:
2019-03-26 15:50:18.088 (Chromecast) Setting device 22 as timed out
2019-03-26 15:50:18.091 (Chromecast) Setting device 23 as timed out
2019-03-26 15:50:18.097 (Chromecast) Setting device 24 as timed out
2019-03-26 15:50:18.101 Status: (Chromecast) Disconnecting from 'Living Room speaker'
2019-03-26 15:50:23.078 (Chromecast) 'Living Room speaker' is disconnected.
2019-03-26 15:50:23.078 (Chromecast) Setting device 51 as timed out
2019-03-26 15:50:23.079 Status: (Chromecast) Disconnecting from 'Living Room mini'
2019-03-26 15:50:23.078 Error: (Chromecast) Error on line 846 Error is 6
2019-03-26 15:50:27.472 (Chromecast) 'Living Room mini' is disconnected.
2019-03-26 15:50:27.472 (Chromecast) Setting device 41 as timed out
2019-03-26 15:50:27.472 Status: (Chromecast) Disconnecting from 'Living Room TV'
2019-03-26 15:50:27.472 Error: (Chromecast) Error on line 846 Error is 5
2019-03-26 15:50:32.261 (Chromecast) 'Living Room TV' is disconnected.

but also see the following error in the log:

Code: Select all

2019-03-26 15:50:12.350 Error: (Chromecast) Error on line 846 Error is 8
2019-03-26 15:50:23.078 Error: (Chromecast) Error on line 846 Error is 6
2019-03-26 15:50:27.472 Error: (Chromecast) Error on line 846 Error is 5
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Ewaldharmsen »

can you update to version 4.0.1?
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 »

Ewaldharmsen wrote: Tuesday 26 March 2019 15:52
snellejellep wrote: Tuesday 26 March 2019 15:38 something is still going wrong after reinstall, these are the switches it made:
Image
You have made a paste error. I think you used
cd /usr/local/lib/python3.5/dist-packages/pychromecast/
as a Chromecasts name in hardware settings
my bad... indeed i did that wrong.
now it shows all my devices and it seems to work. thank you!
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
wvries
Posts: 28
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: Tuesday 26 March 2019 15:59 can you update to version 4.0.1?
git pull => Already up to date.
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Ewaldharmsen »

Can you post your version info?
Python, Domoticz etc.
wvries
Posts: 28
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: Tuesday 26 March 2019 16:16 Can you post your version info?
Python, Domoticz etc.
HW: RPI3+ (With SSD)
Domoticz 4.10572
Python 3.5.3
OS: Raspbian GNU/Linux 9 (stretch) - last update yesterday
Other (external) plugins:
- Domoticz-Tuya-SmartBulb-Plugin
- Zigbee2MQTT

Update:
I see also increasing number of PluginMgr processes started / running when I have the problem.
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: Tuesday 26 March 2019 16:23
Ewaldharmsen wrote: Tuesday 26 March 2019 16:16 Can you post your version info?
Python, Domoticz etc.
HW: RPI3+ (With SSD)
Domoticz 4.10572
Python 3.5.3
OS: Raspbian GNU/Linux 9 (stretch) - last update yesterday
Other (external) plugins:
- Domoticz-Tuya-SmartBulb-Plugin
- Zigbee2MQTT

Update:
I see also increasing number of PluginMgr processes started / running when I have the problem.
Strange I have the same versions. Can you try disabling the other plugins and removing and reinstalling the Chromecasts plugin?
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 »

@Ewald

Reinstalled the plugin and now it is running like never before. Thanks a lot.

Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk

peterenderest
Posts: 4
Joined: Tuesday 26 March 2019 20:35
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Chromecast

Post by peterenderest »

Hi ,

I have installed the chromecast plugin and I get the error below. In this chat about this topic, I saw the advice to de-install and re-install, but it does not help unfortunatelly.
Does anybody has an idea to solve this problem?

2019-03-27 08:01:09.328 Status: (Chromecast devices) Started.
2019-03-27 08:01:09.612 Error: (Chromecast) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/ChromecastPlugin/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2019-03-27 08:01:09.612 Error: (Chromecast devices) Module Import failed, exception: 'ImportError'
2019-03-27 08:01:09.613 Error: (Chromecast devices) Module Import failed: ' Name: requests'
2019-03-27 08:01:09.613 Error: (Chromecast devices) Error Line details not available

Version info:
Domoticz v.9700 on Raspberry pi
Python 3.5.3
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Ewaldharmsen »

peterenderest wrote: Wednesday 27 March 2019 8:10 Hi ,

I have installed the chromecast plugin and I get the error below. In this chat about this topic, I saw the advice to de-install and re-install, but it does not help unfortunatelly.
Does anybody has an idea to solve this problem?

2019-03-27 08:01:09.328 Status: (Chromecast devices) Started.
2019-03-27 08:01:09.612 Error: (Chromecast) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/ChromecastPlugin/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2019-03-27 08:01:09.612 Error: (Chromecast devices) Module Import failed, exception: 'ImportError'
2019-03-27 08:01:09.613 Error: (Chromecast devices) Module Import failed: ' Name: requests'
2019-03-27 08:01:09.613 Error: (Chromecast devices) Error Line details not available

Version info:
Domoticz v.9700 on Raspberry pi
Python 3.5.3
sudo pip3 install requests
peterenderest
Posts: 4
Joined: Tuesday 26 March 2019 20:35
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Chromecast

Post by peterenderest »

Ewaldharmsen wrote: Wednesday 27 March 2019 8:24
peterenderest wrote: Wednesday 27 March 2019 8:10 Hi ,

I have installed the chromecast plugin and I get the error below. In this chat about this topic, I saw the advice to de-install and re-install, but it does not help unfortunatelly.
Does anybody has an idea to solve this problem?

2019-03-27 08:01:09.328 Status: (Chromecast devices) Started.
2019-03-27 08:01:09.612 Error: (Chromecast) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/ChromecastPlugin/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2019-03-27 08:01:09.612 Error: (Chromecast devices) Module Import failed, exception: 'ImportError'
2019-03-27 08:01:09.613 Error: (Chromecast devices) Module Import failed: ' Name: requests'
2019-03-27 08:01:09.613 Error: (Chromecast devices) Error Line details not available

Version info:
Domoticz v.9700 on Raspberry pi
Python 3.5.3
sudo pip3 install requests
@Ewaldharmsen thanks for your reply!, I tried this, but get the following message: Requirement already satisfied: requests in /usr/lib/python3/dist-packages

Do I have to include this in the python path? And if yes, how do I do this?
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Ewaldharmsen »

You should update to the latest Domoticz beta version
peterenderest
Posts: 4
Joined: Tuesday 26 March 2019 20:35
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Chromecast

Post by peterenderest »

Ewaldharmsen wrote: Wednesday 27 March 2019 20:16 You should update to the latest Domoticz beta version
Thanks! It works now smoothly!
Tobbo
Posts: 13
Joined: Monday 08 October 2018 13:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Tobbo »

Keep getting this error. It is like the attribute start has been removed or something?

2019-04-01 19:15:54.807 Status: (Chromecast) Found these chromecasts: 'Google Home Mini', 'Chromecast'
2019-04-01 19:15:54.808 Error: (Chromecast) Error on line 556 Error is 'Chromecast' object has no attribute 'start'

Domo version V4.10590 (I beleive I'm on beta? :roll: :lol: )

Any ideas?
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Ewaldharmsen »

Tobbo wrote: Monday 01 April 2019 19:18 Keep getting this error. It is like the attribute start has been removed or something?

2019-04-01 19:15:54.807 Status: (Chromecast) Found these chromecasts: 'Google Home Mini', 'Chromecast'
2019-04-01 19:15:54.808 Error: (Chromecast) Error on line 556 Error is 'Chromecast' object has no attribute 'start'

Domo version V4.10590 (I beleive I'm on beta? :roll: :lol: )

Any ideas?
you have to update PyChromecast:

Code: Select all

sudo pip3 uninstall PyChromecast

Code: Select all

sudo pip3 install PyChromecast
Tobbo
Posts: 13
Joined: Monday 08 October 2018 13:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Chromecast

Post by Tobbo »

Ewaldharmsen wrote: Monday 01 April 2019 20:04
Tobbo wrote: Monday 01 April 2019 19:18 Keep getting this error. It is like the attribute start has been removed or something?

2019-04-01 19:15:54.807 Status: (Chromecast) Found these chromecasts: 'Google Home Mini', 'Chromecast'
2019-04-01 19:15:54.808 Error: (Chromecast) Error on line 556 Error is 'Chromecast' object has no attribute 'start'

Domo version V4.10590 (I beleive I'm on beta? :roll: :lol: )

Any ideas?
you have to update PyChromecast:

Code: Select all

sudo pip3 uninstall PyChromecast

Code: Select all

sudo pip3 install PyChromecast
First of all, thank you for a very quick answer.
So after following your instructions and also restarting the domoticz service, things started to work, BUT, I'm getting some new errors regarding spotify it seems.
Spoiler: show

Code: Select all

2019-04-01 20:16:52.105 Error: (Chromecast) Error on line 241 Error is 'Spotify' object has no attribute 'current_user_playing_track'

2019-04-01 20:17:01.671 Error: (Chromecast) 'onHeartbeat' failed 'AttributeError':''Spotify' object has no attribute 'current_user_playing_track''.
2019-04-01 20:17:01.675 Error: (Chromecast) ----> Line 786 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:17:01.675 Error: (Chromecast) ----> Line 400 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:17:12.309 Error: (Chromecast) 'onHeartbeat' failed 'AttributeError':''Spotify' object has no attribute 'current_user_playing_track''.
2019-04-01 20:17:12.314 Error: (Chromecast) ----> Line 786 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:17:12.314 Error: (Chromecast) ----> Line 400 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:17:22.490 Error: (Chromecast) 'onHeartbeat' failed 'AttributeError':''Spotify' object has no attribute 'current_user_playing_track''.
2019-04-01 20:17:22.494 Error: (Chromecast) ----> Line 786 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:17:22.494 Error: (Chromecast) ----> Line 400 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat

2019-04-01 20:20:00.219 Error: (Chromecast) 'onHeartbeat' failed 'AttributeError':''Spotify' object has no attribute 'current_user_playing_track''.
2019-04-01 20:20:00.223 Error: (Chromecast) ----> Line 786 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:20:00.223 Error: (Chromecast) ----> Line 400 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:20:10.425 Error: (Chromecast) 'onHeartbeat' failed 'AttributeError':''Spotify' object has no attribute 'current_user_playing_track''.
2019-04-01 20:20:10.428 Error: (Chromecast) ----> Line 786 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:20:10.428 Error: (Chromecast) ----> Line 400 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:20:20.659 Error: (Chromecast) 'onHeartbeat' failed 'AttributeError':''Spotify' object has no attribute 'current_user_playing_track''.
2019-04-01 20:20:20.662 Error: (Chromecast) ----> Line 786 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:20:20.662 Error: (Chromecast) ----> Line 400 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:20:30.871 Error: (Chromecast) 'onHeartbeat' failed 'AttributeError':''Spotify' object has no attribute 'current_user_playing_track''.
2019-04-01 20:20:30.874 Error: (Chromecast) ----> Line 786 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:20:30.874 Error: (Chromecast) ----> Line 400 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:20:41.083 Error: (Chromecast) 'onHeartbeat' failed 'AttributeError':''Spotify' object has no attribute 'current_user_playing_track''.
2019-04-01 20:20:41.087 Error: (Chromecast) ----> Line 786 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:20:41.087 Error: (Chromecast) ----> Line 400 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:20:51.309 Error: (Chromecast) 'onHeartbeat' failed 'AttributeError':''Spotify' object has no attribute 'current_user_playing_track''.
2019-04-01 20:20:51.313 Error: (Chromecast) ----> Line 786 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
2019-04-01 20:20:51.313 Error: (Chromecast) ----> Line 400 in '/home/pi/domoticz/plugins/ChromecastPlugin/plugin.py', function onHeartbeat
 
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest