Skip to content

Commit

Permalink
Add state_class to starline sensors to generate long-term statistics (h…
Browse files Browse the repository at this point in the history
…ome-assistant#123540)

* starline: Add state_class to sensors to generate long-term statistics

* starline: Add 'errors' unit to 'errors' sensor
  • Loading branch information
Chupaka authored Aug 11, 2024
1 parent 7aed35b commit 9be8616
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions homeassistant/components/starline/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
Expand All @@ -30,47 +31,57 @@
translation_key="battery",
device_class=SensorDeviceClass.VOLTAGE,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="balance",
translation_key="balance",
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="ctemp",
translation_key="interior_temperature",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="etemp",
translation_key="engine_temperature",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="gsm_lvl",
translation_key="gsm_signal",
native_unit_of_measurement=PERCENTAGE,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="fuel",
translation_key="fuel",
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="errors",
translation_key="errors",
native_unit_of_measurement="errors",
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="mileage",
translation_key="mileage",
native_unit_of_measurement=UnitOfLength.KILOMETERS,
device_class=SensorDeviceClass.DISTANCE,
state_class=SensorStateClass.TOTAL_INCREASING,
),
SensorEntityDescription(
key="gps_count",
translation_key="gps_count",
native_unit_of_measurement="satellites",
state_class=SensorStateClass.MEASUREMENT,
),
)

Expand Down

0 comments on commit 9be8616

Please sign in to comment.