Revert polling changes to HomeKit Controller (#139550)

This reverts #116200

We changed the polling logic to avoid polling if all chars are marked as watchable
to avoid crashing the firmware on a very limited set of devices as it was
more in line with what iOS does. In the end, the user ended up replacing
the device in #116143 because it turned out to be unreliable in other
ways. The vendor has since issued a firmware update that may resolve
the problem with all of these devices.

In practice it turns out many more devices
report that chars are evented and never send events. After a few months
of data and reports the trade-off does not seem worth it since
users are having to set up manual polling on a wide range of
devices. The amount of devices with evented chars that do not
actually send state vastly exceeds the number of devices that
might crash if they are polled too often so restore the previous
behavior

fixes #138561
fixes #100331
fixes #124529
fixes #123456
fixes #130763
fixes #124099
fixes #124916
fixes #135434
fixes #125273
fixes #124099
fixes #119617
This commit is contained in:
J. Nick Koston
2025-02-28 22:25:50 +00:00
committed by GitHub
parent ee1fe2cae4
commit 577b22374a
2 changed files with 5 additions and 43 deletions

View File

@@ -375,9 +375,9 @@ async def test_poll_firmware_version_only_all_watchable_accessory_mode(
state = await helper.poll_and_get_state()
assert state.state == STATE_OFF
assert mock_get_characteristics.call_count == 2
# Verify only firmware version is polled
assert mock_get_characteristics.call_args_list[0][0][0] == {(1, 7)}
assert mock_get_characteristics.call_args_list[1][0][0] == {(1, 7)}
# Verify everything is polled
assert mock_get_characteristics.call_args_list[0][0][0] == {(1, 10), (1, 11)}
assert mock_get_characteristics.call_args_list[1][0][0] == {(1, 10), (1, 11)}
# Test device goes offline
helper.pairing.available = False
@@ -429,8 +429,8 @@ async def test_manual_poll_all_chars(
) as mock_get_characteristics:
# Initial state is that the light is off
await helper.poll_and_get_state()
# Verify only firmware version is polled
assert mock_get_characteristics.call_args_list[0][0][0] == {(1, 7)}
# Verify poll polls all chars
assert len(mock_get_characteristics.call_args_list[0][0][0]) > 1
# Now do a manual poll to ensure all chars are polled
mock_get_characteristics.reset_mock()