Skip to content

Commit

Permalink
Fix unit deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
klejejs committed Jan 7, 2024
1 parent b39e3e6 commit 01301fd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
38 changes: 19 additions & 19 deletions custom_components/thermia/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import TEMP_CELSIUS, TIME_HOURS
from homeassistant.const import UnitOfTemperature, UnitOfTime
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -43,7 +43,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"heat_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -62,7 +62,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"outdoor_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -81,7 +81,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"indoor_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -100,7 +100,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"hot_water_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -120,7 +120,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"supply_line_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -136,7 +136,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"desired_supply_line_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -152,7 +152,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"return_line_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -168,7 +168,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"brine_out_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -184,7 +184,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"brine_in_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -200,7 +200,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"cooling_tank_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -216,7 +216,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"cooling_supply_line_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -232,7 +232,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"buffer_tank_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand All @@ -248,7 +248,7 @@ async def async_setup_entry(
"temperature",
"measurement",
"pool_temperature",
TEMP_CELSIUS,
UnitOfTemperature.CELSIUS,
)
)

Expand Down Expand Up @@ -368,7 +368,7 @@ async def async_setup_entry(
None,
"total_increasing",
"compressor_operational_time",
TIME_HOURS,
UnitOfTime.HOURS,
)
)

Expand All @@ -384,7 +384,7 @@ async def async_setup_entry(
None,
"total_increasing",
"hot_water_operational_time",
TIME_HOURS,
UnitOfTime.HOURS,
)
)

Expand All @@ -400,7 +400,7 @@ async def async_setup_entry(
None,
"total_increasing",
"auxiliary_heater_1_operational_time",
TIME_HOURS,
UnitOfTime.HOURS,
)
)

Expand All @@ -416,7 +416,7 @@ async def async_setup_entry(
None,
"total_increasing",
"auxiliary_heater_2_operational_time",
TIME_HOURS,
UnitOfTime.HOURS,
)
)

Expand All @@ -432,7 +432,7 @@ async def async_setup_entry(
None,
"total_increasing",
"auxiliary_heater_3_operational_time",
TIME_HOURS,
UnitOfTime.HOURS,
)
)

Expand Down
7 changes: 2 additions & 5 deletions custom_components/thermia/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
WaterHeaterEntity,
WaterHeaterEntityFeature,
)
from homeassistant.const import (
ATTR_TEMPERATURE,
TEMP_CELSIUS,
)
from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -119,7 +116,7 @@ def target_temperature(self):
@property
def temperature_unit(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS
return UnitOfTemperature.CELSIUS

@property
def current_operation(self):
Expand Down

0 comments on commit 01301fd

Please sign in to comment.