mirror of
https://github.com/home-assistant/core.git
synced 2025-05-25 08:17:09 +00:00
Fix unit conversion (#14730)
* reviewing this code min_temp and max_temp are always present and always in celsius * revert change (preserve unit conversion) * revert (due to unit conversion) * self * clean * cleaner
This commit is contained in:
parent
0748466ffc
commit
bb0068908d
@ -14,8 +14,7 @@ from homeassistant.core import DOMAIN as HA_DOMAIN
|
|||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
STATE_HEAT, STATE_COOL, STATE_IDLE, STATE_AUTO, ClimateDevice,
|
STATE_HEAT, STATE_COOL, STATE_IDLE, STATE_AUTO, ClimateDevice,
|
||||||
ATTR_OPERATION_MODE, ATTR_AWAY_MODE, SUPPORT_OPERATION_MODE,
|
ATTR_OPERATION_MODE, ATTR_AWAY_MODE, SUPPORT_OPERATION_MODE,
|
||||||
SUPPORT_AWAY_MODE, SUPPORT_TARGET_TEMPERATURE, PLATFORM_SCHEMA,
|
SUPPORT_AWAY_MODE, SUPPORT_TARGET_TEMPERATURE, PLATFORM_SCHEMA)
|
||||||
DEFAULT_MIN_TEMP, DEFAULT_MAX_TEMP)
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_UNIT_OF_MEASUREMENT, STATE_ON, STATE_OFF, ATTR_TEMPERATURE,
|
ATTR_UNIT_OF_MEASUREMENT, STATE_ON, STATE_OFF, ATTR_TEMPERATURE,
|
||||||
CONF_NAME, ATTR_ENTITY_ID, SERVICE_TURN_ON, SERVICE_TURN_OFF,
|
CONF_NAME, ATTR_ENTITY_ID, SERVICE_TURN_ON, SERVICE_TURN_OFF,
|
||||||
@ -268,7 +267,8 @@ class GenericThermostat(ClimateDevice):
|
|||||||
if self._min_temp:
|
if self._min_temp:
|
||||||
return self._min_temp
|
return self._min_temp
|
||||||
|
|
||||||
return DEFAULT_MIN_TEMP
|
# get default temp from super class
|
||||||
|
return super().min_temp
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def max_temp(self):
|
def max_temp(self):
|
||||||
@ -277,7 +277,8 @@ class GenericThermostat(ClimateDevice):
|
|||||||
if self._max_temp:
|
if self._max_temp:
|
||||||
return self._max_temp
|
return self._max_temp
|
||||||
|
|
||||||
return DEFAULT_MAX_TEMP
|
# Get default temp from super class
|
||||||
|
return super().max_temp
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _async_sensor_changed(self, entity_id, old_state, new_state):
|
def _async_sensor_changed(self, entity_id, old_state, new_state):
|
||||||
|
@ -19,7 +19,7 @@ from homeassistant.components.climate import (
|
|||||||
ATTR_CURRENT_HUMIDITY, ClimateDevice, DOMAIN, PLATFORM_SCHEMA,
|
ATTR_CURRENT_HUMIDITY, ClimateDevice, DOMAIN, PLATFORM_SCHEMA,
|
||||||
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE,
|
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE,
|
||||||
SUPPORT_FAN_MODE, SUPPORT_SWING_MODE,
|
SUPPORT_FAN_MODE, SUPPORT_SWING_MODE,
|
||||||
SUPPORT_ON_OFF, DEFAULT_MIN_TEMP, DEFAULT_MAX_TEMP)
|
SUPPORT_ON_OFF)
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
@ -246,13 +246,13 @@ class SensiboClimate(ClimateDevice):
|
|||||||
def min_temp(self):
|
def min_temp(self):
|
||||||
"""Return the minimum temperature."""
|
"""Return the minimum temperature."""
|
||||||
return self._temperatures_list[0] \
|
return self._temperatures_list[0] \
|
||||||
if self._temperatures_list else DEFAULT_MIN_TEMP
|
if self._temperatures_list else super().min_temp
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def max_temp(self):
|
def max_temp(self):
|
||||||
"""Return the maximum temperature."""
|
"""Return the maximum temperature."""
|
||||||
return self._temperatures_list[-1] \
|
return self._temperatures_list[-1] \
|
||||||
if self._temperatures_list else DEFAULT_MAX_TEMP
|
if self._temperatures_list else super().max_temp
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
|
@ -8,8 +8,8 @@ import logging
|
|||||||
|
|
||||||
from homeassistant.const import (PRECISION_TENTHS, TEMP_CELSIUS)
|
from homeassistant.const import (PRECISION_TENTHS, TEMP_CELSIUS)
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
ClimateDevice, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE,
|
ClimateDevice, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE)
|
||||||
DEFAULT_MIN_TEMP, DEFAULT_MAX_TEMP)
|
from homeassistant.util.temperature import convert as convert_temperature
|
||||||
from homeassistant.const import ATTR_TEMPERATURE
|
from homeassistant.const import ATTR_TEMPERATURE
|
||||||
from homeassistant.components.tado import DATA_TADO
|
from homeassistant.components.tado import DATA_TADO
|
||||||
|
|
||||||
@ -231,18 +231,14 @@ class TadoClimate(ClimateDevice):
|
|||||||
@property
|
@property
|
||||||
def min_temp(self):
|
def min_temp(self):
|
||||||
"""Return the minimum temperature."""
|
"""Return the minimum temperature."""
|
||||||
if self._min_temp:
|
return convert_temperature(self._min_temp, self._unit,
|
||||||
return self._min_temp
|
self.hass.config.units.temperature_unit)
|
||||||
|
|
||||||
return DEFAULT_MIN_TEMP
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def max_temp(self):
|
def max_temp(self):
|
||||||
"""Return the maximum temperature."""
|
"""Return the maximum temperature."""
|
||||||
if self._max_temp:
|
return convert_temperature(self._max_temp, self._unit,
|
||||||
return self._max_temp
|
self.hass.config.units.temperature_unit)
|
||||||
|
|
||||||
return DEFAULT_MAX_TEMP
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update the state of this climate device."""
|
"""Update the state of this climate device."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user