From b910bc78026f79a04a292516f95d580130434653 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker <joostlek@outlook.com> Date: Sat, 8 Mar 2025 19:58:10 +0100 Subject: [PATCH] Set device class for Oven Completion time in SmartThings (#140139) --- homeassistant/components/smartthings/sensor.py | 2 ++ tests/components/smartthings/snapshots/test_sensor.ambr | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/smartthings/sensor.py b/homeassistant/components/smartthings/sensor.py index 2164e432edc..5a2fdcf3854 100644 --- a/homeassistant/components/smartthings/sensor.py +++ b/homeassistant/components/smartthings/sensor.py @@ -561,6 +561,8 @@ CAPABILITY_TO_SENSORS: dict[ SmartThingsSensorEntityDescription( key=Attribute.COMPLETION_TIME, translation_key="completion_time", + device_class=SensorDeviceClass.TIMESTAMP, + value_fn=dt_util.parse_datetime, ) ], }, diff --git a/tests/components/smartthings/snapshots/test_sensor.ambr b/tests/components/smartthings/snapshots/test_sensor.ambr index 5909fec2707..b939547ca32 100644 --- a/tests/components/smartthings/snapshots/test_sensor.ambr +++ b/tests/components/smartthings/snapshots/test_sensor.ambr @@ -1710,7 +1710,7 @@ 'name': None, 'options': dict({ }), - 'original_device_class': None, + 'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>, 'original_icon': None, 'original_name': 'Completion time', 'platform': 'smartthings', @@ -1724,6 +1724,7 @@ # name: test_all_entities[da_ks_microwave_0101x][sensor.microwave_completion_time-state] StateSnapshot({ 'attributes': ReadOnlyDict({ + 'device_class': 'timestamp', 'friendly_name': 'Microwave Completion time', }), 'context': <ANY>, @@ -1731,7 +1732,7 @@ 'last_changed': <ANY>, 'last_reported': <ANY>, 'last_updated': <ANY>, - 'state': '2025-02-08T21:13:36.184Z', + 'state': '2025-02-08T21:13:36+00:00', }) # --- # name: test_all_entities[da_ks_microwave_0101x][sensor.microwave_job_state-entry] -- GitLab