File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -844,8 +844,6 @@ async def test_devices_from_files(
844844
845845 unique_id_migrations [key ] = entity
846846
847- await zha_device .on_remove ()
848-
849847 # XXX: We re-serialize the JSON because integer enum types are converted when
850848 # serializing but will not compare properly otherwise
851849 loaded_device_data = json .loads (
@@ -874,3 +872,5 @@ async def test_devices_from_files(
874872 tsn = None ,
875873 )
876874 ]
875+
876+ await zha_device .on_remove ()
Original file line number Diff line number Diff line change @@ -1111,8 +1111,10 @@ async def on_remove(self) -> None:
11111111 for callback in self ._on_remove_callbacks :
11121112 callback ()
11131113
1114- for platform_entity in self ._platform_entities .values ():
1115- await platform_entity .on_remove ()
1114+ for platform_entity in list (self ._platform_entities .values ()):
1115+ # TODO: To avoid unnecessary traffic during shutdown, we don't need to emit
1116+ # an event for every entity, just the device
1117+ await self ._remove_entity (platform_entity , emit_event = False )
11161118
11171119 for entity in self ._pending_entities :
11181120 await entity .on_remove ()
You can’t perform that action at this time.
0 commit comments