Skip to content

Commit

Permalink
Merge pull request #41 from skipishere/patch-1
Browse files Browse the repository at this point in the history
Update deprecated constants
  • Loading branch information
markvader authored Jan 2, 2025
2 parents 5ecf30d + 1bea9cb commit 5b05894
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions custom_components/sonic/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
PRESSURE_BAR,
TEMP_CELSIUS,
VOLUME_LITERS,
TIME_MINUTES,
VOLUME_LITERS,
UnitOfPressure,
UnitOfTemperature,
UnitOfVolume,
UnitOfTime,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
Expand Down Expand Up @@ -105,7 +104,7 @@ class SonicTemperatureSensor(SonicEntity, SensorEntity):
"""Monitors the water temperature."""

_attr_device_class = SensorDeviceClass.TEMPERATURE
_attr_native_unit_of_measurement = TEMP_CELSIUS
_attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
_attr_state_class: SensorStateClass = SensorStateClass.MEASUREMENT

def __init__(self, device):
Expand All @@ -125,7 +124,7 @@ class SonicPressureSensor(SonicEntity, SensorEntity):
"""Monitors the water pressure."""

_attr_device_class = SensorDeviceClass.PRESSURE
_attr_native_unit_of_measurement = PRESSURE_BAR
_attr_native_unit_of_measurement = UnitOfPressure.BAR
_attr_state_class: SensorStateClass = SensorStateClass.MEASUREMENT

def __init__(self, device):
Expand Down Expand Up @@ -222,7 +221,7 @@ class SonicAutoShutOffTimeLimitSensor(SonicEntity, SensorEntity):
"""Return the auto_shut_off_time_limit state"""

_attr_icon = TIMER_ICON
_attr_native_unit_of_measurement = TIME_MINUTES
_attr_native_unit_of_measurement = UnitOfTime.MINUTES
_attr_entity_category = EntityCategory.DIAGNOSTIC

def __init__(self, device):
Expand All @@ -240,7 +239,7 @@ class SonicAutoShutOffVolumeLimitSensor(SonicEntity, SensorEntity):
"""Return the auto_shut_off_volume_limit state"""

_attr_icon = VOLUME_ICON
_attr_native_unit_of_measurement = VOLUME_LITERS
_attr_native_unit_of_measurement = UnitOfVolume.LITERS
_attr_entity_category = EntityCategory.DIAGNOSTIC

def __init__(self, device):
Expand All @@ -257,7 +256,7 @@ class PropertyLongFlowNotificationDelay(PropertyEntity, SensorEntity):
"""Return the long flow notification delay in minutes at property"""

_attr_icon = TIMER_ICON
_attr_native_unit_of_measurement = TIME_MINUTES
_attr_native_unit_of_measurement = UnitOfTime.MINUTES
_attr_entity_category = EntityCategory.DIAGNOSTIC

def __init__(self, property):
Expand All @@ -274,7 +273,7 @@ class PropertyHighVolumeNotificationThresholdLitres(PropertyEntity, SensorEntity
"""Return the high_volume_threshold_litres at property"""

_attr_icon = TIMER_ICON
_attr_native_unit_of_measurement = VOLUME_LITERS
_attr_native_unit_of_measurement = UnitOfVolume.LITERS
_attr_entity_category = EntityCategory.DIAGNOSTIC

def __init__(self, property):
Expand Down

0 comments on commit 5b05894

Please sign in to comment.