core: pychromecast.error.NotConnected: Chromecast x.x.x.x:yyyy is connecting...

Home Assistant release with the issue:

many, currently i’m on 0.98.4

Last working Home Assistant release (if known): None

Operating environment (Hass.io/Docker/Windows/etc.):

Component/platform:

https://www.home-assistant.io/components/cast/

Description of problem:

Constantly getting: pychromecast.error.NotConnected: Chromecast x.x.x.x:8009 is connecting...

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant): Don’t believe there is anything in my config to control this; autodiscovery of cast devices is used to control ?

tts:
  - platform: google_translate
    service_name: google_say

logger:
  default: info
  logs:
    homeassistant.components.cast: debug
    homeassistant.components.cast.media_player: debug
    homeassistant.component.life360: debug
    homeassistant.component.life360.device_tracker: debug
    pychromecast: debug
    pychromecast.discovery: debug
    pychromecast.socket_client: debug

Traceback (if applicable):

Traceback (most recent call last):
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/homeassistant/components/tts/__init__.py", line 165, in async_say_handle
    DOMAIN_MP, SERVICE_PLAY_MEDIA, data, blocking=True
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 210, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 349, in entity_service_call
    future.result()  # pop exception if have
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 373, in _handle_service_platform_call
    await func(entity, data)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/homeassistant/components/cast/media_player.py", line 1052, in play_media
    self._chromecast.media_controller.play_media(media_id, media_type)
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/pychromecast/controllers/media.py", line 523, in play_media
    callback_function=app_launched_callback)
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/pychromecast/socket_client.py", line 935, in launch_app
    self.update_status(lambda response:
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/pychromecast/socket_client.py", line 926, in update_status
    callback_function=callback_function_param)
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/pychromecast/controllers/__init__.py", line 84, in send_message
    self.namespace, data, inc_session_id, callback_function)
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/pychromecast/socket_client.py", line 725, in send_platform_message
    inc_session_id, callback_function_param)
  File "/home/vmware/homeassistant/lib/python3.6/site-packages/pychromecast/socket_client.py", line 719, in send_message
    str(self.port) + " is connecting...")

Additional information:

I really hope that the HA team can have this gracefully fail, meaning send a notice to the GUI, but then force a restart rather than letting it hang forever!

Once this start happening, i have to restart HA 😦

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 58 (23 by maintainers)

Most upvoted comments

This is just getting more and more annoying…

@emontnemery So I am not using home-assistant, I’m just using pychromecast. for some reason when connecting to the cast I had to use cast.wait() and not cast.start(). I have no idea why. Here is the code:

# This does not work 
import pychromecast
cast = pychromecast.get_chromecasts()[0]
cast.start()  # pychromecast.error.NotConnected: Chromecast...
cast.play_media('example.png', content_type='image/png')

#**This does**
import pychromecast

cast = pychromecast.get_chromecasts()[0]
cast.wait()  # connects
cast.play_media('example.png', content_type='image/png')

The issue is random and usually only discovered once something stop working

That’s fine as long as you can upload a log covering the time where the Chromecast stops working.

@emontnemery

I have update HA and thereby pychromecast. “requirements”: [“pychromecast==5.0.0”], Home Assistant 0.109.3 I am now running with the additional debug you added in. I will feedback next time I get the alarm.