Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion homeassistant/components/zeroconf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ def service_update(zeroconf, service_type, name, state_change):
return

service_info = zeroconf.get_service_info(service_type, name)
if not service_info:
# Prevent the browser thread from collapsing as
# server_info can be None
Comment thread
bdraco marked this conversation as resolved.
Outdated
return

info = info_from_service(service_info)
_LOGGER.debug("Discovered new device %s %s", name, info)

Expand All @@ -196,7 +201,8 @@ def service_update(zeroconf, service_type, name, state_change):
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
Expand Down
4 changes: 2 additions & 2 deletions tests/components/zeroconf/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
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
Expand Down