Chrome cast error when offline

Hi,

Have a chrome cast connected to a TV and powered via the TV’s USB port, hence if the TV is off the chrome cast is not powered.
In the power offline state, there is no visual indication in HA chrome cast is offline.
If attempting to then switch on the Chrome cast the following error is recorded via the home-assistant.log.
Not a big issue as I can see the TV is off, just something worth mentioning.

First two logs reports the chrome cast is offline at 2018-02-25 22:03:11 I then attempt to switch on the chrome cast.
018-02-25 20:50:13 ERROR (Thread-16) [pychromecast.socket_client] Failed to connect, retrying in 5.0s
2018-02-25 20:50:15 ERROR (Thread-17) [pychromecast.socket_client] Failed to connect, retrying in 5.0s
2018-02-25 22:03:11 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall media_player.turn_on: entity_id=[‘media_player.tv’]>
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/core.py”, line 1010, in _event_to_service_call
yield from service_handler.func(service_call)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/media_player/init.py”, line 403, in async_service_handler
yield from getattr(player, method[‘method’])(**params)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/media_player/cast.py”, line 272, in turn_on
self.cast.quit_app()
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/init.py”, line 270, in quit_app
self.socket_client.receiver_controller.stop_app()
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/socket_client.py”, line 844, in stop_app
inc_session_id=True, callback_function=callback_function_param)
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/controllers/init.py”, line 84, in send_message
self.namespace, data, inc_session_id, callback_function)
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/socket_client.py”, line 605, in send_platform_message
inc_session_id, callback_function_param)
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/socket_client.py”, line 556, in send_message
self._ensure_channel_connected(destination_id)
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/socket_client.py”, line 642, in _ensure_channel_connected
no_add_request_id=True)
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/socket_client.py”, line 599, in send_message
raise NotConnected(“Chromecast is connecting…”)
pychromecast.error.NotConnected: Chromecast is connecting…
2018-02-25 22:03:28 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall media_player.turn_on: entity_id=[‘media_player.tv’]>
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/core.py”, line 1010, in _event_to_service_call
yield from service_handler.func(service_call)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/media_player/init.py”, line 403, in async_service_handler
yield from getattr(player, method[‘method’])(**params)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/media_player/cast.py”, line 272, in turn_on
self.cast.quit_app()
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/init.py”, line 270, in quit_app
self.socket_client.receiver_controller.stop_app()
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/socket_client.py”, line 844, in stop_app
inc_session_id=True, callback_function=callback_function_param)
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/controllers/init.py”, line 84, in send_message
self.namespace, data, inc_session_id, callback_function)
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/socket_client.py”, line 605, in send_platform_message
inc_session_id, callback_function_param)
File “/srv/homeassistant/lib/python3.4/site-packages/pychromecast/socket_client.py”, line 599, in send_message
raise NotConnected(“Chromecast is connecting…”)
pychromecast.error.NotConnected: Chromecast is connecting…

1 Like

With 0.64.1 I still have similar errors in the log file:

2018-03-03 08:40:38 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall media_player.media_play_pause: entity_id=['media_player.tv']>
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1010, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/media_player/__init__.py", line 402, in async_service_handler
    yield from getattr(player, method['method'])(**params)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/media_player/cast.py", line 383, in media_play
    self.cast.media_controller.play()
  File "/srv/homeassistant/lib/python3.5/site-packages/pychromecast/controllers/media.py", line 351, in play
    self._send_command({MESSAGE_TYPE: TYPE_PLAY})
  File "/srv/homeassistant/lib/python3.5/site-packages/pychromecast/controllers/media.py", line 312, in _send_command
    self.send_message(command, inc_session_id=True)
  File "/srv/homeassistant/lib/python3.5/site-packages/pychromecast/controllers/__init__.py", line 71, in send_message
    self._check_registered()
  File "/srv/homeassistant/lib/python3.5/site-packages/pychromecast/controllers/__init__.py", line 103, in _check_registered
    "Trying to use the controller without it being registered "
pychromecast.error.ControllerNotRegistered: Trying to use the controller without it being registered with a Cast object.
2018-03-03 08:40:40 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall media_player.turn_off: entity_id=['media_player.tv']>
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1010, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/media_player/__init__.py", line 402, in async_service_handler
    yield from getattr(player, method['method'])(**params)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/media_player/cast.py", line 371, in turn_off
    self.cast.quit_app()
  File "/srv/homeassistant/lib/python3.5/site-packages/pychromecast/__init__.py", line 270, in quit_app
    self.socket_client.receiver_controller.stop_app()
  File "/srv/homeassistant/lib/python3.5/site-packages/pychromecast/socket_client.py", line 851, in stop_app
    inc_session_id=True, callback_function=callback_function_param)
  File "/srv/homeassistant/lib/python3.5/site-packages/pychromecast/controllers/__init__.py", line 71, in send_message
    self._check_registered()
  File "/srv/homeassistant/lib/python3.5/site-packages/pychromecast/controllers/__init__.py", line 103, in _check_registered
    "Trying to use the controller without it being registered "
pychromecast.error.ControllerNotRegistered: Trying to use the controller without it being registered with a Cast object.