Core: Errors with ChromeCast Audio.

Created on 8 Sep 2016  路  42Comments  路  Source: home-assistant/core

Home Assistant release (hass --version):
0.28.0.dev0

Python release (python3 --version):
Python 3.4.2

Component/platform:
cast

Description of problem:
When launching HASS, there seems to be socket errors and it adds a significant amount of time to the loading before erroring out.

Expected:

Problem-relevant configuration.yaml entries and steps to reproduce:

media_player:
  platform: cast

Traceback (if applicable):


Exception ignored in: <bound method Chromecast.__del__ of Chromecast('192.168.10.110', port=8009, device=None)>
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/__init__.py", line 407, in __del__
    self.socket_client.stop.set()
AttributeError: 'Chromecast' object has no attribute 'socket_client'
Exception ignored in: <bound method Chromecast.__del__ of Chromecast('192.168.10.110', port=42425, device=None)>
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/__init__.py", line 407, in __del__
    self.socket_client.stop.set()
AttributeError: 'Chromecast' object has no attribute 'socket_client'

Additional info:

bug component regression

All 42 comments

I am also getting similar errors and may be it will help narrow down the cause:

16-09-07 14:16:51 pychromecast.socket_client: Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 233, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
socket.timeout: timed out
16-09-07 16:27:55 pychromecast.socket_client: Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 233, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
socket.timeout: timed out

Additionally, when chromeccasts do show up (this is not consistent), I see double entries. (See below)
image

