fix remove and re-add scenario (#25370)
This commit is contained in:
1 parent
d64f1e767c
commit
7a8130cd2b
2 files changed
+12
-2
No files matched your search
@@ -190,6 +190,13 @@ class ZHAGateway:
|
||||
if entity_id == entity_reference.reference_id:
|
||||
return entity_reference
|
||||
|
||||
def remove_entity_reference(self, entity):
|
||||
"""Remove entity reference for given entity_id if found."""
|
||||
if entity.zha_device.ieee in self.device_registry:
|
||||
entity_refs = self.device_registry.get(entity.zha_device.ieee)
|
||||
self.device_registry[entity.zha_device.ieee] = [
|
||||
e for e in entity_refs if e.reference_id != entity.entity_id]
|
||||
|
||||
@property
|
||||
def devices(self):
|
||||
"""Return devices."""
|
||||
|
||||
Reference in new issue
Block a user