mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Use climate enums in heatmiser (#70662)
This commit is contained in:
parent
cb6320536f
commit
035635dbaf
@ -6,13 +6,8 @@ import logging
|
|||||||
from heatmiserV3 import connection, heatmiser
|
from heatmiserV3 import connection, heatmiser
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
|
||||||
HVAC_MODE_HEAT,
|
from homeassistant.components.climate.const import ClimateEntityFeature, HVACMode
|
||||||
HVAC_MODE_OFF,
|
|
||||||
PLATFORM_SCHEMA,
|
|
||||||
ClimateEntity,
|
|
||||||
ClimateEntityFeature,
|
|
||||||
)
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
@ -76,6 +71,7 @@ def setup_platform(
|
|||||||
class HeatmiserV3Thermostat(ClimateEntity):
|
class HeatmiserV3Thermostat(ClimateEntity):
|
||||||
"""Representation of a HeatmiserV3 thermostat."""
|
"""Representation of a HeatmiserV3 thermostat."""
|
||||||
|
|
||||||
|
_attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]
|
||||||
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
|
|
||||||
def __init__(self, therm, device, uh1):
|
def __init__(self, therm, device, uh1):
|
||||||
@ -87,7 +83,7 @@ class HeatmiserV3Thermostat(ClimateEntity):
|
|||||||
self._target_temperature = None
|
self._target_temperature = None
|
||||||
self._id = device
|
self._id = device
|
||||||
self.dcb = None
|
self.dcb = None
|
||||||
self._hvac_mode = HVAC_MODE_HEAT
|
self._attr_hvac_mode = HVACMode.HEAT
|
||||||
self._temperature_unit = None
|
self._temperature_unit = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -100,22 +96,6 @@ class HeatmiserV3Thermostat(ClimateEntity):
|
|||||||
"""Return the unit of measurement which this thermostat uses."""
|
"""Return the unit of measurement which this thermostat uses."""
|
||||||
return self._temperature_unit
|
return self._temperature_unit
|
||||||
|
|
||||||
@property
|
|
||||||
def hvac_mode(self) -> str:
|
|
||||||
"""Return hvac operation ie. heat, cool mode.
|
|
||||||
|
|
||||||
Need to be one of HVAC_MODE_*.
|
|
||||||
"""
|
|
||||||
return self._hvac_mode
|
|
||||||
|
|
||||||
@property
|
|
||||||
def hvac_modes(self) -> list[str]:
|
|
||||||
"""Return the list of available hvac operation modes.
|
|
||||||
|
|
||||||
Need to be a subset of HVAC_MODES.
|
|
||||||
"""
|
|
||||||
return [HVAC_MODE_HEAT, HVAC_MODE_OFF]
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self):
|
def current_temperature(self):
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
@ -146,8 +126,8 @@ class HeatmiserV3Thermostat(ClimateEntity):
|
|||||||
)
|
)
|
||||||
self._current_temperature = int(self.therm.get_floor_temp())
|
self._current_temperature = int(self.therm.get_floor_temp())
|
||||||
self._target_temperature = int(self.therm.get_target_temp())
|
self._target_temperature = int(self.therm.get_target_temp())
|
||||||
self._hvac_mode = (
|
self._attr_hvac_mode = (
|
||||||
HVAC_MODE_OFF
|
HVACMode.OFF
|
||||||
if (int(self.therm.get_current_state()) == 0)
|
if (int(self.therm.get_current_state()) == 0)
|
||||||
else HVAC_MODE_HEAT
|
else HVACMode.HEAT
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user