From cb4ff2c3e705d24dccd9d29a96708856166dee32 Mon Sep 17 00:00:00 2001 From: Elahd Bar-Shai <466460+elahd@users.noreply.github.com> Date: Sun, 18 Jun 2023 02:27:18 +0000 Subject: [PATCH] Fix KeyError during removed device cleanup --- custom_components/alarmdotcom/__init__.py | 4 +++- custom_components/alarmdotcom/manifest.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/custom_components/alarmdotcom/__init__.py b/custom_components/alarmdotcom/__init__.py index c2048d8..ff77c83 100644 --- a/custom_components/alarmdotcom/__init__.py +++ b/custom_components/alarmdotcom/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations import asyncio +import contextlib import json import logging import re @@ -152,7 +153,8 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b f" {entity_entry.name,} (entity_entry.unique_id) ({adc_id})" ) - entity_registry.async_remove(entity_entry.id) + with contextlib.suppress(KeyError): + entity_registry.async_remove(entity_entry.id) # Create virtual DEVICES. # Currently, only Skybell cameras are virtual devices. We support modifying configuration attributes but not viewing video. diff --git a/custom_components/alarmdotcom/manifest.json b/custom_components/alarmdotcom/manifest.json index cc1159f..3bf8dc0 100644 --- a/custom_components/alarmdotcom/manifest.json +++ b/custom_components/alarmdotcom/manifest.json @@ -12,5 +12,5 @@ "beautifulsoup4>=4.10.0", "git+https://github.com/pyalarmdotcom/pyalarmdotcomajax.git@fix-missing-await#pyalarmdotcomajax==0.5.4-alpha.6" ], - "version": "3.0.5-alpha.6" + "version": "3.0.5-alpha.7" }