mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Use unit enums in elkm1 (#84351)
This commit is contained in:
parent
ecbcb9496d
commit
8ab945a67f
@ -25,9 +25,8 @@ from homeassistant.const import (
|
|||||||
CONF_TEMPERATURE_UNIT,
|
CONF_TEMPERATURE_UNIT,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
CONF_ZONE,
|
CONF_ZONE,
|
||||||
TEMP_CELSIUS,
|
|
||||||
TEMP_FAHRENHEIT,
|
|
||||||
Platform,
|
Platform,
|
||||||
|
UnitOfTemperature,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
|
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
|
||||||
@ -298,7 +297,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
raise ConfigEntryNotReady(f"Timed out connecting to {conf[CONF_HOST]}") from exc
|
raise ConfigEntryNotReady(f"Timed out connecting to {conf[CONF_HOST]}") from exc
|
||||||
|
|
||||||
elk_temp_unit = elk.panel.temperature_units
|
elk_temp_unit = elk.panel.temperature_units
|
||||||
temperature_unit = TEMP_CELSIUS if elk_temp_unit == "C" else TEMP_FAHRENHEIT
|
if elk_temp_unit == "C":
|
||||||
|
temperature_unit = UnitOfTemperature.CELSIUS
|
||||||
|
else:
|
||||||
|
temperature_unit = UnitOfTemperature.FAHRENHEIT
|
||||||
config["temperature_unit"] = temperature_unit
|
config["temperature_unit"] = temperature_unit
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
"elk": elk,
|
"elk": elk,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user