1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-26 22:18:40 +00:00

Fix duplicated discovered homekit devices (#24178)

This commit is contained in:
Jc2k
2019-05-29 23:50:00 +01:00
committed by Paulus Schoutsen
parent 6667138b73
commit 9303a56d8f
4 changed files with 122 additions and 21 deletions

View File

@@ -3,6 +3,7 @@
"abort": {
"accessory_not_found_error": "Cannot add pairing as device can no longer be found.",
"already_configured": "Accessory is already configured with this controller.",
"already_in_progress": "Config flow for device is already in progress.",
"already_paired": "This accessory is already paired to another device. Please reset the accessory and try again.",
"ignored_model": "HomeKit support for this model is blocked as a more feature complete native integration is available.",
"invalid_config_entry": "This device is showing as ready to pair but there is already a conflicting config entry for it in Home Assistant that must first be removed.",

View File

@@ -131,10 +131,17 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow):
paired = not status_flags & 0x01
# pylint: disable=unsupported-assignment-operation
self.context['hkid'] = hkid
self.context['title_placeholders'] = {
'name': discovery_info['name'].replace('._hap._tcp.local.', ''),
}
# If multiple HomekitControllerFlowHandler end up getting created
# for the same accessory dont let duplicates hang around
active_flows = self._async_in_progress()
if any(hkid == flow['context']['hkid'] for flow in active_flows):
return self.async_abort(reason='already_in_progress')
# The configuration number increases every time the characteristic map
# needs updating. Some devices use a slightly off-spec name so handle
# both cases.

View File

@@ -33,7 +33,8 @@
"ignored_model": "HomeKit support for this model is blocked as a more feature complete native integration is available.",
"already_configured": "Accessory is already configured with this controller.",
"invalid_config_entry": "This device is showing as ready to pair but there is already a conflicting config entry for it in Home Assistant that must first be removed.",
"accessory_not_found_error": "Cannot add pairing as device can no longer be found."
"accessory_not_found_error": "Cannot add pairing as device can no longer be found.",
"already_in_progress": "Config flow for device is already in progress."
}
}
}