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
71.35k stars 29.9k forks source link

HomeKit TV Remote Widget Volume Control Not Working #63043

Closed pavolholes closed 2 years ago

pavolholes commented 2 years ago

The problem

Hello, I can't control volume of the TV via the Remote widget on my iPhone using the side hardware buttons. All other controls visible on the screen are working and I was able to catch them via event homekit_tv_remote_key_pressed. But when I press the hardware volume buttons the event is not received nor the volume of entity is changed. I'm able to control the volume via media_player entity in Lovelace and also via service:

service: media_player.volume_up
target:
  entity_id: media_player.tv_obyvacka

I think the supported_features includes mandatory SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET and SUPPORT_VOLUME_STEP bits. Here is the TV entity info:

source_list: TV, HDMI, Plex, Kuki, YouTube
volume_level: 0.08
is_volume_muted: false
media_content_type: app
media_title: Plex
app_id: 3201512006963
source: Plex
ip_address: 192.168.2.111
device_class: tv
entity_picture: /api/media_player_proxy/media_player.tv_obyvacka?token=REDACTED&cache=REDACTED
icon: mdi:television
friendly_name: Obyvacka TV
supported_features: 24509
dwains_dashboard_popup: dwains-dashboard/addons/popups/media_player/obyvackaTv_popup.yaml

Below you can find my yaml configuration of the HomeKit Bridge in accessory mode.

I've enabled debug logging for HomeKit using below which I found here:

logger:
  default: warning
  logs:
    homeassistant.components.homekit: debug
    pyhap: debug

and below you can find the debug log. During the debugging I've done this in the Remote widget:

I don't understant all from the logs but I think I can see there only five taps of arrow_down ({'characteristics': [{'aid': 1, 'iid': 15, 'value': 5}]}) and five taps of arrow_up ({'aid': 1, 'iid': 15, 'value': 4}), not the volume buttons presses between them.

Can you please help me with this?

Thanks a lot.

Regards, Pavol

What version of Home Assistant Core has the issue?

core-2021.12.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

homekit

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit/#cant-control-volume-of-your-tv-media-player

Example YAML snippet

homekit:
  - name: HA Bridge TVs
    mode: accessory
    port: 51828
    filter:
      include_entities:
        - media_player.tv_obyvacka
    entity_config:
      media_player.tv_obyvacka:
        feature_list:
          - feature: on_off
          - feature: play_pause
          - feature: play_stop
          - feature: toggle_mute

Anything in the logs that might be useful for us?

