Use UnitOfTemperature in climate entities [m-s] (#83131)

This commit is contained in:
epenet 2022-12-02 19:56:18 +01:00 committed by GitHub
parent d3b35ca2a7
commit 8b867d612f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 82 additions and 74 deletions

View file

@ -11,12 +11,7 @@ from homeassistant.components.climate import (
HVACMode,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_TEMPERATURE,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
Platform,
)
from homeassistant.const import ATTR_TEMPERATURE, Platform, UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -96,7 +91,9 @@ class MySensorsHVAC(mysensors.device.MySensorsEntity, ClimateEntity):
def temperature_unit(self) -> str:
"""Return the unit of measurement."""
return (
TEMP_CELSIUS if self.hass.config.units is METRIC_SYSTEM else TEMP_FAHRENHEIT
UnitOfTemperature.CELSIUS
if self.hass.config.units is METRIC_SYSTEM
else UnitOfTemperature.FAHRENHEIT
)
@property