core icon indicating copy to clipboard operation
core copied to clipboard

HomeKit integration 2024.8/8.2 Aqara FP2 PS connectivity issue (some presence events not relayed to HA)

Open Mustreg opened this issue 6 months ago • 9 comments

The problem

My initial issue (integration completetly forezen wihout any indication in the sensor status in HA) with FP2 after upgrading to 2024.8 was resolved by @bdraco with introducing the new https://github.com/home-assistant/core/pull/123601 connection polling mechanism in 2024.8.2 My initial issue: https://github.com/home-assistant/core/issues/123412#issuecomment-2277677304

Unfortunately, there is still something very wrong with HA HomeKit controller FP2 integration after 2024.8 upgrade (including 2024.82 fix). The HA HomeKit controller integration intermittently fails to relay many presence events (especially those that last less than 30 seconds) from Aqara FP2 Presence Sensor to HA. The events are registered 100% accurately in Aqara App (so there is no problem with the FP2 presence sensor itself), however, they are not listed in HA FP2 presense event/trigger sensor log (completely missed as if they never happened). Please see the attached image.

  • This makes the presence detection very unreliable and renders the related automations unusable.
  • Please note that those automations had worked flawlessly for over 12 months prior to 2024.8/8.2 upgrades. No other changes were made to the FP2 configuration over the last few weeks, just the HA 2024.7.4=>2024.8/8.2 upgrades.

My initial brainstorming thoughts (maybe completely irrelevant) on the problem:

  1. Could it be that the HA HomeKit controller-to-FP2 communication still freezes in a stealthy manner for certain periods (some seconds) and the presence events which occur during those "freeze" time windows are not relayed by HA HomeKit integration into HA?
  2. Could it be that the new polling mechanisms interferes somehow with the communication so some of the events are missed by HA if they happen at the same time as the polling?"

FP2 Presence Detecttion Events missing in HA HomeKit controller integration

What version of Home Assistant Core has the issue?

core-2024.8.2

What was the last working version of Home Assistant Core?

2024.7.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

HomeKit Controller

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-08-24 16:37:01.590 DEBUG (MainThread) [aiohomekit.controller.abstract] callback ev:{(1, 2674): {'value': 158}}
2024-08-24 16:37:01.590 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for F1:A2:54:9F:E5:19
2024-08-24 16:37:56.257 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Accessory is reachable, limiting poll to firmware version: F1:A2:54:9F:E5:19
2024-08-24 16:37:56.257 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Starting HomeKit device update: F1:A2:54:9F:E5:19
2024-08-24 16:37:56.257 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.178.103: raw request: b'GET /characteristics?id=1.7 HTTP/1.1\r\nHost: 192.168.178.103\r\n\r\n'
2024-08-24 16:37:56.278 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.178.103: raw response: bytearray(b'{"characteristics":[{"aid":1,"iid":7,"value":"1.2.7"}]}')
2024-08-24 16:37:56.278 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for F1:A2:54:9F:E5:19
2024-08-24 16:37:56.278 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Finished HomeKit device update: F1:A2:54:9F:E5:19
2024-08-24 16:37:56.758 DEBUG (MainThread) [aiohomekit.zeroconf] f1:a2:54:9f:e5:19: Notifying pairing of description update: HomeKitService(name='Presence-Sensor-FP2-EDE5', id='f1:a2:54:9f:e5:19', model='PS-S02D', feature_flags=<FeatureFlags.SUPPORTS_SOFTWARE_AUTHENTICATION: 2>, status_flags=<StatusFlags: 0>, config_num=5, state_num=1448, category=<Categories.SENSOR: 10>, protocol_version='1.1', type='_hap._tcp.local.', address='192.168.178.103', addresses=['192.168.178.103'], port=60761)

Additional information

No response

Mustreg avatar Aug 24 '24 14:08 Mustreg