Fix duplicated discovered homekit devices (#24178)
This commit is contained in:
parent
6667138b73
commit
9303a56d8f
4 changed files with 122 additions and 21 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue