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
73.78k stars 30.88k forks source link

Kodi media player: 'previous' button doesn't work for TV #11449

Closed florianj1 closed 5 years ago

florianj1 commented 6 years ago

Home Assistant release (hass --version): 0.60.0

Python release (python3 --version): Python 3.6.3

Component/platform: Hass.io installation on raspberry pi 3

Description of problem: I am running Kodi media center with VNSI plugin to watch television. Interacting with kodi works fine except form switching to the previous TV channel. Switching to the next channel works. Calling media_player.media_prevoius_track results to the exception give below and thus the channel doesn't change.

Expected: Switch to previous TV channel

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

media_player:
  - platform: kodi
    host: 1.2.3.4

Traceback (if applicable):

Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
    result = coro.send(None)
  File "/usr/lib/python3.6/site-packages/homeassistant/core.py", line 1031, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 408, in async_service_handler
    yield from getattr(player, method['method'])(**params)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/kodi.py", line 229, in wrapper
    yield from func(obj, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/kodi.py", line 678, in _goto
    yield from self.server.Player.Seek(players[0]['playerid'], 0)
  File "/usr/lib/python3.6/site-packages/jsonrpc_websocket/jsonrpc.py", line 46, in send_message
    return message.parse_response(response)
  File "/usr/lib/python3.6/site-packages/jsonrpc_base/jsonrpc.py", line 181, in parse_response
    raise ProtocolError(code, message, data)
jsonrpc_base.jsonrpc.ProtocolError: (-32100, 'Failed to execute method.', {'error': {'code': -32100, 'message': 'Failed to execute method.'}, 'id': 244883099, 'jsonrpc': '2.0'})

Additional info: If I change kodi.py from

@asyncio.coroutine
    def _goto(self, direction):
        """Handle for previous/next track."""
        players = yield from self._get_players()

        if players:
            if direction == 'previous':
                # First seek to position 0. Kodi goes to the beginning of the
                # current track if the current track is not at the beginning.
                yield from self.server.Player.Seek(players[0]['playerid'], 0)

            yield from self.server.Player.GoTo(
                players[0]['playerid'], direction)

to

@asyncio.coroutine
    def _goto(self, direction):
        """Handle for previous/next track."""
        players = yield from self._get_players()

        if players:
            yield from self.server.Player.GoTo(
                players[0]['playerid'], direction)

everything works as expected, since skipping to the beginning isn't supported for TV channels

balloobbot commented 6 years 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 :+1:

florianj1 commented 6 years ago

I took some time, but now I am running home-assistant 0.66.1. The issue is still unsolved, since the code from my initial post wasn't changed. The Trace stays nearly the same:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/core.py", line 1002, in _event_to_service_call
    await service_handler.func(service_call)
  File "/usr/lib/python3.6/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.6/site-packages/homeassistant/components/media_player/kodi.py", line 227, in wrapper
    yield from func(obj, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/kodi.py", line 681, in _goto
    yield from self.server.Player.Seek(players[0]['playerid'], 0)
  File "/usr/lib/python3.6/site-packages/jsonrpc_websocket/jsonrpc.py", line 45, in send_message
    return message.parse_response(response)
  File "/usr/lib/python3.6/site-packages/jsonrpc_base/jsonrpc.py", line 181, in parse_response
    raise ProtocolError(code, message, data)
jsonrpc_base.jsonrpc.ProtocolError: (-32100, 'Failed to execute method.', {'error': {'code': -32100, 'message': 'Failed to execute method.'}, 'id': 349239841, 'jsonrpc': '2.0'})
balloobbot commented 6 years 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 :+1:

warner83 commented 5 years ago

I am experiencing the same issue even with the latest release.

balloobbot commented 5 years 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 :+1:

stale[bot] commented 5 years 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 now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.