456 files
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -41,6 +41,9 @@ class SpookService(AbstractSpookAdminService):
|
||||
0
|
||||
].__self__.storage_collection
|
||||
|
||||
# Everything is looked up before anything is written. A bad one late
|
||||
# in the list should not leave the first ones changed behind an error.
|
||||
zone_ids = []
|
||||
for entity_id in call.data["entity_id"]:
|
||||
if not (entity := entity_component.get_entity(entity_id)):
|
||||
message = f"Could not find entity_id: {entity_id}"
|
||||
@@ -52,4 +55,9 @@ class SpookService(AbstractSpookAdminService):
|
||||
raise HomeAssistantError(message)
|
||||
|
||||
# pylint: disable-next=protected-access
|
||||
await collection.async_delete_item(entity._config["id"]) # noqa: SLF001
|
||||
zone_ids.append(entity._config["id"]) # noqa: SLF001
|
||||
|
||||
# The same zone twice in the list is still one zone. Deleting it a
|
||||
# second time would fail after the first had already gone through.
|
||||
for zone_id in dict.fromkeys(zone_ids):
|
||||
await collection.async_delete_item(zone_id)
|
||||
|
||||
Reference in New Issue
Block a user