Skip to content
Snippets Groups Projects
Unverified Commit 76d6a1fe authored by J. Nick Koston's avatar J. Nick Koston Committed by GitHub
Browse files

Use identity check for ESPHome sensor device_class (#121828)

parent df8c9498
No related branches found
No related tags found
No related merge requests found
......@@ -99,7 +99,7 @@ class EsphomeSensor(EsphomeEntity[SensorInfo, SensorState], SensorEntity):
state = self._state
if state.missing_state or not math.isfinite(state.state):
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 f"{state.state:.{self._static_info.accuracy_decimals}f}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment