Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions homeassistant/components/miele/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ def available(self) -> bool:

return (
super().available
and self.entity_description.press_data
in self.coordinator.data.actions[self._device_id].process_actions
and self.entity_description.press_data in self.action.process_actions
)

async def async_press(self) -> None:
Expand Down
8 changes: 2 additions & 6 deletions homeassistant/components/miele/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,15 @@ def max_temp(self) -> float:
"""Return the maximum target temperature."""
return cast(
float,
self.coordinator.data.actions[self._device_id]
.target_temperature[self.entity_description.zone - 1]
.max,
self.action.target_temperature[self.entity_description.zone - 1].max,
)

@property
def min_temp(self) -> float:
"""Return the minimum target temperature."""
return cast(
float,
self.coordinator.data.actions[self._device_id]
.target_temperature[self.entity_description.zone - 1]
.min,
self.action.target_temperature[self.entity_description.zone - 1].min,
)

async def async_set_temperature(self, **kwargs: Any) -> None:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/miele/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def device(self) -> MieleDevice:
return self.coordinator.data.devices[self._device_id]

@property
def actions(self) -> MieleAction:
def action(self) -> MieleAction:
"""Return the actions object."""
return self.coordinator.data.actions[self._device_id]

Expand Down
13 changes: 4 additions & 9 deletions homeassistant/components/miele/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,14 @@ class MielePowerSwitch(MieleSwitch):
@property
def is_on(self) -> bool | None:
"""Return the state of the switch."""
return self.coordinator.data.actions[self._device_id].power_off_enabled
return self.action.power_off_enabled

@property
def available(self) -> bool:
"""Return the availability of the entity."""

return (
self.coordinator.data.actions[self._device_id].power_off_enabled
or self.coordinator.data.actions[self._device_id].power_on_enabled
self.action.power_off_enabled or self.action.power_on_enabled
) and super().available

async def async_turn_switch(self, mode: dict[str, str | int | bool]) -> None:
Expand All @@ -192,12 +191,8 @@ async def async_turn_switch(self, mode: dict[str, str | int | bool]) -> None:
"entity": self.entity_id,
},
) from err
self.coordinator.data.actions[self._device_id].power_on_enabled = cast(
bool, mode
)
self.coordinator.data.actions[self._device_id].power_off_enabled = not cast(
bool, mode
)
self.action.power_on_enabled = cast(bool, mode)
self.action.power_off_enabled = not cast(bool, mode)
self.async_write_ha_state()


Expand Down