2021-12-29 21:53:40 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.138', 49463) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:40 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.138', 49463) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka\\032TV\\032D978C2._hap._tcp.local\r\nContent-Length: 50\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":15,"value":5}]}'
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: PAUSED
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Request(method=b'PUT', target=b'/characteristics', headers=<Headers([(b'host', b'Obyvacka\\032TV\\032D978C2._hap._tcp.local'), (b'content-length', b'50'), (b'content-type', b'application/hap+json')])>, http_version=b'1.1')
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Data(data=bytearray(b'{"characteristics":[{"aid":1,"iid":15,"value":5}]}'), chunk_start=False, chunk_end=False)
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: EndOfMessage(headers=<Headers([])>)
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Request PUT for path '/characteristics': {'host': 'Obyvacka\\032TV\\032D978C2._hap._tcp.local', 'content-length': '50', 'content-type': 'application/hap+json'}
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Set characteristics content: {'characteristics': [{'aid': 1, 'iid': 15, 'value': 5}]}
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.characteristic] client_update_value: RemoteKey to 5 (original: 5) from client: ('192.168.2.112', 61642)
2021-12-29 21:53:43 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 5
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka\\032TV\\032D978C2._hap._tcp.local\r\nContent-Length: 50\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":11,"value":1}]}'
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: PAUSED
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Request(method=b'PUT', target=b'/characteristics', headers=<Headers([(b'host', b'Obyvacka\\032TV\\032D978C2._hap._tcp.local'), (b'content-length', b'50'), (b'content-type', b'application/hap+json')])>, http_version=b'1.1')
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Data(data=bytearray(b'{"characteristics":[{"aid":1,"iid":11,"value":1}]}'), chunk_start=False, chunk_end=False)
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: EndOfMessage(headers=<Headers([])>)
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Request PUT for path '/characteristics': {'host': 'Obyvacka\\032TV\\032D978C2._hap._tcp.local', 'content-length': '50', 'content-type': 'application/hap+json'}
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Set characteristics content: {'characteristics': [{'aid': 1, 'iid': 11, 'value': 1}]}
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.characteristic] client_update_value: Active to 1 (original: 1) from client: ('192.168.2.112', 61642)
2021-12-29 21:53:43 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set switch state for "on_off" to 1
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:43 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka\\032TV\\032D978C2._hap._tcp.local\r\nContent-Length: 50\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":15,"value":5}]}'
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: PAUSED
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Request(method=b'PUT', target=b'/characteristics', headers=<Headers([(b'host', b'Obyvacka\\032TV\\032D978C2._hap._tcp.local'), (b'content-length', b'50'), (b'content-type', b'application/hap+json')])>, http_version=b'1.1')
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Data(data=bytearray(b'{"characteristics":[{"aid":1,"iid":15,"value":5}]}'), chunk_start=False, chunk_end=False)
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: EndOfMessage(headers=<Headers([])>)
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Request PUT for path '/characteristics': {'host': 'Obyvacka\\032TV\\032D978C2._hap._tcp.local', 'content-length': '50', 'content-type': 'application/hap+json'}
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Set characteristics content: {'characteristics': [{'aid': 1, 'iid': 15, 'value': 5}]}
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.characteristic] client_update_value: RemoteKey to 5 (original: 5) from client: ('192.168.2.112', 61642)
2021-12-29 21:53:44 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 5
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka\\032TV\\032D978C2._hap._tcp.local\r\nContent-Length: 50\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":15,"value":5}]}'
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: PAUSED
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Request(method=b'PUT', target=b'/characteristics', headers=<Headers([(b'host', b'Obyvacka\\032TV\\032D978C2._hap._tcp.local'), (b'content-length', b'50'), (b'content-type', b'application/hap+json')])>, http_version=b'1.1')
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Data(data=bytearray(b'{"characteristics":[{"aid":1,"iid":15,"value":5}]}'), chunk_start=False, chunk_end=False)
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: EndOfMessage(headers=<Headers([])>)
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Request PUT for path '/characteristics': {'host': 'Obyvacka\\032TV\\032D978C2._hap._tcp.local', 'content-length': '50', 'content-type': 'application/hap+json'}
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Set characteristics content: {'characteristics': [{'aid': 1, 'iid': 15, 'value': 5}]}
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.characteristic] client_update_value: RemoteKey to 5 (original: 5) from client: ('192.168.2.112', 61642)
2021-12-29 21:53:44 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 5
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:44 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA
2021-12-29 21:53:45 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka\\032TV\\032D978C2._hap._tcp.local\r\nContent-Length: 50\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":15,"value":5}]}'
2021-12-29 21:53:45 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: PAUSED
2021-12-29 21:53:45 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Request(method=b'PUT', target=b'/characteristics', headers=<Headers([(b'host', b'Obyvacka\\032TV\\032D978C2._hap._tcp.local'), (b'content-length', b'50'), (b'content-type', b'application/hap+json')])>, http_version=b'1.1')
2021-12-29 21:53:45 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Data(data=bytearray(b'{"characteristics":[{"aid":1,"iid":15,"value":5}]}'), chunk_start=False, chunk_end=False)
2021-12-29 21:53:45 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: EndOfMessage(headers=<Headers([])>)
2021-12-29 21:53:45 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Request PUT for path '/characteristics': {'host': 'Obyvacka\\032TV\\032D978C2._hap._tcp.local', 'content-length': '50', 'content-type': 'application/hap+json'}
2021-12-29 21:53:45 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Set characteristics content: {'characteristics': [{'aid': 1, 'iid': 15, 'value': 5}]}
2021-12-29 21:53:45 DEBUG (MainThread) [pyhap.characteristic] client_update_value: RemoteKey to 5 (original: 5) from client: ('192.168.2.112', 61642)
2021-12-29 21:53:45 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 5
2021-12-29 21:53:45 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:45 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA
2021-12-29 21:53:46 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka\\032TV\\032D978C2._hap._tcp.local\r\nContent-Length: 50\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":15,"value":5}]}'
2021-12-29 21:53:46 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: PAUSED
2021-12-29 21:53:46 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Request(method=b'PUT', target=b'/characteristics', headers=<Headers([(b'host', b'Obyvacka\\032TV\\032D978C2._hap._tcp.local'), (b'content-length', b'50'), (b'content-type', b'application/hap+json')])>, http_version=b'1.1')
2021-12-29 21:53:46 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Data(data=bytearray(b'{"characteristics":[{"aid":1,"iid":15,"value":5}]}'), chunk_start=False, chunk_end=False)
2021-12-29 21:53:46 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: EndOfMessage(headers=<Headers([])>)
2021-12-29 21:53:46 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Request PUT for path '/characteristics': {'host': 'Obyvacka\\032TV\\032D978C2._hap._tcp.local', 'content-length': '50', 'content-type': 'application/hap+json'}
2021-12-29 21:53:46 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Set characteristics content: {'characteristics': [{'aid': 1, 'iid': 15, 'value': 5}]}
2021-12-29 21:53:46 DEBUG (MainThread) [pyhap.characteristic] client_update_value: RemoteKey to 5 (original: 5) from client: ('192.168.2.112', 61642)
2021-12-29 21:53:46 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 5
2021-12-29 21:53:46 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:46 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA
2021-12-29 21:53:52 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka\\032TV\\032D978C2._hap._tcp.local\r\nContent-Length: 50\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":15,"value":4}]}'
2021-12-29 21:53:52 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: PAUSED
2021-12-29 21:53:52 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Request(method=b'PUT', target=b'/characteristics', headers=<Headers([(b'host', b'Obyvacka\\032TV\\032D978C2._hap._tcp.local'), (b'content-length', b'50'), (b'content-type', b'application/hap+json')])>, http_version=b'1.1')
2021-12-29 21:53:52 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Data(data=bytearray(b'{"characteristics":[{"aid":1,"iid":15,"value":4}]}'), chunk_start=False, chunk_end=False)
2021-12-29 21:53:52 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: EndOfMessage(headers=<Headers([])>)
2021-12-29 21:53:52 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Request PUT for path '/characteristics': {'host': 'Obyvacka\\032TV\\032D978C2._hap._tcp.local', 'content-length': '50', 'content-type': 'application/hap+json'}
2021-12-29 21:53:52 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Set characteristics content: {'characteristics': [{'aid': 1, 'iid': 15, 'value': 4}]}
2021-12-29 21:53:52 DEBUG (MainThread) [pyhap.characteristic] client_update_value: RemoteKey to 4 (original: 4) from client: ('192.168.2.112', 61642)
2021-12-29 21:53:52 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 4
2021-12-29 21:53:52 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:52 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka\\032TV\\032D978C2._hap._tcp.local\r\nContent-Length: 50\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":15,"value":4}]}'
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: PAUSED
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Request(method=b'PUT', target=b'/characteristics', headers=<Headers([(b'host', b'Obyvacka\\032TV\\032D978C2._hap._tcp.local'), (b'content-length', b'50'), (b'content-type', b'application/hap+json')])>, http_version=b'1.1')
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Data(data=bytearray(b'{"characteristics":[{"aid":1,"iid":15,"value":4}]}'), chunk_start=False, chunk_end=False)
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: EndOfMessage(headers=<Headers([])>)
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Request PUT for path '/characteristics': {'host': 'Obyvacka\\032TV\\032D978C2._hap._tcp.local', 'content-length': '50', 'content-type': 'application/hap+json'}
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Set characteristics content: {'characteristics': [{'aid': 1, 'iid': 15, 'value': 4}]}
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.characteristic] client_update_value: RemoteKey to 4 (original: 4) from client: ('192.168.2.112', 61642)
2021-12-29 21:53:53 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 4
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka\\032TV\\032D978C2._hap._tcp.local\r\nContent-Length: 50\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":15,"value":4}]}'
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: PAUSED
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Request(method=b'PUT', target=b'/characteristics', headers=<Headers([(b'host', b'Obyvacka\\032TV\\032D978C2._hap._tcp.local'), (b'content-length', b'50'), (b'content-type', b'application/hap+json')])>, http_version=b'1.1')
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Data(data=bytearray(b'{"characteristics":[{"aid":1,"iid":15,"value":4}]}'), chunk_start=False, chunk_end=False)
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: EndOfMessage(headers=<Headers([])>)
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Request PUT for path '/characteristics': {'host': 'Obyvacka\\032TV\\032D978C2._hap._tcp.local', 'content-length': '50', 'content-type': 'application/hap+json'}
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Set characteristics content: {'characteristics': [{'aid': 1, 'iid': 15, 'value': 4}]}
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.characteristic] client_update_value: RemoteKey to 4 (original: 4) from client: ('192.168.2.112', 61642)
2021-12-29 21:53:53 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 4
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:53 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka\\032TV\\032D978C2._hap._tcp.local\r\nContent-Length: 50\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":15,"value":4}]}'
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: PAUSED
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Request(method=b'PUT', target=b'/characteristics', headers=<Headers([(b'host', b'Obyvacka\\032TV\\032D978C2._hap._tcp.local'), (b'content-length', b'50'), (b'content-type', b'application/hap+json')])>, http_version=b'1.1')
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Data(data=bytearray(b'{"characteristics":[{"aid":1,"iid":15,"value":4}]}'), chunk_start=False, chunk_end=False)
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: EndOfMessage(headers=<Headers([])>)
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Request PUT for path '/characteristics': {'host': 'Obyvacka\\032TV\\032D978C2._hap._tcp.local', 'content-length': '50', 'content-type': 'application/hap+json'}
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Set characteristics content: {'characteristics': [{'aid': 1, 'iid': 15, 'value': 4}]}
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.characteristic] client_update_value: RemoteKey to 4 (original: 4) from client: ('192.168.2.112', 61642)
2021-12-29 21:53:54 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 4
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka\\032TV\\032D978C2._hap._tcp.local\r\nContent-Length: 50\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":15,"value":4}]}'
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: PAUSED
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Request(method=b'PUT', target=b'/characteristics', headers=<Headers([(b'host', b'Obyvacka\\032TV\\032D978C2._hap._tcp.local'), (b'content-length', b'50'), (b'content-type', b'application/hap+json')])>, http_version=b'1.1')
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: Data(data=bytearray(b'{"characteristics":[{"aid":1,"iid":15,"value":4}]}'), chunk_start=False, chunk_end=False)
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: EndOfMessage(headers=<Headers([])>)
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Request PUT for path '/characteristics': {'host': 'Obyvacka\\032TV\\032D978C2._hap._tcp.local', 'content-length': '50', 'content-type': 'application/hap+json'}
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_handler] ('192.168.2.112', 61642): Set characteristics content: {'characteristics': [{'aid': 1, 'iid': 15, 'value': 4}]}
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.characteristic] client_update_value: RemoteKey to 4 (original: 4) from client: ('192.168.2.112', 61642)
2021-12-29 21:53:54 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 4
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-12-29 21:53:54 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.112', 61642) (509882e4-0903-4ac4-9f1b-e7828aaee1d2): h11 Event: NEED_DATA

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

