Use UnitOfEnergy.KILO_CALORIE in Tractive integration (#131909)

pull/132817/head
Maciej Bieniek 2024-12-10 09:50:53 +01:00 committed by GitHub
parent 790edea4a0
commit 2a127d19dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -16,6 +16,7 @@ from homeassistant.const import (
ATTR_BATTERY_LEVEL,
PERCENTAGE,
EntityCategory,
UnitOfEnergy,
UnitOfTime,
)
from homeassistant.core import HomeAssistant, callback
@ -127,7 +128,7 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
TractiveSensorEntityDescription(
key=ATTR_CALORIES,
translation_key="calories",
native_unit_of_measurement="kcal",
native_unit_of_measurement=UnitOfEnergy.KILO_CALORIE,
signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED,
state_class=SensorStateClass.TOTAL,
),

View File

@ -139,7 +139,7 @@
'supported_features': 0,
'translation_key': 'calories',
'unique_id': 'pet_id_123_calories',
'unit_of_measurement': 'kcal',
'unit_of_measurement': <UnitOfEnergy.KILO_CALORIE: 'kcal'>,
})
# ---
# name: test_sensor[sensor.test_pet_calories_burned-state]
@ -147,7 +147,7 @@
'attributes': ReadOnlyDict({
'friendly_name': 'Test Pet Calories burned',
'state_class': <SensorStateClass.TOTAL: 'total'>,
'unit_of_measurement': 'kcal',
'unit_of_measurement': <UnitOfEnergy.KILO_CALORIE: 'kcal'>,
}),
'context': <ANY>,
'entity_id': 'sensor.test_pet_calories_burned',