Open JesseWebDotCom opened 7 years ago
I wonder what we pass in. Could you add a print(host)
before line 47 in dial.py
INFO:pychromecast:Querying device status
-----START PRINT HOST-----
192.168.1.70
-----STOP PRINT HOST-----
INFO:pychromecast:Querying device status
-----START PRINT HOST-----
192.168.1.252
-----STOP PRINT HOST-----
INFO:pychromecast:Querying device status
-----START PRINT HOST-----
192.168.1.3
-----STOP PRINT HOST-----
INFO:pychromecast:Querying device status
-----START PRINT HOST-----
192.168.1.26
-----STOP PRINT HOST-----
INFO:pychromecast:Querying device status
-----START PRINT HOST-----
192.168.1.212
-----STOP PRINT HOST-----
INFO:pychromecast:Querying device status
-----START PRINT HOST-----
192.168.1.2
-----STOP PRINT HOST-----
INFO:pychromecast:Querying device status
-----START PRINT HOST-----
192.168.1.25
-----STOP PRINT HOST-----
INFO:pychromecast:Querying device status
-----START PRINT HOST-----
192.168.1.7
-----STOP PRINT HOST-----
INFO:pychromecast:Querying device status
-----START PRINT HOST-----
192.168.1.9
-----STOP PRINT HOST-----
INFO:pychromecast:Querying device status
-----START PRINT HOST-----
192.168.1.10
-----STOP PRINT HOST-----
INFO:pychromecast:Querying device status
-----START PRINT HOST-----
b'\xfe\x80\x00\x00\x00\x00\x00\x00\xca*\x14\xff\xfe)\x1c\xfb'
-----STOP PRINT HOST-----
ERROR:homeassistant.components.media_player:Error while setting up platform cast
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/idna.py", line 167, in encode
raise UnicodeError("label too long")
UnicodeError: label too long
I tried returning "None" if evaluated as False by this function:
def valid_ip_or_name(s):
import re
if re.match("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", s):
return True
if re.match("^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$", s):
return True
return False
which avoided the UnicodeError and got me a little further but ultimately stopped here:
ERROR:pychromecast.socket_client:Failed to connect, retrying in 5.0s
WARNING:homeassistant.setup:Setup of media_player is taking over 10 seconds.
WARNING:homeassistant.components.media_player:Setup of platform cast is taking over 10 seconds.
So looks like the problem is with b'\xfe\x80\x00\x00\x00\x00\x00\x00\xca*\x14\xff\xfe)\x1c\xfb'
, can you try to find out where this host is being generated? It seems pretty random since all others are IPs.
I have 10 cast devices, which correlates to the 10 ip addresses listed above. however, I also have an Nvidia shield that shows up in the Google Home app as a cast device (along my 10 real cast devices). I'm going to check if the address you listed above is my shield. With that said, I guess you'll have to add logic to (detect and) reject or accept IPV6 addresses.
No luck, I turned off IPV6 on the shield, rebooted, and still the same error occurs. Any ideas on how I can determine which host has that address?
found it, it's my iMac. Going to test with ipv6 turned off on my iMac. (update: didn't help as I couldn't find a way to do it - even setting ipv6 to local link)
OK, turns out it was caused by this product: https://www.airserver.com
which allows your iMac to act as an airplay, miracast, and chrome cast client. Once I turned it off, HA started and recognized all cast audio devices as expected.
If you want to add support for ipv6 and or this app, let me know and I can test any code updates you want.
Even though not many people have devices with IPv6 link-local addresses in their homes, it might be good for pychromecast to either just ignore them or support them and not just throw an exception. Ignoring them would be very easy - just check whether encoding works or something like that. Supporting them in dial.py would probably not be that much more difficult, because the requests library can handle urls like http://[fe80::ca2a:14ff:fe29:1cfb]/setup/eureka_info
(notice the square brackets).
Reproduced the error with brand new, minimal HA OS X install (version 0.43.0). I have been experiencing this issue for many months on my pi3 but am using OS X to help give you a clean environment where I can implement any debugging you require.
I factory reset all my chrome cast devices and configured only 1 (named "LivingRoom"). I used a minimal HA config with discovery off and only:
(I've also tested with discovery on)
HA developer tools | about displays:
Console output while HA starts is: