mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Use min/max/step from thermostat in Plugwise (#66618)
This commit is contained in:
parent
1a9fda96c3
commit
de24d00a1c
@ -51,8 +51,6 @@ async def async_setup_entry(
|
|||||||
class PlugwiseClimateEntity(PlugwiseEntity, ClimateEntity):
|
class PlugwiseClimateEntity(PlugwiseEntity, ClimateEntity):
|
||||||
"""Representation of an Plugwise thermostat."""
|
"""Representation of an Plugwise thermostat."""
|
||||||
|
|
||||||
_attr_max_temp = DEFAULT_MAX_TEMP
|
|
||||||
_attr_min_temp = DEFAULT_MIN_TEMP
|
|
||||||
_attr_temperature_unit = TEMP_CELSIUS
|
_attr_temperature_unit = TEMP_CELSIUS
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -79,6 +77,12 @@ class PlugwiseClimateEntity(PlugwiseEntity, ClimateEntity):
|
|||||||
if self.device.get("available_schedules") != ["None"]:
|
if self.device.get("available_schedules") != ["None"]:
|
||||||
self._attr_hvac_modes.append(HVAC_MODE_AUTO)
|
self._attr_hvac_modes.append(HVAC_MODE_AUTO)
|
||||||
|
|
||||||
|
self._attr_min_temp = self.device.get("lower_bound", DEFAULT_MIN_TEMP)
|
||||||
|
self._attr_max_temp = self.device.get("upper_bound", DEFAULT_MAX_TEMP)
|
||||||
|
if resolution := self.device.get("resolution"):
|
||||||
|
# Ensure we don't drop below 0.1
|
||||||
|
self._attr_target_temperature_step = max(resolution, 0.1)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self) -> float | None:
|
def current_temperature(self) -> float | None:
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
|
@ -53,6 +53,9 @@
|
|||||||
"model": "Anna",
|
"model": "Anna",
|
||||||
"name": "Anna",
|
"name": "Anna",
|
||||||
"vendor": "Plugwise",
|
"vendor": "Plugwise",
|
||||||
|
"lower_bound": 5,
|
||||||
|
"upper_bound": 31,
|
||||||
|
"resolution": 0.1,
|
||||||
"preset_modes": ["no_frost", "home", "away", "asleep", "vacation"],
|
"preset_modes": ["no_frost", "home", "away", "asleep", "vacation"],
|
||||||
"active_preset": "home",
|
"active_preset": "home",
|
||||||
"presets": {
|
"presets": {
|
||||||
|
@ -166,6 +166,9 @@ async def test_anna_climate_entity_attributes(
|
|||||||
assert state.attributes["preset_mode"] == "home"
|
assert state.attributes["preset_mode"] == "home"
|
||||||
assert state.attributes["supported_features"] == 17
|
assert state.attributes["supported_features"] == 17
|
||||||
assert state.attributes["temperature"] == 21.0
|
assert state.attributes["temperature"] == 21.0
|
||||||
|
assert state.attributes["min_temp"] == 5.0
|
||||||
|
assert state.attributes["max_temp"] == 31.0
|
||||||
|
assert state.attributes["target_temp_step"] == 0.1
|
||||||
|
|
||||||
|
|
||||||
async def test_anna_climate_entity_climate_changes(
|
async def test_anna_climate_entity_climate_changes(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user