From 02475285aaa56ae969d81744bd207b65381a0510 Mon Sep 17 00:00:00 2001 From: Snuffy2 Date: Thu, 14 Nov 2024 22:27:35 -0500 Subject: [PATCH] Remove use of keymaster_device_id --- custom_components/keymaster/__init__.py | 7 ------- custom_components/keymaster/coordinator.py | 14 -------------- custom_components/keymaster/entity.py | 1 - custom_components/keymaster/lock.py | 1 - 4 files changed, 23 deletions(-) diff --git a/custom_components/keymaster/__init__.py b/custom_components/keymaster/__init__.py index 86ddd24f..dd8d9b50 100644 --- a/custom_components/keymaster/__init__.py +++ b/custom_components/keymaster/__init__.py @@ -159,7 +159,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b kmlock = KeymasterLock( lock_name=config_entry.data.get(CONF_LOCK_NAME), lock_entity_id=config_entry.data.get(CONF_LOCK_ENTITY_ID), - keymaster_device_id=device.id, keymaster_config_entry_id=config_entry.entry_id, alarm_level_or_user_code_entity_id=config_entry.data.get( CONF_ALARM_LEVEL_OR_USER_CODE_ENTITY_ID @@ -174,7 +173,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b parent_name=config_entry.data.get(CONF_PARENT), parent_config_entry_id=config_entry.data.get(CONF_PARENT_ENTRY_ID), ) - hass.data[DOMAIN][config_entry.entry_id] = device.id await coordinator.add_lock(kmlock=kmlock) @@ -188,9 +186,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b async def system_health_check(hass: HomeAssistant, config_entry: ConfigEntry) -> None: """Update system health check data.""" coordinator: KeymasterCoordinator = hass.data[DOMAIN][COORDINATOR] - _LOGGER.debug( - f"[system_health_check] hass.data[DOMAIN][config_entry.entry_id]: {hass.data[DOMAIN][config_entry.entry_id]}" - ) kmlock: KeymasterLock = await coordinator.get_lock_by_config_entry_id( config_entry.entry_id ) @@ -338,7 +333,6 @@ async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry) -> Non kmlock = KeymasterLock( lock_name=config_entry.data[CONF_LOCK_NAME], lock_entity_id=config_entry.data[CONF_LOCK_ENTITY_ID], - keymaster_device_id=device.id, keymaster_config_entry_id=config_entry.entry_id, alarm_level_or_user_code_entity_id=config_entry.data[ CONF_ALARM_LEVEL_OR_USER_CODE_ENTITY_ID @@ -352,7 +346,6 @@ async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry) -> Non code_slots=code_slots, parent_name=config_entry.data[CONF_PARENT], ) - hass.data[DOMAIN][config_entry.entry_id] = device.id if COORDINATOR not in hass.data[DOMAIN]: coordinator = KeymasterCoordinator(hass) diff --git a/custom_components/keymaster/coordinator.py b/custom_components/keymaster/coordinator.py index 9333745e..86fdc515 100644 --- a/custom_components/keymaster/coordinator.py +++ b/custom_components/keymaster/coordinator.py @@ -219,20 +219,6 @@ def sync_get_lock_by_config_entry_id( return None return self.kmlocks[config_entry_id] - async def get_device_id_from_config_entry_id( - self, config_entry_id: str - ) -> str | None: - if config_entry_id not in self.kmlocks: - return None - return self.kmlocks[config_entry_id].keymaster_device_id - - def sync_get_device_id_from_config_entry_id( - self, config_entry_id: str - ) -> str | None: - if config_entry_id not in self.kmlocks: - return None - return self.kmlocks[config_entry_id].keymaster_device_id - async def _is_slot_active(self, slot: KeymasterCodeSlot) -> bool: # _LOGGER.debug(f"[is_slot_active] slot: {slot} ({type(slot)})") if not isinstance(slot, KeymasterCodeSlot) or not slot.enabled: diff --git a/custom_components/keymaster/entity.py b/custom_components/keymaster/entity.py index a3092d21..ca064c36 100644 --- a/custom_components/keymaster/entity.py +++ b/custom_components/keymaster/entity.py @@ -36,7 +36,6 @@ def __init__(self, entity_description: EntityDescription) -> None: self._kmlock: KeymasterLock = self.coordinator.sync_get_lock_by_config_entry_id( self._config_entry.entry_id ) - self._keymaster_device_id: str = self._kmlock.keymaster_device_id self._attr_name: str = ( f"{self._kmlock.lock_name} {self.entity_description.name}" ) diff --git a/custom_components/keymaster/lock.py b/custom_components/keymaster/lock.py index 4c06cd50..d8b2dea4 100644 --- a/custom_components/keymaster/lock.py +++ b/custom_components/keymaster/lock.py @@ -42,7 +42,6 @@ class KeymasterLock: lock_name: str lock_entity_id: str keymaster_config_entry_id: str - keymaster_device_id: str | None = None lock_config_entry_id: str | None = None alarm_level_or_user_code_entity_id: str | None = None alarm_type_or_access_control_entity_id: str | None = None