homekit documentation homekit source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

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

bdraco commented 2 years ago

The volume level or step is set via a service call for these

https://github.com/home-assistant/core/blob/dev/homeassistant/components/homekit/type_media_players.py#L290

pavolholes commented 2 years ago

Hi @bdraco , I'm not sure if that meant that I should enable full HA debug and provide more logs, but I've done that. During the debugging I've done via Remote widget these steps:

In the log I see debug log lines Set remote key to for all taps. But the debug logs for the push of the buttons Step volume by are not there.

2021-12-30 22:19:06 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 5
...
2021-12-30 22:19:06 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 5
...
2021-12-30 22:19:07 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 5
...
2021-12-30 22:19:08 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 11
...
2021-12-30 22:19:08 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 11
...
2021-12-30 22:19:09 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 11
...
2021-12-30 22:19:13 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 4
...
2021-12-30 22:19:13 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 4
...
2021-12-30 22:19:14 DEBUG (MainThread) [homeassistant.components.homekit.type_media_players] media_player.tv_obyvacka: Set remote key to 4

Here is the debug log: home-assistant.log

Would that mean that the Remote widget is not sending the press of the hardware volume buttons to HomeKit?

Thanks!

EDIT: If I understant correctly, this Recv decrypted: b'PUT /characteristics HTTP/1.1\r\nHost: Obyvacka is what was received by HomeKit from the iOS device. And with that message I was able to find only the taps which I mentioned above. So would that really mean that iOS device is not sending the presses of the volume buttons? 🤔

bdraco commented 2 years ago

So would that really mean that iOS device is not sending the presses of the volume buttons?

That is what is appears is happening.

pavolholes commented 2 years ago

That is what is appears is happening.

And do youm, please, have any clue why is it happening? Or where I should start investigating? Is that because of my Samsung TV integration? Or is that because the volume press is not monitored by the event in Home Assistant? I have no clue what to do now to make it work 😪 Thanks in advance.

bdraco commented 2 years ago

Honestly I don't have enough information to guess how to debug this since Apple doesn't provide docs for the television accessory unless you are MFI certified

bdraco commented 2 years ago

We just added diagnostics for HomeKit which may help figure this out.

Can you try updating to 2022.2.3 and send diagnostics for the config entry ?

pavolholes commented 2 years ago

Sure, it's awesome new function 🚀. Please see the diagnostics attached :) config_entry-homekit-35b04e47978358cf94f0b5c7543e0661.json.txt

bdraco commented 2 years ago
              {
                "iid": 55,
                "type": "E9",
                "perms": [
                  "pr",
                  "ev"
                ],
                "format": "uint8",
                "valid-values": [
                  0,
                  1,
                  2,
                  3
                ],
                "value": 1
              },
              {
                "iid": 56,
                "type": "EA",
                "perms": [
                  "pw"
                ],
                "format": "uint8",
                "valid-values": [
                  0,
                  1
                ]
              },

So the VolumeSelector (EA) and VolumeControlType (E9) look like they are there.

bdraco commented 2 years ago

Here is what an certified device shows

{
                    "iid": 25,
                    "type": "00000113-0000-1000-8000-0026BB765291",  # Speaker
                    "primary": false,
                    "hidden": false,
                    "linked": [],
                    "characteristics": [{
                            "iid": 26,
                            "type": "00000119-0000-1000-8000-0026BB765291",  # Volume
                            "format": "uint8",
                            "value": 20,
                            "perms": [
                                "pr",
                                "pw",
                                "ev"
                            ],
                            "ev": false,
                            "unit": "percentage",
                            "minValue": 0,
                            "maxValue": 100,
                            "minStep": 1
                        },
                        {
                            "iid": 27,
                            "type": "0000011A-0000-1000-8000-0026BB765291",  # Mute
                            "format": "bool",
                            "value": 0,
                            "perms": [
                                "pr",
                                "pw",
                                "ev"
                            ],
                            "ev": false
                        },
                        {
                            "iid": 28,
                            "type": "000000B0-0000-1000-8000-0026BB765291",  # Active
                            "format": "uint8",
                            "value": 1,
                            "perms": [
                                "pr",
                                "pw",
                                "ev"
                            ],
                            "ev": true,
                            "minValue": 0,
                            "maxValue": 1,
                            "minStep": 1
                        },
                        {
                            "iid": 29,
                            "type": "E9",  # VolumeControlType
                            "format": "uint8",  
                            "value": 3,
                            "perms": [
                                "pr",
                                "ev"
                            ],
                            "ev": false,
                            "minValue": 0,
                            "maxValue": 3,
                            "minStep": 1
                        },
                        {
                            "iid": 30,
                            "type": "EA",  # VolumeSelector
                            "format": "uint8",
                            "perms": [
                                "pw"
                            ],
                            "minValue": 0,
                            "maxValue": 1,
                            "minStep": 1
                        }
                    ]
                },
