mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Use identity check for ESPHome sensor device_class (#121828)
This commit is contained in:
parent
df8c949884
commit
76d6a1fe13
@ -99,7 +99,7 @@ class EsphomeSensor(EsphomeEntity[SensorInfo, SensorState], SensorEntity):
|
|||||||
state = self._state
|
state = self._state
|
||||||
if state.missing_state or not math.isfinite(state.state):
|
if state.missing_state or not math.isfinite(state.state):
|
||||||
return None
|
return None
|
||||||
if self._attr_device_class == SensorDeviceClass.TIMESTAMP:
|
if self._attr_device_class is SensorDeviceClass.TIMESTAMP:
|
||||||
return dt_util.utc_from_timestamp(state.state)
|
return dt_util.utc_from_timestamp(state.state)
|
||||||
return f"{state.state:.{self._static_info.accuracy_decimals}f}"
|
return f"{state.state:.{self._static_info.accuracy_decimals}f}"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user