mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Remove option and range checks in Rituals integration (#55222)
* Fix number * Fix select
This commit is contained in:
parent
b45c985d58
commit
e6d710c203
@ -54,10 +54,8 @@ class DiffuserPerfumeAmount(DiffuserEntity, NumberEntity):
|
||||
|
||||
async def async_set_value(self, value: float) -> None:
|
||||
"""Set the perfume amount."""
|
||||
if value.is_integer() and MIN_PERFUME_AMOUNT <= value <= MAX_PERFUME_AMOUNT:
|
||||
await self._diffuser.set_perfume_amount(int(value))
|
||||
else:
|
||||
if not value.is_integer():
|
||||
raise ValueError(
|
||||
f"Can't set the perfume amount to {value}. "
|
||||
f"Perfume amount must be an integer between {self.min_value} and {self.max_value}, inclusive"
|
||||
f"Can't set the perfume amount to {value}. Perfume amount must be an integer."
|
||||
)
|
||||
await self._diffuser.set_perfume_amount(int(value))
|
||||
|
@ -51,9 +51,4 @@ class DiffuserRoomSize(DiffuserEntity, SelectEntity):
|
||||
|
||||
async def async_select_option(self, option: str) -> None:
|
||||
"""Change the diffuser room size."""
|
||||
if option in self.options:
|
||||
await self._diffuser.set_room_size_square_meter(int(option))
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Can't set the room size to {option}. Allowed room sizes are: {self.options}"
|
||||
)
|
||||
await self._diffuser.set_room_size_square_meter(int(option))
|
||||
|
Loading…
x
Reference in New Issue
Block a user