mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 17:57:55 +00:00
Use unit enums in honeywell (#84344)
This commit is contained in:
parent
d0a389ce36
commit
fc94569a0d
@ -14,7 +14,7 @@ from homeassistant.components.sensor import (
|
|||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PERCENTAGE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
from homeassistant.const import PERCENTAGE, UnitOfTemperature
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
@ -24,7 +24,9 @@ from .const import DOMAIN, HUMIDITY_STATUS_KEY, TEMPERATURE_STATUS_KEY
|
|||||||
|
|
||||||
def _get_temperature_sensor_unit(device: Device) -> str:
|
def _get_temperature_sensor_unit(device: Device) -> str:
|
||||||
"""Get the correct temperature unit for the device."""
|
"""Get the correct temperature unit for the device."""
|
||||||
return TEMP_CELSIUS if device.temperature_unit == "C" else TEMP_FAHRENHEIT
|
if device.temperature_unit == "C":
|
||||||
|
return UnitOfTemperature.CELSIUS
|
||||||
|
return UnitOfTemperature.FAHRENHEIT
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user