Add new unit types for better type checking (#53124)

* Add new unit types
* Update helper functions
* Update components
* Update lcn climate
This commit is contained in:
Marc Mueller 2021-07-18 14:43:47 +02:00 committed by GitHub
parent 78f4a49b73
commit 71a8ae3016
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 254 additions and 152 deletions

View file

@ -19,7 +19,12 @@ from homeassistant.components.climate.const import (
)
from homeassistant.components.mysensors.const import MYSENSORS_DISCOVERY, DiscoveryInfo
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.const import (
ATTR_TEMPERATURE,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
UnitTemperatureT,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -91,7 +96,7 @@ class MySensorsHVAC(mysensors.device.MySensorsEntity, ClimateEntity):
return features
@property
def temperature_unit(self) -> str:
def temperature_unit(self) -> UnitTemperatureT:
"""Return the unit of measurement."""
return TEMP_CELSIUS if self.hass.config.units.is_metric else TEMP_FAHRENHEIT