From 2a127d19dd9def22c816261e536641550b5d9f80 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Tue, 10 Dec 2024 09:50:53 +0100 Subject: [PATCH] Use UnitOfEnergy.KILO_CALORIE in Tractive integration (#131909) --- homeassistant/components/tractive/sensor.py | 3 ++- tests/components/tractive/snapshots/test_sensor.ambr | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/tractive/sensor.py b/homeassistant/components/tractive/sensor.py index a92efa660b6..a3c1893267c 100644 --- a/homeassistant/components/tractive/sensor.py +++ b/homeassistant/components/tractive/sensor.py @@ -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, ), diff --git a/tests/components/tractive/snapshots/test_sensor.ambr b/tests/components/tractive/snapshots/test_sensor.ambr index f1ed397450e..f10cfb29226 100644 --- a/tests/components/tractive/snapshots/test_sensor.ambr +++ b/tests/components/tractive/snapshots/test_sensor.ambr @@ -139,7 +139,7 @@ 'supported_features': 0, 'translation_key': 'calories', 'unique_id': 'pet_id_123_calories', - 'unit_of_measurement': 'kcal', + 'unit_of_measurement': , }) # --- # name: test_sensor[sensor.test_pet_calories_burned-state] @@ -147,7 +147,7 @@ 'attributes': ReadOnlyDict({ 'friendly_name': 'Test Pet Calories burned', 'state_class': , - 'unit_of_measurement': 'kcal', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.test_pet_calories_burned',