mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Add error translations to Yale Smart Living (#105678)
This commit is contained in:
parent
65514fbd73
commit
08b6d2af5e
@ -83,7 +83,13 @@ class YaleAlarmDevice(YaleAlarmEntity, AlarmControlPanelEntity):
|
||||
except YALE_ALL_ERRORS as error:
|
||||
raise HomeAssistantError(
|
||||
f"Could not set alarm for {self.coordinator.entry.data[CONF_NAME]}:"
|
||||
f" {error}"
|
||||
f" {error}",
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="set_alarm",
|
||||
translation_placeholders={
|
||||
"name": self.coordinator.entry.data[CONF_NAME],
|
||||
"error": str(error),
|
||||
},
|
||||
) from error
|
||||
|
||||
if alarm_state:
|
||||
@ -91,7 +97,9 @@ class YaleAlarmDevice(YaleAlarmEntity, AlarmControlPanelEntity):
|
||||
self.async_write_ha_state()
|
||||
return
|
||||
raise HomeAssistantError(
|
||||
"Could not change alarm check system ready for arming."
|
||||
"Could not change alarm, check system ready for arming",
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="could_not_change_alarm",
|
||||
)
|
||||
|
||||
@property
|
||||
|
@ -79,14 +79,24 @@ class YaleDoorlock(YaleEntity, LockEntity):
|
||||
)
|
||||
except YALE_ALL_ERRORS as error:
|
||||
raise HomeAssistantError(
|
||||
f"Could not set lock for {self.lock_name}: {error}"
|
||||
f"Could not set lock for {self.lock_name}: {error}",
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="set_lock",
|
||||
translation_placeholders={
|
||||
"name": self.lock_name,
|
||||
"error": str(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 not set lock, check system ready for lock.")
|
||||
raise HomeAssistantError(
|
||||
"Could not set lock, check system ready for lock",
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="could_not_change_lock",
|
||||
)
|
||||
|
||||
@property
|
||||
def is_locked(self) -> bool | None:
|
||||
|
@ -56,5 +56,19 @@
|
||||
"name": "Panic button"
|
||||
}
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
"set_alarm": {
|
||||
"message": "Could not set alarm for {name}: {error}"
|
||||
},
|
||||
"could_not_change_alarm": {
|
||||
"message": "Could not change alarm, check system ready for arming"
|
||||
},
|
||||
"set_lock": {
|
||||
"message": "Could not set lock for {name}: {error}"
|
||||
},
|
||||
"could_not_change_lock": {
|
||||
"message": "Could not set lock, check system ready for lock"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user