home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.57k stars 29.48k forks source link

Kodi is displayed with on status but it is off #104603

Closed terba closed 3 months ago

terba commented 9 months ago

The problem

Kodi turned off, but the associated media_player displays on status. Meanwhile in the logs:

Nov 27 18:01:57 xx xxx: 2023-11-27 18:01:57.694 ERROR (MainThread) [homeassistant.components.kodi.media_player] Error calling async_update on entity media_player.xxxxxxxx: TransportError("Error calling method 'Player.GetActivePlayers': Transport Error", ClientConnectorError(ConnectionKey(host='xxxxxxx', port=xxxx, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-xxxxxxxxxxxxxxxxxxxx), gaierror(-2, 'Name or service not known')))

What version of Home Assistant Core has the issue?

2023.10.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

kodi

Link to integration documentation on our website

https://www.home-assistant.io/integrations/kodi/

Diagnostics information

  1. Home Assistant started with kodi off.
  2. Media player is displayed as off.
  3. Turned on kodi (device turn on automation via WOL)
  4. Media player is displayed as on. Everything is working okay.
  5. Turn off kodi with device turn off automation via kodi.call_method System.Shutdown.
  6. Media player is displayed as on forever. Log is filled with the above error.

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

The same as in #45917, but can not write there as it is closed (don't know why is better to create multiple issues of the same problem, than having one open until it gets solved).

home-assistant[bot] commented 9 months ago

Hey there @onfreund, mind taking a look at this issue as it has been labeled with an integration (kodi) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `kodi` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign kodi` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


kodi documentation kodi source (message by IssueLinks)

rnestler commented 7 months ago

I have the same problem. I guess the integration just doesn't interpret a non-reachable kodi device as off? Seem like a logical thing to do.

Edit: It is especially non-sensical, since I can trigger the shutdown from HA, but HA still thinks it is running:

2024-01-21 22:05:58.401 DEBUG (MainThread) [homeassistant.components.kodi.media_player] Firing event to turn off device
2024-01-21 22:05:58.437 DEBUG (MainThread) [homeassistant.components.kodi.media_player] Run API method System.Shutdown, kwargs={}
2024-01-21 22:06:14.742 ERROR (MainThread) [homeassistant.components.kodi.media_player] Error calling async_update on entity media_player.alarmpi_home: TransportError("Error calling method 'Player.GetActivePlayers': Transport Error", TimeoutError())
2024-01-21 22:06:24.742 ERROR (MainThread) [homeassistant.components.kodi.media_player] Error calling async_update on entity media_player.alarmpi_home: TransportError("Error calling method 'Player.GetActivePlayers': Transport Error", TimeoutError())
2024-01-21 22:06:34.743 ERROR (MainThread) [homeassistant.components.kodi.media_player] Error calling async_update on entity media_player.alarmpi_home: TransportError("Error calling method 'Player.GetActivePlayers': Transport Error", TimeoutError())
2024-01-21 22:06:44.742 ERROR (MainThread) [homeassistant.components.kodi.media_player] Error calling async_update on entity media_player.alarmpi_home: TransportError("Error calling method 'Player.GetActivePlayers': Transport Error", TimeoutError())
RayMoonen commented 7 months ago

Same here on Core Version 2024.1.5. The device just shows up as idle when it's suspended. It used to work up until a couple of versions ago. Not sure which version caused it to stop working.

Sounds like a good idea to interpret an unreachable device as off.

Error calling async_update on entity media_player.kodi: TransportError("Error calling method 'Player.GetActivePlayers': Transport Error", TimeoutError())
Error calling async_update on entity media_player.kodi: TransportError("Error calling method 'Player.GetActivePlayers': Transport Error", ClientOSError(113, 'Host is unreachable'))
issue-triage-workflows[bot] commented 4 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

terba commented 4 months ago

This is still a problem in version 2024.4.4

Sab44 commented 4 months ago

Same problem here, the device where Kodi is running is turned off entirely, but HA shows it as idle and spams the logs with

Error calling async_update on entity media_player.kodi: TransportError("Error calling method 'Player.GetActivePlayers': Transport Error", TimeoutError())
Error calling async_update on entity media_player.kodi: TransportError("Error calling method 'Player.GetActivePlayers': Transport Error", ClientConnectorError(ConnectionKey(host='[IP_ADDRESS]', port=8080, is_ssl=False, ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=2284523216455086638), OSError(113, "Connect call failed ('[IP_ADDRESS]', 8080)")))
Error calling async_update on entity media_player.kodi: TransportError("Error calling method 'Player.GetActivePlayers': Transport Error", ClientConnectorError(ConnectionKey(host='[IP_ADDRESS]', port=8080, is_ssl=False, ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=2284523216455086638), ConnectionRefusedError(111, "Connect call failed ('[IP_ADDRESS]', 8080)")))
mk-81 commented 3 months ago

Hello @All,

I have pretty much the same problem and did some investigations. The reason is a bug in the HTTP Integration of Kodi into home assistant. After digging in the code I found out, that the _working_method is the connection via web socket.

Solved the problem for me at least. Probably, an (redo-able) configuration dialog supporting setting of the web socket would be good. Also a corrected integration taking the HTTP only connection into account.

regards