Skip to content

Commit

Permalink
Update sensor.py (#28)
Browse files Browse the repository at this point in the history
Fixes to update deprecated Constants to be removed in HA Core 2025.1
  • Loading branch information
Know1 authored Apr 5, 2024
1 parent 88d90a7 commit a0d18a4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions custom_components/powerpal/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from homeassistant.components.sensor import (
SensorEntity,
SensorDeviceClass,
STATE_CLASS_TOTAL_INCREASING,
STATE_CLASS_MEASUREMENT,
SensorStateClass,
)
from homeassistant.const import (
UnitOfPower,
Expand Down Expand Up @@ -74,7 +73,7 @@ def device_class(self) -> str:
@property
def state_class(self) -> str:
"""Return the state class."""
return STATE_CLASS_TOTAL_INCREASING
return SensorStateClass.TOTAL_INCREASING

@property
def native_unit_of_measurement(self) -> str:
Expand Down Expand Up @@ -106,7 +105,7 @@ def device_class(self) -> str:
@property
def state_class(self) -> str:
"""Return the state class."""
return STATE_CLASS_MEASUREMENT
return SensorStateClass.MEASUREMENT

@property
def native_unit_of_measurement(self) -> str:
Expand Down

0 comments on commit a0d18a4

Please sign in to comment.