bdraco commented 2 years ago

Here is how Home Assistant is presenting your device's speaker

          {
            "iid": 51,
            "type": "113",
            "characteristics": [
              {
                "iid": 52,
                "type": "11A",
                "perms": [
                  "pr",
                  "pw",
                  "ev"
                ],
                "format": "bool",
                "value": false
              },
              {
                "iid": 53,
                "type": "23",
                "perms": [
                  "pr"
                ],
                "format": "string",
                "value": "Obyvacka TV Volume"
              },
              {
                "iid": 54,
                "type": "B0",
                "perms": [
                  "pr",
                  "pw",
                  "ev"
                ],
                "format": "uint8",
                "valid-values": [
                  0,
                  1
                ],
                "value": 1
              },
              {
                "iid": 55,
                "type": "E9",
                "perms": [
                  "pr",
                  "ev"
                ],
                "format": "uint8",
                "valid-values": [
                  0,
                  1,
                  2,
                  3
                ],
                "value": 1
              },
              {
                "iid": 56,
                "type": "EA",
                "perms": [
                  "pw"
                ],
                "format": "uint8",
                "valid-values": [
                  0,
                  1
                ]
              },
              {
                "iid": 57,
                "type": "119",
                "perms": [
                  "pr",
                  "pw",
                  "ev"
                ],
                "format": "uint8",
                "minValue": 0,
                "minStep": 1,
                "unit": "percentage",
                "maxValue": 100,
                "value": 0
              }
            ]
          }
bdraco commented 2 years ago

This is how volume is presented by Home Assistant for your device

..nothing here... since the device doesn't appear to support Volume

This is what an certified device looks like

{
                            "iid": 26,
                            "type": "00000119-0000-1000-8000-0026BB765291",  # Volume
                            "format": "uint8",
                            "value": 20,
                            "perms": [
                                "pr",
                                "pw",
                                "ev"
                            ],
                            "ev": false,
                            "unit": "percentage",
                            "minValue": 0,
                            "maxValue": 100,
                            "minStep": 1
                        },
bdraco commented 2 years ago

I think the supported_features includes mandatory SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET and SUPPORT_VOLUME_STEP bits. Here is the TV entity info:

So volume is only added if

            if features & SUPPORT_VOLUME_SET:
                self.chars_speaker.append(CHAR_VOLUME)
pavolholes commented 2 years ago

Hi @ollo69, I don't know if I can do anything to fix the issue or something needs to be changed in your SamsungTV Smart Component. Can you please look at Nick's findings above and let me know if I can help? This issue is child of the https://github.com/ollo69/ha-samsungtv-smart/issues/96. Thanks! @bdraco thanks a lot for the analysis!

glassbase commented 2 years ago

This may be related or not.

My volume control via iOS remote works fine for about a day, then is either extremely delayed (30+ seconds) or stops working completely until I reboot HA.

Power and source changing continues to work via Apple Home app during this time. Volume control continues to work via HA media player card, so it’s not a matter of an issue between HA and the TV.

I have one HomeKit hub being an Apple TV 4K connected via Ethernet.

(I’m mobile right now, but will capture some logs)

glassbase commented 2 years ago

EDIT: Of course, this morning, a HA reboot did not resolve like it has been for a few weeks. Even stranger is one of my TVs is working via iOS Remote widget volume control, but 2 others are not. Will continue to investigate.

Living Room TV diagnostics (this TV is not working) config_entry-homekit-f4419042382b1ae10fa90ddeeadd78c9.json.txt

Sofia TV diagnostics (working) config_entry-homekit-b5529fcffbfb8208a3f26f5e6638324a.json.txt

EDIT 2: Deleted the TV from Apple Home app, re-paired and is working for now.

PurdieNZ commented 2 years ago

Was there any progress on this? I have a similar issue

pavolholes commented 2 years ago

It started to work with update to 0.7.5 :)

95C387D5-D04E-4147-8A6C-7E25F61090CE

ollo69 commented 2 years ago

Really good to know, but I don't think that is related to last component version. More probably is due to some changes in HA or eventually in your TV software.