Shelly4HASS + HomeKit: Current cover position not visible / settable in HomeKit

Hey there! I’ve recently migrated from Homebridge to Home Assistant. Everything worked fine and I have the same set-up with more advanced automation now, so that looks great so far.
However, for a few hours, I have had a problem with HomeKit (as far as I know, I did not change any configuration since then). I’m using the Shelly4HASS integration to integrate my Shelly 2.5s which are used to control my roller shutters. These entities are also passed to HomeKit as I’m controlling my devices from there most of the time. While I can get the exact position of the roller shutters directly from Home Assistant and also set it from there, both are not possible in HomeKit: The roller shutters simply show “Opened” or “Closed” but not the exact position. When I try to set them to something like 50% open, I hear the Shelly relais clicking, but nothing happens. What’s even weirder: When I set the position to like 90% from Home Assistant and then try to set it to like 80% from HomeKit (where the shutters still simply show as “Opened”), the shutters simply go back up to 100%. Yesterday everything worked fine.

This problem only occurs with two of my three roller shutters (!). One works totally fine, both from HA and HomeKit.

Since everything is working fine from Home Assistant, I suspect that the HomeKit integration is the culprit here, not Shelly4HASS.

Here’s also an excerpt from the log of one of the affected roller shutters (set it to debug for PyHAP and HomeKit). I set the position to 93 from HomeKit, you can see that this has been received by PyHAP, but at the very bottom, the position is set to 100 again without my action having any effect.

2021-10-15 13:45:28 DEBUG (MainThread) [homeassistant.components.homekit.type_covers] cover.livingroom_street: Set position to 93
2021-10-15 13:45:28 DEBUG (MainThread) [pyhap.characteristic] set_value: CurrentPosition to 100
2021-10-15 13:45:28 DEBUG (MainThread) [pyhap.characteristic] set_value: TargetPosition to 100
2021-10-15 13:45:28 DEBUG (MainThread) [pyhap.accessory_driver] Send event: topic(956781185.10), data({'aid': 956781185, 'iid': 10, 'value': 100}), sender_client_addr(None)
2021-10-15 13:45:28 DEBUG (MainThread) [pyhap.accessory_driver] Sending event to client: ('192.168.188.23', 51592), immediate: False
2021-10-15 13:45:28 DEBUG (MainThread) [pyhap.accessory_driver] Sending event to client: ('192.168.188.28', 49959), immediate: False
2021-10-15 13:45:28 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.188.23', 51592) (8354fdc9-11d4-4375-a48a-17128cc61895): Send encrypted: b'HTTP/1.1 204 No Content\r\n\r\n'
2021-10-15 13:45:28 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.188.23', 51592) (8354fdc9-11d4-4375-a48a-17128cc61895): h11 Event: NEED_DATA
2021-10-15 13:45:29 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state cover.livingroom_street=opening; current_position=100, shelly_type=Shelly 2.5 (Roller), shelly_id=84CCA8A0CE53, ip_address=192.168.188.39, protocols=['CoAP-discovery', 'CoAP-msg', 'poll'], over_temp=0, has_firmware_update=True, cloud_status=disabled, total_consumption=0.04 kWh, friendly_name=Rollladen Straße Wohnzimmer, supported_features=15 @ 2021-10-15T13:45:29.003568+02:00>
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.characteristic] set_value: PositionState to 1
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.accessory_driver] Send event: topic(956781185.11), data({'aid': 956781185, 'iid': 11, 'value': 1}), sender_client_addr(None)
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.accessory_driver] Sending event to client: ('192.168.188.23', 51592), immediate: False
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.accessory_driver] Sending event to client: ('192.168.188.28', 49959), immediate: False
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.188.28', 49959) (8354fdc9-11d4-4375-a48a-17128cc61895): Send encrypted: b'EVENT/1.0 200 OK\r\nContent-Type: application/hap+json\r\nContent-Length: 97\r\n\r\n{"characteristics":[{"aid":956781185,"iid":10,"value":100},{"aid":956781185,"iid":11,"value":1}]}'
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.188.23', 51592) (8354fdc9-11d4-4375-a48a-17128cc61895): Send encrypted: b'EVENT/1.0 200 OK\r\nContent-Type: application/hap+json\r\nContent-Length: 97\r\n\r\n{"characteristics":[{"aid":956781185,"iid":10,"value":100},{"aid":956781185,"iid":11,"value":1}]}'
2021-10-15 13:45:29 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state binary_sensor.flur_bewegungsmelder=off; friendly_name=Flur Bewegungsmelder, device_class=motion @ 2021-10-15T13:45:29.106547+02:00>
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.characteristic] set_value: MotionDetected to False
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.accessory_driver] Send event: topic(3368074383.9), data({'aid': 3368074383, 'iid': 9, 'value': False}), sender_client_addr(None)
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.accessory_driver] Sending event to client: ('192.168.188.23', 51592), immediate: False
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.accessory_driver] Sending event to client: ('192.168.188.28', 49959), immediate: False
2021-10-15 13:45:29 DEBUG (MainThread) [homeassistant.components.homekit.type_sensors] binary_sensor.flur_bewegungsmelder: Set to 0
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.188.23', 51592) (8354fdc9-11d4-4375-a48a-17128cc61895): Send encrypted: b'EVENT/1.0 200 OK\r\nContent-Type: application/hap+json\r\nContent-Length: 62\r\n\r\n{"characteristics":[{"aid":3368074383,"iid":9,"value":false}]}'
2021-10-15 13:45:29 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.188.28', 49959) (8354fdc9-11d4-4375-a48a-17128cc61895): Send encrypted: b'EVENT/1.0 200 OK\r\nContent-Type: application/hap+json\r\nContent-Length: 62\r\n\r\n{"characteristics":[{"aid":3368074383,"iid":9,"value":false}]}'
2021-10-15 13:45:31 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state cover.livingroom_street=open; current_position=100, shelly_type=Shelly 2.5 (Roller), shelly_id=84CCA8A0CE53, ip_address=192.168.188.39, protocols=['CoAP-discovery', 'CoAP-msg', 'poll'], over_temp=0, has_firmware_update=True, cloud_status=disabled, total_consumption=0.04 kWh, friendly_name=Rollladen Straße Wohnzimmer, supported_features=15 @ 2021-10-15T13:45:31.810913+02:00>
2021-10-15 13:45:31 DEBUG (MainThread) [pyhap.characteristic] set_value: PositionState to 2

Any idea why that is?

1 Like

I am facing exactly the same issue.
For me - this is 4 of my 6 covers.