Skip to content

Commit 1afcbd2

Browse files
committedDec 27, 2024·
Add sensor class to boiler usage sensors
1 parent 1ee4199 commit 1afcbd2

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed
 

‎custom_components/eldom/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"requirements": ["pyeldom==0.4.1"],
1212
"ssdp": [],
1313
"zeroconf": [],
14-
"version": "3.1.2"
14+
"version": "3.2.0"
1515
}

‎custom_components/eldom/sensor.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
import logging
44

5-
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
5+
from homeassistant.components.sensor import (
6+
SensorDeviceClass,
7+
SensorEntity,
8+
SensorStateClass,
9+
)
610
from homeassistant.config_entries import ConfigEntry
711
from homeassistant.const import UnitOfEnergy
812
from homeassistant.core import HomeAssistant, callback
@@ -120,6 +124,11 @@ def device_class(self) -> SensorDeviceClass:
120124
"""Return the device class of the sensor."""
121125
return SensorDeviceClass.ENERGY
122126

127+
@property
128+
def state_class(self) -> SensorStateClass:
129+
"""Return the state class of the sensor."""
130+
return SensorStateClass.TOTAL_INCREASING
131+
123132
@property
124133
def native_unit_of_measurement(self) -> str:
125134
"""Return the unit of measurement."""
@@ -178,6 +187,11 @@ def device_class(self) -> SensorDeviceClass:
178187
"""Return the device class of the sensor."""
179188
return SensorDeviceClass.ENERGY
180189

190+
@property
191+
def state_class(self) -> SensorStateClass:
192+
"""Return the state class of the sensor."""
193+
return SensorStateClass.TOTAL_INCREASING
194+
181195
@property
182196
def native_unit_of_measurement(self) -> str:
183197
"""Return the unit of measurement."""

0 commit comments

Comments
 (0)
Please sign in to comment.