Fix _attr_name issue in Yale Smart Alarm (#79378)

Fix name issue
pull/79410/head^2
G Johansson 2022-10-01 09:52:07 +02:00 committed by GitHub
parent bd5ec4e198
commit 816af8573f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -14,6 +14,7 @@ from homeassistant.components.alarm_control_panel import (
AlarmControlPanelEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -80,7 +81,7 @@ class YaleAlarmDevice(YaleAlarmEntity, AlarmControlPanelEntity):
)
except YALE_ALL_ERRORS as error:
raise HomeAssistantError(
f"Could not set alarm for {self._attr_name}: {error}"
f"Could not set alarm for {self.coordinator.entry.data[CONF_NAME]}: {error}"
) from error
if alarm_state:

View File

@ -46,7 +46,7 @@ class YaleDoorlock(YaleEntity, LockEntity):
"""Initialize the Yale Lock Device."""
super().__init__(coordinator, data)
self._attr_code_format = f"^\\d{code_format}$"
self.lock_name = data["name"]
self.lock_name: str = data["name"]
async def async_unlock(self, **kwargs: Any) -> None:
"""Send unlock command."""
@ -79,14 +79,14 @@ class YaleDoorlock(YaleEntity, LockEntity):
)
except YALE_ALL_ERRORS as error:
raise HomeAssistantError(
f"Could not set lock for {self._attr_name}: {error}"
f"Could not set lock for {self.lock_name}: {error}"
) from error
if lock_state:
self.coordinator.data["lock_map"][self._attr_unique_id] = command
self.async_write_ha_state()
return
raise HomeAssistantError("Could set lock, check system ready for lock.")
raise HomeAssistantError("Could not set lock, check system ready for lock.")
@property
def is_locked(self) -> bool | None: