mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Fix reported temperatures in Maxcube (#41259)
This commit is contained in:
parent
2fabd4edb8
commit
b6b85d3e0c
@ -40,6 +40,11 @@ OFF_TEMPERATURE = 4.5
|
|||||||
# On (valve fully open)
|
# On (valve fully open)
|
||||||
ON_TEMPERATURE = 30.5
|
ON_TEMPERATURE = 30.5
|
||||||
|
|
||||||
|
# Lowest Value without turning off
|
||||||
|
MIN_TEMPERATURE = 5.0
|
||||||
|
# Largest Value without fully opening
|
||||||
|
MAX_TEMPERATURE = 30.0
|
||||||
|
|
||||||
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
|
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
|
||||||
|
|
||||||
HASS_PRESET_TO_MAX_MODE = {
|
HASS_PRESET_TO_MAX_MODE = {
|
||||||
@ -100,13 +105,17 @@ class MaxCubeClimate(ClimateEntity):
|
|||||||
def min_temp(self):
|
def min_temp(self):
|
||||||
"""Return the minimum temperature."""
|
"""Return the minimum temperature."""
|
||||||
device = self._cubehandle.cube.device_by_rf(self._rf_address)
|
device = self._cubehandle.cube.device_by_rf(self._rf_address)
|
||||||
return self.map_temperature_max_hass(device.min_temperature)
|
if device.min_temperature is None:
|
||||||
|
return MIN_TEMPERATURE
|
||||||
|
return device.min_temperature
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def max_temp(self):
|
def max_temp(self):
|
||||||
"""Return the maximum temperature."""
|
"""Return the maximum temperature."""
|
||||||
device = self._cubehandle.cube.device_by_rf(self._rf_address)
|
device = self._cubehandle.cube.device_by_rf(self._rf_address)
|
||||||
return self.map_temperature_max_hass(device.max_temperature)
|
if device.max_temperature is None:
|
||||||
|
return MAX_TEMPERATURE
|
||||||
|
return device.max_temperature
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def temperature_unit(self):
|
def temperature_unit(self):
|
||||||
@ -117,9 +126,7 @@ class MaxCubeClimate(ClimateEntity):
|
|||||||
def current_temperature(self):
|
def current_temperature(self):
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
device = self._cubehandle.cube.device_by_rf(self._rf_address)
|
device = self._cubehandle.cube.device_by_rf(self._rf_address)
|
||||||
|
return device.actual_temperature
|
||||||
# Map and return current temperature
|
|
||||||
return self.map_temperature_max_hass(device.actual_temperature)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_mode(self):
|
def hvac_mode(self):
|
||||||
@ -195,7 +202,13 @@ class MaxCubeClimate(ClimateEntity):
|
|||||||
def target_temperature(self):
|
def target_temperature(self):
|
||||||
"""Return the temperature we try to reach."""
|
"""Return the temperature we try to reach."""
|
||||||
device = self._cubehandle.cube.device_by_rf(self._rf_address)
|
device = self._cubehandle.cube.device_by_rf(self._rf_address)
|
||||||
return self.map_temperature_max_hass(device.target_temperature)
|
if (
|
||||||
|
device.target_temperature is None
|
||||||
|
or device.target_temperature < self.min_temp
|
||||||
|
or device.target_temperature > self.max_temp
|
||||||
|
):
|
||||||
|
return None
|
||||||
|
return device.target_temperature
|
||||||
|
|
||||||
def set_temperature(self, **kwargs):
|
def set_temperature(self, **kwargs):
|
||||||
"""Set new target temperatures."""
|
"""Set new target temperatures."""
|
||||||
@ -283,11 +296,3 @@ class MaxCubeClimate(ClimateEntity):
|
|||||||
def update(self):
|
def update(self):
|
||||||
"""Get latest data from MAX! Cube."""
|
"""Get latest data from MAX! Cube."""
|
||||||
self._cubehandle.update()
|
self._cubehandle.update()
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def map_temperature_max_hass(temperature):
|
|
||||||
"""Map Temperature from MAX! to Home Assistant."""
|
|
||||||
if temperature is None:
|
|
||||||
return 0.0
|
|
||||||
|
|
||||||
return temperature
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user