Fix reversed logic in zeroconf homekit pairing check (#35596)

* Fix reversed logic in zeroconf homekit pairing check

* s/server_info/service_info/
pull/35828/head
J. Nick Koston 2020-05-14 11:58:40 -05:00 committed by Franck Nijhof
parent cc431b9f14
commit eeaef5731f
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
2 changed files with 9 additions and 3 deletions

View File

@ -178,6 +178,11 @@ def setup(hass, config):
return
service_info = zeroconf.get_service_info(service_type, name)
if not service_info:
# Prevent the browser thread from collapsing as
# service_info can be None
return
info = info_from_service(service_info)
_LOGGER.debug("Discovered new device %s %s", name, info)
@ -196,7 +201,8 @@ def setup(hass, config):
and HOMEKIT_PAIRED_STATUS_FLAG in info[HOMEKIT_PROPERTIES]
):
try:
if not int(info[HOMEKIT_PROPERTIES][HOMEKIT_PAIRED_STATUS_FLAG]):
# 0 means paired and not discoverable by iOS clients)
if int(info[HOMEKIT_PROPERTIES][HOMEKIT_PAIRED_STATUS_FLAG]):
return
except ValueError:
# HomeKit pairing status unknown

View File

@ -18,8 +18,8 @@ PROPERTIES = {
NON_ASCII_KEY: None,
}
HOMEKIT_STATUS_UNPAIRED = b"0"
HOMEKIT_STATUS_PAIRED = b"1"
HOMEKIT_STATUS_UNPAIRED = b"1"
HOMEKIT_STATUS_PAIRED = b"0"
@pytest.fixture