Use native datetime value in Tasmota sensors (#59915)
parent
fc330f797d
commit
3adb9e4143
|
@ -259,10 +259,10 @@ class TasmotaSensor(TasmotaAvailability, TasmotaDiscoveryUpdate, SensorEntity):
|
||||||
return class_or_icon.get(ICON)
|
return class_or_icon.get(ICON)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> str | None:
|
def native_value(self) -> datetime | str | None:
|
||||||
"""Return the state of the entity."""
|
"""Return the state of the entity."""
|
||||||
if self._state_timestamp and self.device_class == DEVICE_CLASS_TIMESTAMP:
|
if self._state_timestamp and self.device_class == DEVICE_CLASS_TIMESTAMP:
|
||||||
return self._state_timestamp.isoformat()
|
return self._state_timestamp
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in New Issue