mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Use action property defined in MieleEntity (#144052)
This commit is contained in:
parent
1143468eb5
commit
ea9a0f4bf5
@ -131,8 +131,7 @@ class MieleButton(MieleEntity, ButtonEntity):
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
super().available
|
super().available
|
||||||
and self.entity_description.press_data
|
and self.entity_description.press_data in self.action.process_actions
|
||||||
in self.coordinator.data.actions[self._device_id].process_actions
|
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_press(self) -> None:
|
async def async_press(self) -> None:
|
||||||
|
@ -201,9 +201,7 @@ class MieleClimate(MieleEntity, ClimateEntity):
|
|||||||
"""Return the maximum target temperature."""
|
"""Return the maximum target temperature."""
|
||||||
return cast(
|
return cast(
|
||||||
float,
|
float,
|
||||||
self.coordinator.data.actions[self._device_id]
|
self.action.target_temperature[self.entity_description.zone - 1].max,
|
||||||
.target_temperature[self.entity_description.zone - 1]
|
|
||||||
.max,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -211,9 +209,7 @@ class MieleClimate(MieleEntity, ClimateEntity):
|
|||||||
"""Return the minimum target temperature."""
|
"""Return the minimum target temperature."""
|
||||||
return cast(
|
return cast(
|
||||||
float,
|
float,
|
||||||
self.coordinator.data.actions[self._device_id]
|
self.action.target_temperature[self.entity_description.zone - 1].min,
|
||||||
.target_temperature[self.entity_description.zone - 1]
|
|
||||||
.min,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||||
|
@ -47,7 +47,7 @@ class MieleEntity(CoordinatorEntity[MieleDataUpdateCoordinator]):
|
|||||||
return self.coordinator.data.devices[self._device_id]
|
return self.coordinator.data.devices[self._device_id]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def actions(self) -> MieleAction:
|
def action(self) -> MieleAction:
|
||||||
"""Return the actions object."""
|
"""Return the actions object."""
|
||||||
return self.coordinator.data.actions[self._device_id]
|
return self.coordinator.data.actions[self._device_id]
|
||||||
|
|
||||||
|
@ -169,15 +169,14 @@ class MielePowerSwitch(MieleSwitch):
|
|||||||
@property
|
@property
|
||||||
def is_on(self) -> bool | None:
|
def is_on(self) -> bool | None:
|
||||||
"""Return the state of the switch."""
|
"""Return the state of the switch."""
|
||||||
return self.coordinator.data.actions[self._device_id].power_off_enabled
|
return self.action.power_off_enabled
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available(self) -> bool:
|
def available(self) -> bool:
|
||||||
"""Return the availability of the entity."""
|
"""Return the availability of the entity."""
|
||||||
|
|
||||||
return (
|
return (
|
||||||
self.coordinator.data.actions[self._device_id].power_off_enabled
|
self.action.power_off_enabled or self.action.power_on_enabled
|
||||||
or self.coordinator.data.actions[self._device_id].power_on_enabled
|
|
||||||
) and super().available
|
) and super().available
|
||||||
|
|
||||||
async def async_turn_switch(self, mode: dict[str, str | int | bool]) -> None:
|
async def async_turn_switch(self, mode: dict[str, str | int | bool]) -> None:
|
||||||
@ -192,12 +191,8 @@ class MielePowerSwitch(MieleSwitch):
|
|||||||
"entity": self.entity_id,
|
"entity": self.entity_id,
|
||||||
},
|
},
|
||||||
) from err
|
) from err
|
||||||
self.coordinator.data.actions[self._device_id].power_on_enabled = cast(
|
self.action.power_on_enabled = cast(bool, mode)
|
||||||
bool, mode
|
self.action.power_off_enabled = not cast(bool, mode)
|
||||||
)
|
|
||||||
self.coordinator.data.actions[self._device_id].power_off_enabled = not cast(
|
|
||||||
bool, mode
|
|
||||||
)
|
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user