Core: Kodi shows idle or unavailable even if it's off

Created on 8 Sep 2020  路  12Comments  路  Source: home-assistant/core

The problem


Removed kodi from yaml and let HA discover it.
Most funktions work, but if i turn it off, it shows the state 'idle' and the log fills with:

2020-09-08 12:57:09 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/components/kodi/media_player.py", line 396, in _async_connect_websocket_if_disconnected
    await self._async_ws_connect()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/components/kodi/media_player.py", line 387, in _async_ws_connect
    await self._connection.connect()
  File "/srv/ha/lib/python3.8/site-packages/pykodi/kodi.py", line 135, in connect
    await self._ws_server.ws_connect()
AttributeError: 'NoneType' object has no attribute 'ws_connect'

After restarting HA, Kodi shows 'unavailable' and the log fills with:

2020-09-08 12:59:05 WARNING (MainThread) [homeassistant.config_entries] Config entry for kodi not ready yet. Retrying in 5 seconds
2020-09-08 12:59:15 WARNING (MainThread) [homeassistant.config_entries] Config entry for kodi not ready yet. Retrying in 10 seconds
2020-09-08 12:59:28 WARNING (MainThread) [homeassistant.config_entries] Config entry for kodi not ready yet. Retrying in 20 seconds
2020-09-08 12:59:52 WARNING (MainThread) [homeassistant.config_entries] Config entry for kodi not ready yet. Retrying in 40 seconds
2020-09-08 13:00:35 WARNING (MainThread) [homeassistant.config_entries] Config entry for kodi not ready yet. Retrying in 80 seconds

In 0.114.4, it simply showed 'off' when it was off.

Environment

  • Home Assistant Core release with the issue: 0.115.0b0
  • Last working Home Assistant Core release (if known): 0.114.4
  • Operating environment (OS/Container/Supervised/Core): Core
  • Integration causing this issue: Kodi
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/kodi/

Problem-relevant configuration.yaml


Traceback/Error logs


Additional information

kodi

Most helpful comment

Hmm, I never turn the kodi device off, so I guess I missed this. I'll take a look.

All 12 comments

kodi documentation
kodi source
(message by IssueLinks)

CC @OnFreund

Hey there @onfreund, mind taking a look at this issue as its been labeled with an integration (kodi) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

Hmm, I never turn the kodi device off, so I guess I missed this. I'll take a look.

Same here, running Kodi on a Nvidia Shield, but if I don't touch Kodi for several days, Android TV kills Kodi.

I'll have a PR for clean shutdown (HA status will immediately switch to off), and abrupt shutdown (which might be the case when Android TV kills it - HA will switch to off after a few minutes) today or tomorrow.
However, for the "kodi is off while HA is loading" there isn't a clear solution. After asking the other devs on discord, I can make it a bit cleaner, but it'll still be unavailable, rather than off, so I'm not sure the juice is worth the squeeze.

Thanks @OnFreund for your effort.
I think if the warnings can be deactivated when HA starts and running

2020-09-09 23:12:29 WARNING (MainThread) [homeassistant.config_entries] Config entry for kodi not ready yet. Retrying in 80 seconds
2020-09-09 23:13:53 WARNING (MainThread) [homeassistant.config_entries] Config entry for kodi not ready yet. Retrying in 80 seconds

i could live with 'unavailabe'.

@balloob technically, the "kodi is off while HA is loading" case is still open, but I'm not sure the marginal benefit that can be achieved is worth the effort.

@OnFreund 'unavailable' results in somewhat inconsistent behavior. If I turn off Kodi on nVidia Shield it reports as 'off' even though I can't turn it back on from HA. However, if I restart HA while Kodi is off, it will report as 'unavailable'.

Not a blocker by any means but something worth noting..

I also think this issue should not be closed. Before latest update with configuration.yaml you could turn on and off kodi through HA without limitation, no abnormal behaviour was present if kodi off before HA restart.
It is difficult now to understand why old functionality cannot be re-enabled.
I can start kodi with a shell_command service, if I do after a while kodi entity turns back on, but I cannot see the turn off button.

@alexmogavero the turn-off button not showing when idle is a separate issue that's affecting all media players, not just Kodi, and is a UI issue. You can see discussion at: https://github.com/home-assistant/core/issues/40315

Guys, most of the IP devices including Kodi most probably at some time they should be turned off
Home assistant should not set this on an unavailable state.

Anyhow, if this is the case at least the error messages should be off and should be able to turn on Kodi even if it is in unavailable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raccettura picture raccettura  路  142Comments

Bergasha picture Bergasha  路  176Comments

Ciqsky picture Ciqsky  路  129Comments

neotrunks picture neotrunks  路  169Comments

soldag picture soldag  路  143Comments