I've also been getting this since a couple of days, can't use my Chromecast automations anymore :(

I know lists of these errors go back to early March but I never saw them until I bought a Google Home and updated my Chromecast app to the Home app. I'm wondering if it's related in any way, like a firmware update.

This is preventing HA from even starting - even after a clean OS and HASS install

Still getting these in .34.3

16-12-06 16:55:46 pychromecast.socket_client: Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 831, in _real_connect
    self.do_handshake()
  File "/usr/lib/python3.4/ssl.py", line 804, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

I wonder if error trapping the IP it's trying to connect to would tell us if it is limited to one or more devices?

I also saw this later in the logs:

16-12-06 17:07:25 pychromecast.socket_client: Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
ConnectionRefusedError: [Errno 111] Connection refused
16-12-06 17:21:05 homeassistant.core: Error doing job: Fatal write error on SSL transport
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/selector_events.py", line 858, in _write_ready
    n = self._sock.send(self._buffer)
  File "/usr/lib/python3.4/ssl.py", line 678, in send
    v = self._sslobj.write(data)
TimeoutError: [Errno 110] Connection timed out
16-12-06 17:22:18 homeassistant.core: Error doing job: Fatal write error on SSL transport
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/selector_events.py", line 858, in _write_ready
    n = self._sock.send(self._buffer)
  File "/usr/lib/python3.4/ssl.py", line 678, in send
    v = self._sslobj.write(data)
TimeoutError: [Errno 110] Connection timed out

Still broken - did a raspbian reinstall, ran the hass all in one installed, updated everything, disabled discovery, confirmed hass was working and then added 1 chomecast audio IP address to my config, restarted hass, and then it is unable to restart:
16-12-10 12:09:52 zeroconf: Unknown error, possibly benign: OSError('packed IP wrong length for inet_ntoa',) Traceback (most recent call last): File "/home/hass/.homeassistant/deps/zeroconf.py", line 430, in __repr__ return socket.inet_ntoa(self.address) OSError: packed IP wrong length for inet_ntoa 16-12-10 12:10:37 pychromecast.socket_client: Failed to connect, retrying in 5.000000s Traceback (most recent call last): File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection self.socket.connect((self.host, self.port)) File "/usr/lib/python3.4/ssl.py", line 840, in connect self._real_connect(addr, False) File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect socket.connect(self, addr) socket.timeout: timed out

Still broken.

My idea was to switch from domoticz to HA and this was the first thing I encountered.

Mine is working now - I think what fixed it was deleting of all groups. Try it

By groups I mean within the google home app you can group multiple chromecast to create one virtual chromecast.

Trying this now; will report back.

That seems to be it, nice find @JesseWebDotCom! Been about an hour and not getting any of the connection errors. Perhaps PyChromecast has not been updated to recognize the difference between groups and devices?

I don't see the group option in the iOS app. Are you using the Android version?

I am using Android. If you don't see a group in your device list, then you don't have one set up.

https://support.google.com/chromecastbuiltin/answer/6328691?hl=en&ref_topic=6372841

I don't have groups....yet I see these errors. Note that I don't have chromecast audio...I have the regular cast devices (may be I should file a separate bug, if it is unrelated to this error).

16-12-29 17:56:06 pychromecast.socket_client: Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
socket.timeout: timed out
16-12-29 17:56:06 pychromecast.socket_client: Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
socket.timeout: timed out

Yeah, sadly this didn't work. Still getting the issue showing in my logs. I'm wondering if it has to do with my new Vizio UHD TV with the Chromecast built in.

Had the same (failed to connect) issues where HA was trying to locate a Chromecast in my house.
Still, after removing the Chromecast from my configuration I was getting these errors. It looks like HA was still looking the device.
Now, after disabling Chromecast on my television the errors are gone.
Looking more closely at the timings, I noticed the errors were appearing after the TV was switched off.

This confirms my suspicions about the TV being the issue in my case. My polling errors also correspond to times when the TV was off, which is part of the reason I suspected it.

If we can get a few more people to confirm, it may be worth bringing @balloob into the conversation.

@rpitera Not sure I follow you completely here. I can confirm that I get those pychromecast errors when my TV (where Cast is plugged in) is turned off.

I can't use any of my Chromecasts. The HASS startup stalls on this error everytime I add a Chromecast to my config:

17-01-02 21:19:48 pychromecast.socket_client: Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
OSError: [Errno 113] No route to host

My 2 cents:

  1. Disable "discovery" in your ha config
  2. in the google home app, delete all chromecast groups and devices
  3. Take all your chromecast offline
  4. Add a chromecast device manually to the media_player section, bring that device online, reboot home assistant, and see if everything is ok
  5. Repeat the above to find the offending device or configuration

Things I'm pretty sure messed mine up:

  • having discovery enabled
  • having chromecast groups

Things it looks like also messes up other people:

  • chromecast integrated into devices (like TV's)

I think this is a good summary of the issues and what might be contributing to it. It looks like there may be more than one issue at hand. I never had the issues until I added a TV with built in Chromecast, so that definitely seems to be at least ONE of the issues.

I think the issue is also present when the TV where the Chromecast (non-integrated) is plugged-in is turned off.

Is your CC plugged into an AC adapter, or are you using the USB port in the TV to power it? If it's the latter, then that would make sense.

I am using the USB port to power the Chromecast....may be that explains.

Try moving it over to a regular USB to AC adapter if at all possible, wait a few minutes for the CC to fully initialize and then see if your errors go away after restarting HA.

My issue is occurring with Chromecasts and Chromecast Audios, all powered by AC adapters (at least the ones I'm trying to manually add to HA for now). Haven't followed ALL of the suggestions @JesseWebDotCom suggested, but it shouldn't be this difficult of a process.

Got the same problem: https://github.com/home-assistant/home-assistant/issues/5273
The Chromecast I'm adding is nto autodiscovered and built-in to a Sony Bravia TV.
Normally the Chromecast would still be available while the TV is in standby.
Now all of a sudden not anymore.

======== edit =========
Fixed my own problem. I removed the pi-hole from my network, and my tv was still pointing at it and thus didn't have a proper internet connection. That's why HA failed connecting to it.
Still think that this error shouldn't stop HA from loading though.

I think we need to include @balloob in this conversation.

Seeing these errors here too:

17-01-20 04:51:47 pychromecast.socket_client: Heartbeat timeout, resetting connection
17-01-20 04:51:50 pychromecast.socket_client: Heartbeat timeout, resetting connection
17-01-20 04:51:52 pychromecast.socket_client: Heartbeat timeout, resetting connection
17-01-20 04:51:57 pychromecast.socket_client: Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 831, in _real_connect
    self.do_handshake()
  File "/usr/lib/python3.4/ssl.py", line 804, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer
17-01-20 04:51:59 pychromecast.socket_client: Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 831, in _real_connect
    self.do_handshake()
  File "/usr/lib/python3.4/ssl.py", line 804, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

At the time of these particular errors, everyone in this household was asleep so none of the Chromecasts were being used.

I'm running version 0.36.1 of Home Assistant, but I have been seeing these errors for a long time. I have 2 audio Chromecasts and 1 regular Chromecast, all plugged into power outlets.

And to exclude a theory: I currently have my 2 audio Chromecast in a group in the Google Home app, but I was seeing these errors prior to making the group as well.

So just to clarify, all of your Cast devices are constantly powered and on?

@rpitera Correct!

Thanks. Just trying to gather enough data for someone to look into this.

Was just looking around and saw this message on the original Pychromecast library. Looks like replacing

except socket.error:

by

except (socket.error,OSError):

solves this problem. I wonder why @balloob did not make the change to the original library. May be a python expert can throw some light on it...

In Python version >=3.3, socket.error is an alias for OSError: https://docs.python.org/3/library/socket.html#socket.error

Since the pychromecast library is supposed to be Python 2-compatible it makes sense to add OSError to the except-clause. In Python 2, socket.error is a subclass of IOError: https://docs.python.org/2/library/socket.html#socket.error.

(Not sure how this explains the original error however, since HA requires Python 3.4 anyway.)

I am also experiencing this error. I have a Cast that's not powered through tv usb-port, and also an Nvidia Shield that has built in cast.

@isabellaalstrom - is your Shield set to sleep or is the device set to always on? I just got one and the default is to sleep. I set mine to always powered on as I also run an FTP server on it and I am now only getting the on my Vizio TV. When I added the Shield to the mix I was getting the errors more frequently.

@rpitera It is set to go to sleep. Should I turn that feature off so that it's always on?

Here are one of my many log-files:
https://hastebin.com/uxosidugod.sql

I just finished running simultaneous ping commands (during just over 2 hours) to the 3 Chromecast units I have integrated into Home Assistant: 2 Chromecast Audio units and a regular Chromecast unit. All the units are connected to a power outlet.
The tests were run over wi-fi from my MacBook Pro, so not from my Raspberry Pi 3 running Home Assistant. I figured this wouldn't matter as a drop in the wifi connection would show in all 3 tests, and the Chromecast units connect over wi-fi anyway.

I used the following command to include timestamps so I could link dropped packets to errors in the Home Assistant log:

ping xxx.xxx.xxx.xx | while read pong; do echo "$(date): $pong"; done
  1. The connection to the regular Chromecast unit, connected to my TV in the living room, was stable aside from a single dropped packet here and there. No errors could be found in the Home Assistant log when those single dropped packets occured.

  2. The connection to the Chromecast Audio unit behind the TV cabinet showed the following interruption:

wo  8 feb 2017 04:03:20 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=3554 ttl=64 time=5.506 ms
wo  8 feb 2017 04:03:21 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=3555 ttl=64 time=6.381 ms
wo  8 feb 2017 04:03:22 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=3556 ttl=64 time=3.096 ms
wo  8 feb 2017 04:03:24 CET: Request timeout for icmp_seq 3557
wo  8 feb 2017 04:03:25 CET: Request timeout for icmp_seq 3558
wo  8 feb 2017 04:03:26 CET: Request timeout for icmp_seq 3559
wo  8 feb 2017 04:03:27 CET: Request timeout for icmp_seq 3560
wo  8 feb 2017 04:03:28 CET: Request timeout for icmp_seq 3561
wo  8 feb 2017 04:03:29 CET: Request timeout for icmp_seq 3562
wo  8 feb 2017 04:03:30 CET: Request timeout for icmp_seq 3563
wo  8 feb 2017 04:03:31 CET: Request timeout for icmp_seq 3564
wo  8 feb 2017 04:03:32 CET: Request timeout for icmp_seq 3565
wo  8 feb 2017 04:03:33 CET: Request timeout for icmp_seq 3566
wo  8 feb 2017 04:03:34 CET: Request timeout for icmp_seq 3567
wo  8 feb 2017 04:03:35 CET: Request timeout for icmp_seq 3568
wo  8 feb 2017 04:03:36 CET: Request timeout for icmp_seq 3569
wo  8 feb 2017 04:03:37 CET: Request timeout for icmp_seq 3570
wo  8 feb 2017 04:03:38 CET: Request timeout for icmp_seq 3571
wo  8 feb 2017 04:03:39 CET: Request timeout for icmp_seq 3572
wo  8 feb 2017 04:03:40 CET: Request timeout for icmp_seq 3573
wo  8 feb 2017 04:03:41 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=3574 ttl=64 time=893.752 ms
wo  8 feb 2017 04:03:41 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=3575 ttl=64 time=3.182 ms
wo  8 feb 2017 04:03:42 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=3576 ttl=64 time=16.078 ms

This interruption caused the following errors in the Home Assistant log:

17-02-08 04:03:32 WARNING (Thread-17) [pychromecast.socket_client] Heartbeat timeout, resetting connection
17-02-08 04:03:36 WARNING (Thread-18) [pychromecast.socket_client] Heartbeat timeout, resetting connection
17-02-08 04:03:36 WARNING (Thread-16) [pychromecast.socket_client] Heartbeat timeout, resetting connection
17-02-08 04:03:40 ERROR (Thread-17) [pychromecast.socket_client] Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
ConnectionRefusedError: [Errno 111] Connection refused
17-02-08 04:03:43 ERROR (Thread-18) [pychromecast.socket_client] Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
ConnectionRefusedError: [Errno 111] Connection refused
17-02-08 04:03:43 ERROR (Thread-16) [pychromecast.socket_client] Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
ConnectionRefusedError: [Errno 111] Connection refused
  1. Finally, the connection to the Chromecast Audio unit in my office showed a similar interruption 30 minutes earlier:
wo  8 feb 2017 03:33:28 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=1767 ttl=64 time=5.661 ms
wo  8 feb 2017 03:33:29 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=1768 ttl=64 time=5.987 ms
wo  8 feb 2017 03:33:30 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=1769 ttl=64 time=4.410 ms
wo  8 feb 2017 03:33:32 CET: Request timeout for icmp_seq 1770
wo  8 feb 2017 03:33:33 CET: Request timeout for icmp_seq 1771
wo  8 feb 2017 03:33:35 CET: Request timeout for icmp_seq 1772
wo  8 feb 2017 03:33:35 CET: Request timeout for icmp_seq 1773
wo  8 feb 2017 03:33:37 CET: Request timeout for icmp_seq 1774
wo  8 feb 2017 03:33:38 CET: Request timeout for icmp_seq 1775
wo  8 feb 2017 03:33:39 CET: Request timeout for icmp_seq 1776
wo  8 feb 2017 03:33:40 CET: Request timeout for icmp_seq 1777
wo  8 feb 2017 03:33:41 CET: Request timeout for icmp_seq 1778
wo  8 feb 2017 03:33:42 CET: Request timeout for icmp_seq 1779
wo  8 feb 2017 03:33:43 CET: Request timeout for icmp_seq 1780
wo  8 feb 2017 03:33:44 CET: Request timeout for icmp_seq 1781
wo  8 feb 2017 03:33:45 CET: Request timeout for icmp_seq 1782
wo  8 feb 2017 03:33:46 CET: Request timeout for icmp_seq 1783
wo  8 feb 2017 03:33:47 CET: Request timeout for icmp_seq 1784
wo  8 feb 2017 03:33:48 CET: Request timeout for icmp_seq 1785
wo  8 feb 2017 03:33:49 CET: Request timeout for icmp_seq 1786
wo  8 feb 2017 03:33:50 CET: Request timeout for icmp_seq 1787
wo  8 feb 2017 03:33:50 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=1787 ttl=64 time=1298.176 ms
wo  8 feb 2017 03:33:50 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=1788 ttl=64 time=289.202 ms
wo  8 feb 2017 03:33:51 CET: 64 bytes from xxx.xxx.xxx.xx: icmp_seq=1789 ttl=64 time=32.619 ms

Once again, this interruption caused errors in the Home Assistant log:

17-02-08 03:33:45 WARNING (Thread-23) [pychromecast.socket_client] Heartbeat timeout, resetting connection
17-02-08 03:33:48 WARNING (Thread-21) [pychromecast.socket_client] Heartbeat timeout, resetting connection
17-02-08 03:33:49 WARNING (Thread-19) [pychromecast.socket_client] Heartbeat timeout, resetting connection
17-02-08 03:33:49 ERROR (Thread-23) [pychromecast.socket_client] Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
ConnectionRefusedError: [Errno 111] Connection refused
17-02-08 03:33:49 ERROR (Thread-21) [pychromecast.socket_client] Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
ConnectionRefusedError: [Errno 111] Connection refused
17-02-08 03:33:49 ERROR (Thread-19) [pychromecast.socket_client] Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
ConnectionRefusedError: [Errno 111] Connection refused
17-02-08 03:33:50 WARNING (Thread-20) [pychromecast.socket_client] Heartbeat timeout, resetting connection
17-02-08 03:33:50 ERROR (Thread-20) [pychromecast.socket_client] Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
ConnectionRefusedError: [Errno 111] Connection refused
17-02-08 03:33:50 WARNING (Thread-22) [pychromecast.socket_client] Heartbeat timeout, resetting connection
17-02-08 03:33:50 WARNING (Thread-24) [pychromecast.socket_client] Heartbeat timeout, resetting connection
17-02-08 03:33:50 ERROR (Thread-22) [pychromecast.socket_client] Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
ConnectionRefusedError: [Errno 111] Connection refused
17-02-08 03:33:50 ERROR (Thread-24) [pychromecast.socket_client] Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/pychromecast/socket_client.py", line 239, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
ConnectionRefusedError: [Errno 111] Connection refused

So it seems Chromecast (Audio?) units can temporarily lose their connection or become unavailable, for whatever reason. The Chromecast component might require changes to handle this better. Personally, I can live with the warnings but the errors are a bit excessive. They flood my Home Assistant log and make it hard to spot other errors that might require attention.

I hope this helps 馃

@isabellaalstrom - It's worth trying out.
@fanaticDavid - Nice work! I'll try testing my CCA as well.

The errors indeed flood the logs. It would be nice to see an option to disable the logging.

I'm not sure why this issue was closed, but the traceback in the Home Assistant log (see above) might be gone after the next release thanks to PR #6702, bumping PyChromecast to version 0.8.1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sogeniusio picture sogeniusio  路  3Comments

coolriku picture coolriku  路  3Comments

bdraco picture bdraco  路  3Comments

aweb-01 picture aweb-01  路  3Comments

Elmardus picture Elmardus  路  3Comments