Skip to content

Commit

Permalink
refactor: Updated to use non deprecated enums
Browse files Browse the repository at this point in the history
  • Loading branch information
BottlecapDave committed Sep 28, 2022
1 parent 7ab9b2d commit 6594ede
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions custom_components/octopus_energy/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
DataUpdateCoordinator
)
from homeassistant.components.sensor import (
DEVICE_CLASS_MONETARY,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_GAS,
STATE_CLASS_TOTAL_INCREASING,
SensorDeviceClass,
SensorEntity,
SensorStateClass
)
from homeassistant.const import (
ENERGY_KILO_WATT_HOUR,
Expand Down Expand Up @@ -206,7 +204,7 @@ def name(self):
@property
def device_class(self):
"""The type of sensor"""
return DEVICE_CLASS_MONETARY
return SensorDeviceClass.MONETARY

@property
def icon(self):
Expand Down Expand Up @@ -284,7 +282,7 @@ def name(self):
@property
def device_class(self):
"""The type of sensor"""
return DEVICE_CLASS_MONETARY
return SensorDeviceClass.MONETARY

@property
def icon(self):
Expand Down Expand Up @@ -358,12 +356,12 @@ def name(self):
@property
def device_class(self):
"""The type of sensor"""
return DEVICE_CLASS_ENERGY
return SensorDeviceClass.ENERGY

@property
def state_class(self):
"""The state class of sensor"""
return STATE_CLASS_TOTAL_INCREASING
return SensorStateClass.TOTAL_INCREASING

@property
def unit_of_measurement(self):
Expand Down Expand Up @@ -432,12 +430,12 @@ def name(self):
@property
def device_class(self):
"""The type of sensor"""
return DEVICE_CLASS_MONETARY
return SensorDeviceClass.MONETARY

@property
def state_class(self):
"""The state class of sensor"""
return STATE_CLASS_TOTAL_INCREASING
return SensorStateClass.TOTAL_INCREASING

@property
def unit_of_measurement(self):
Expand Down Expand Up @@ -545,7 +543,7 @@ def name(self):
@property
def device_class(self):
"""The type of sensor"""
return DEVICE_CLASS_MONETARY
return SensorDeviceClass.MONETARY

@property
def icon(self):
Expand Down Expand Up @@ -624,12 +622,12 @@ def name(self):
@property
def device_class(self):
"""The type of sensor"""
return DEVICE_CLASS_GAS
return SensorDeviceClass.GAS

@property
def state_class(self):
"""The state class of sensor"""
return STATE_CLASS_TOTAL_INCREASING
return SensorStateClass.TOTAL_INCREASING

@property
def unit_of_measurement(self):
Expand Down Expand Up @@ -698,12 +696,12 @@ def name(self):
@property
def device_class(self):
"""The type of sensor"""
return DEVICE_CLASS_MONETARY
return SensorDeviceClass.MONETARY

@property
def state_class(self):
"""The state class of sensor"""
return STATE_CLASS_TOTAL_INCREASING
return SensorStateClass.TOTAL_INCREASING

@property
def unit_of_measurement(self):
Expand Down

0 comments on commit 6594ede

Please sign in to comment.