Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deprecated constants (#12) #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions custom_components/rointe/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
HVACMode,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import TEMP_CELSIUS
from homeassistant.const import UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -80,7 +80,7 @@ def icon(self) -> str | None:
@property
def temperature_unit(self) -> str:
"""Temperature unit."""
return TEMP_CELSIUS
return UnitOfTemperature.CELSIUS

@property
def target_temperature(self) -> float:
Expand Down
9 changes: 5 additions & 4 deletions custom_components/rointe/sensor_descriptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sensor descriptions for Rointe."""

from __future__ import annotations

from collections.abc import Callable
Expand All @@ -10,7 +11,7 @@
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import ENERGY_KILO_WATT_HOUR, POWER_WATT, TEMP_CELSIUS
from homeassistant.const import UnitOfEnergy, UnitOfPower, UnitOfTemperature
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.typing import StateType

Expand Down Expand Up @@ -38,7 +39,7 @@ class RointeSensorEntityDescription(
key="current_temperature",
name="Current Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=TEMP_CELSIUS,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda radiator: radiator.temp_probe,
last_reset_fn=lambda radiator: None,
Expand All @@ -48,7 +49,7 @@ class RointeSensorEntityDescription(
key="energy",
name="Energy Consumption",
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL,
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda radiator: radiator.energy_data.kwh
Expand All @@ -63,7 +64,7 @@ class RointeSensorEntityDescription(
key="power",
name="Effective Power",
device_class=SensorDeviceClass.POWER,
native_unit_of_measurement=POWER_WATT,
native_unit_of_measurement=UnitOfPower.WATT,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda radiator: radiator.energy_data.effective_power
Expand Down