Use UnitOfEnergy.KILO_CALORIE in Tractive integration (#131909)
parent
790edea4a0
commit
2a127d19dd
|
@ -16,6 +16,7 @@ from homeassistant.const import (
|
||||||
ATTR_BATTERY_LEVEL,
|
ATTR_BATTERY_LEVEL,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
EntityCategory,
|
EntityCategory,
|
||||||
|
UnitOfEnergy,
|
||||||
UnitOfTime,
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
@ -127,7 +128,7 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
|
||||||
TractiveSensorEntityDescription(
|
TractiveSensorEntityDescription(
|
||||||
key=ATTR_CALORIES,
|
key=ATTR_CALORIES,
|
||||||
translation_key="calories",
|
translation_key="calories",
|
||||||
native_unit_of_measurement="kcal",
|
native_unit_of_measurement=UnitOfEnergy.KILO_CALORIE,
|
||||||
signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED,
|
signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED,
|
||||||
state_class=SensorStateClass.TOTAL,
|
state_class=SensorStateClass.TOTAL,
|
||||||
),
|
),
|
||||||
|
|
|
@ -139,7 +139,7 @@
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': 'calories',
|
'translation_key': 'calories',
|
||||||
'unique_id': 'pet_id_123_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]
|
# name: test_sensor[sensor.test_pet_calories_burned-state]
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
'attributes': ReadOnlyDict({
|
'attributes': ReadOnlyDict({
|
||||||
'friendly_name': 'Test Pet Calories burned',
|
'friendly_name': 'Test Pet Calories burned',
|
||||||
'state_class': <SensorStateClass.TOTAL: 'total'>,
|
'state_class': <SensorStateClass.TOTAL: 'total'>,
|
||||||
'unit_of_measurement': 'kcal',
|
'unit_of_measurement': <UnitOfEnergy.KILO_CALORIE: 'kcal'>,
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
'entity_id': 'sensor.test_pet_calories_burned',
|
'entity_id': 'sensor.test_pet_calories_burned',
|
||||||
|
|
Loading…
Reference in New Issue