Skip to content

Commit

Permalink
Remove use of keymaster_device_id
Browse files Browse the repository at this point in the history
  • Loading branch information
Snuffy2 committed Nov 15, 2024
1 parent 0a6178f commit 0247528
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 23 deletions.
7 changes: 0 additions & 7 deletions custom_components/keymaster/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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
)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
14 changes: 0 additions & 14 deletions custom_components/keymaster/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion custom_components/keymaster/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
)
Expand Down
1 change: 0 additions & 1 deletion custom_components/keymaster/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0247528

Please sign in to comment.