googlecontroller icon indicating copy to clipboard operation
googlecontroller copied to clipboard

Error on connexion

Open geraldhuguenin opened this issue 2 years ago • 6 comments
trafficstars

Hello, When I run a simple code to connect to Google Home Audio, I receive this msg

"Some sort of error occured most likely a bad connection or ip adress"

Have you an idea to solve this problem ? Thank you for your help... and your job.

My code :

#!/usr/bin/env python3

-- coding: utf-8 --

Test envoi données sur Google Home

import time import urllib from googlecontroller import GoogleAssistant IP = "192.168.1.129" GH = GoogleAssistant(host=IP) #Lecture des paramètres météo vent

text_GH="Les conditions de vent sont les suivantes : vitesse moyenne :"

My OS : "Raspbian GNU/Linux 11 (bullseye)" and Python 3.9.2

And when I run it on an old version (Raspbian 9) with Python 3.9.1 all is OK and the ***.say("Test") sounds on my Google Nest. Is it a problem of lib ?

geraldhuguenin avatar Dec 16 '22 14:12 geraldhuguenin

I found a workaround : in the ../python3.9/dist-packages/googlecontroller/init.py I change the line 26 by : if host != None: chromecasts, browser = pychromecast.get_listed_chromecasts(friendly_names=[host]) self.cc = chromecasts[0] else: And I call the device by is name and not by is IP :

import time import urllib from googlecontroller import GoogleAssistant #from googlecontroller.http_server import serve_file # for local files Name = "Bureau" GH = GoogleAssistant(host= Name) #Lecture des paramètres météo vent

text_GH="Les conditions de vent sont les suivantes : vitesse moyenne :"

GH.say(text_GH, lang="fr")

geraldhuguenin avatar Dec 22 '22 19:12 geraldhuguenin

sorry "__init.py"

geraldhuguenin avatar Dec 22 '22 19:12 geraldhuguenin

I'm running into the same issue, unfortunately

jtfrandsen avatar Mar 04 '23 07:03 jtfrandsen

This was my fix. I used debian 10 and the python3 with a requirement.txt file. All in a Docker file.

The contents is.

asn1crypto==0.24.0 casttube==0.2.1 certifi==2020.12.5 chardet==4.0.0 cryptography==2.6.1 entrypoints==0.3 googlecontroller==3.0.6 idna==2.10 ifaddr==0.1.7 keyring==17.1.1 keyrings.alt==3.1.1 Mako==1.0.7 Markdown==3.0.1 MarkupSafe==1.1.0 protobuf==3.15.7 PyChromecast==9.1.1 pycrypto==2.6.1 Pygments==2.3.1 PyGObject==3.30.4 pyxdg==0.25 PyYAML==3.13 requests==2.25.1 SecretStorage==2.3.1 six==1.12.0 urllib3==1.26.4 zeroconf==0.29.0

peterd550 avatar Mar 04 '23 08:03 peterd550

Yes, that fixed it for me. Specifically it was PyChromecast and protobuf that were causing version conflicts. Thanks so much!

I used sudo pip install 'PyChromecast==9.1.1' --force-reinstall and sudo pip install 'protobuf==3.15.7' --force-reinstall to fix the two packages I was having trouble with.

jtfrandsen avatar Mar 04 '23 15:03 jtfrandsen

Are you using docker containers? Works on everyone's machine 😄 Well almost lol

peterd550 avatar Mar 04 '23 16:03 peterd550