Add error handling to input_select integration (#93940)
This commit is contained in:
parent
e2c2262719
commit
28f6062bab
3 changed files with 19 additions and 18 deletions
|
@ -302,12 +302,9 @@ class InputSelect(collection.CollectionEntity, SelectEntity, RestoreEntity):
|
|||
async def async_select_option(self, option: str) -> None:
|
||||
"""Select new option."""
|
||||
if option not in self.options:
|
||||
_LOGGER.warning(
|
||||
"Invalid option: %s (possible options: %s)",
|
||||
option,
|
||||
", ".join(self.options),
|
||||
raise HomeAssistantError(
|
||||
f"Invalid option: {option} (possible options: {', '.join(self.options)})"
|
||||
)
|
||||
return
|
||||
self._attr_current_option = option
|
||||
self.async_write_ha_state()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue