Use shorthand attributes in Nuheat (#99618)

This commit is contained in:
Joost Lekkerkerker 2023-09-05 11:54:53 +02:00 committed by GitHub
parent 2c3a4b3497
commit f13e7706ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -77,6 +77,7 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity):
)
_attr_has_entity_name = True
_attr_name = None
_attr_preset_modes = PRESET_MODES
def __init__(self, coordinator, thermostat, temperature_unit):
"""Initialize the thermostat."""
@ -85,6 +86,7 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity):
self._temperature_unit = temperature_unit
self._schedule_mode = None
self._target_temperature = None
self._attr_unique_id = thermostat.serial_number
@property
def temperature_unit(self) -> str:
@ -102,11 +104,6 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity):
return self._thermostat.fahrenheit
@property
def unique_id(self):
"""Return the unique id."""
return self._thermostat.serial_number
@property
def available(self) -> bool:
"""Return the unique id."""
@ -160,11 +157,6 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity):
"""Return current preset mode."""
return SCHEDULE_MODE_TO_PRESET_MODE_MAP.get(self._schedule_mode, PRESET_RUN)
@property
def preset_modes(self):
"""Return available preset modes."""
return PRESET_MODES
def set_preset_mode(self, preset_mode: str) -> None:
"""Update the hold mode of the thermostat."""
self._set_schedule_mode(