From 77a74a9bf4a64315759f7987e0962e2fb5c36f5b Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 8 Dec 2021 11:44:53 -0800 Subject: [PATCH] Fix smartthings timestamp sensor (#61254) --- homeassistant/components/smartthings/sensor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/smartthings/sensor.py b/homeassistant/components/smartthings/sensor.py index eab840bd629..fa749e07dfb 100644 --- a/homeassistant/components/smartthings/sensor.py +++ b/homeassistant/components/smartthings/sensor.py @@ -38,6 +38,7 @@ from homeassistant.const import ( TEMP_FAHRENHEIT, VOLUME_CUBIC_METERS, ) +from homeassistant.util import dt as dt_util from . import SmartThingsEntity from .const import DATA_BROKERS, DOMAIN @@ -656,7 +657,12 @@ class SmartThingsSensor(SmartThingsEntity, SensorEntity): @property def native_value(self): """Return the state of the sensor.""" - return self._device.status.attributes[self._attribute].value + value = self._device.status.attributes[self._attribute].value + + if self._device_class != DEVICE_CLASS_TIMESTAMP: + return value + + return dt_util.parse_datetime(value) @property def device_class(self):