mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Set MaxCube Climate properties using class _attr_ properties (#58910)
This commit is contained in:
parent
70de7db197
commit
5b5b79f0e5
@ -68,29 +68,22 @@ class MaxCubeClimate(ClimateEntity):
|
|||||||
def __init__(self, handler, device):
|
def __init__(self, handler, device):
|
||||||
"""Initialize MAX! Cube ClimateEntity."""
|
"""Initialize MAX! Cube ClimateEntity."""
|
||||||
room = handler.cube.room_by_id(device.room_id)
|
room = handler.cube.room_by_id(device.room_id)
|
||||||
self._name = f"{room.name} {device.name}"
|
self._attr_name = f"{room.name} {device.name}"
|
||||||
self._cubehandle = handler
|
self._cubehandle = handler
|
||||||
self._device = device
|
self._device = device
|
||||||
|
self._attr_supported_features = SUPPORT_FLAGS
|
||||||
@property
|
self._attr_should_poll = True
|
||||||
def supported_features(self):
|
self._attr_unique_id = self._device.serial
|
||||||
"""Return the list of supported features."""
|
self._attr_temperature_unit = TEMP_CELSIUS
|
||||||
return SUPPORT_FLAGS
|
self._attr_hvac_modes = [HVAC_MODE_OFF, HVAC_MODE_AUTO, HVAC_MODE_HEAT]
|
||||||
|
self._attr_preset_modes = [
|
||||||
@property
|
PRESET_NONE,
|
||||||
def should_poll(self):
|
PRESET_BOOST,
|
||||||
"""Return the polling state."""
|
PRESET_COMFORT,
|
||||||
return True
|
PRESET_ECO,
|
||||||
|
PRESET_AWAY,
|
||||||
@property
|
PRESET_ON,
|
||||||
def name(self):
|
]
|
||||||
"""Return the name of the climate device."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def unique_id(self):
|
|
||||||
"""Return a unique ID."""
|
|
||||||
return self._device.serial
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def min_temp(self):
|
def min_temp(self):
|
||||||
@ -105,11 +98,6 @@ class MaxCubeClimate(ClimateEntity):
|
|||||||
"""Return the maximum temperature."""
|
"""Return the maximum temperature."""
|
||||||
return self._device.max_temperature or MAX_TEMPERATURE
|
return self._device.max_temperature or MAX_TEMPERATURE
|
||||||
|
|
||||||
@property
|
|
||||||
def temperature_unit(self):
|
|
||||||
"""Return the unit of measurement."""
|
|
||||||
return TEMP_CELSIUS
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self):
|
def current_temperature(self):
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
@ -129,11 +117,6 @@ class MaxCubeClimate(ClimateEntity):
|
|||||||
|
|
||||||
return HVAC_MODE_HEAT
|
return HVAC_MODE_HEAT
|
||||||
|
|
||||||
@property
|
|
||||||
def hvac_modes(self):
|
|
||||||
"""Return the list of available operation modes."""
|
|
||||||
return [HVAC_MODE_OFF, HVAC_MODE_AUTO, HVAC_MODE_HEAT]
|
|
||||||
|
|
||||||
def set_hvac_mode(self, hvac_mode: str):
|
def set_hvac_mode(self, hvac_mode: str):
|
||||||
"""Set new target hvac mode."""
|
"""Set new target hvac mode."""
|
||||||
if hvac_mode == HVAC_MODE_OFF:
|
if hvac_mode == HVAC_MODE_OFF:
|
||||||
@ -222,18 +205,6 @@ class MaxCubeClimate(ClimateEntity):
|
|||||||
return PRESET_AWAY
|
return PRESET_AWAY
|
||||||
return PRESET_NONE
|
return PRESET_NONE
|
||||||
|
|
||||||
@property
|
|
||||||
def preset_modes(self):
|
|
||||||
"""Return available preset modes."""
|
|
||||||
return [
|
|
||||||
PRESET_NONE,
|
|
||||||
PRESET_BOOST,
|
|
||||||
PRESET_COMFORT,
|
|
||||||
PRESET_ECO,
|
|
||||||
PRESET_AWAY,
|
|
||||||
PRESET_ON,
|
|
||||||
]
|
|
||||||
|
|
||||||
def set_preset_mode(self, preset_mode):
|
def set_preset_mode(self, preset_mode):
|
||||||
"""Set new operation mode."""
|
"""Set new operation mode."""
|
||||||
if preset_mode == PRESET_COMFORT:
|
if preset_mode == PRESET_COMFORT:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user