mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Use unit enums in nexia (#84349)
This commit is contained in:
parent
316f187bee
commit
af7a487706
@ -10,7 +10,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
|
||||||
|
|
||||||
@ -86,11 +86,10 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
# Outdoor Temperature
|
# Outdoor Temperature
|
||||||
if thermostat.has_outdoor_temperature():
|
if thermostat.has_outdoor_temperature():
|
||||||
unit = (
|
if thermostat.get_unit() == UNIT_CELSIUS:
|
||||||
TEMP_CELSIUS
|
unit = UnitOfTemperature.CELSIUS
|
||||||
if thermostat.get_unit() == UNIT_CELSIUS
|
else:
|
||||||
else TEMP_FAHRENHEIT
|
unit = UnitOfTemperature.FAHRENHEIT
|
||||||
)
|
|
||||||
entities.append(
|
entities.append(
|
||||||
NexiaThermostatSensor(
|
NexiaThermostatSensor(
|
||||||
coordinator,
|
coordinator,
|
||||||
@ -120,11 +119,10 @@ async def async_setup_entry(
|
|||||||
# Zone Sensors
|
# Zone Sensors
|
||||||
for zone_id in thermostat.get_zone_ids():
|
for zone_id in thermostat.get_zone_ids():
|
||||||
zone = thermostat.get_zone_by_id(zone_id)
|
zone = thermostat.get_zone_by_id(zone_id)
|
||||||
unit = (
|
if thermostat.get_unit() == UNIT_CELSIUS:
|
||||||
TEMP_CELSIUS
|
unit = UnitOfTemperature.CELSIUS
|
||||||
if thermostat.get_unit() == UNIT_CELSIUS
|
else:
|
||||||
else TEMP_FAHRENHEIT
|
unit = UnitOfTemperature.FAHRENHEIT
|
||||||
)
|
|
||||||
# Temperature
|
# Temperature
|
||||||
entities.append(
|
entities.append(
|
||||||
NexiaThermostatZoneSensor(
|
NexiaThermostatZoneSensor(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user