Skip to content

Commit

Permalink
Merge pull request #62 from basilfx/feature/statistics
Browse files Browse the repository at this point in the history
Set sensor state class to enable statistics
  • Loading branch information
basilfx committed Nov 16, 2022
2 parents 4f1e990 + 5cc1256 commit 3206684
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/biketrax/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
Expand Down Expand Up @@ -50,6 +51,7 @@ class BikeTraxSensorEntityDescription(
key="battery_level",
name="Battery level",
native_unit_of_measurement=PERCENTAGE,
state_class=SensorStateClass.MEASUREMENT,
),
BikeTraxSensorEntityDescription(
coordinator=DATA_DEVICE,
Expand All @@ -58,6 +60,7 @@ class BikeTraxSensorEntityDescription(
key="total_distance",
name="Total distance",
native_unit_of_measurement=LENGTH_KILOMETERS,
state_class=SensorStateClass.TOTAL_INCREASING,
),
BikeTraxSensorEntityDescription(
coordinator=DATA_DEVICE,
Expand All @@ -66,6 +69,7 @@ class BikeTraxSensorEntityDescription(
key="speed",
name="Current speed",
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
state_class=SensorStateClass.MEASUREMENT,
),
BikeTraxSensorEntityDescription(
coordinator=DATA_SUBSCRIPTION,
Expand Down

0 comments on commit 3206684

Please sign in to comment.