Add esphome sensor tests (#95077)
This commit is contained in:
parent
c7f2dab13c
commit
66b2214c55
3 changed files with 183 additions and 4 deletions
|
@ -95,9 +95,7 @@ class EsphomeSensor(EsphomeEntity[SensorInfo, SensorState], SensorEntity):
|
|||
def native_value(self) -> datetime | str | None:
|
||||
"""Return the state of the entity."""
|
||||
state = self._state
|
||||
if math.isnan(state.state):
|
||||
return None
|
||||
if state.missing_state:
|
||||
if math.isnan(state.state) or state.missing_state:
|
||||
return None
|
||||
if self._attr_device_class == SensorDeviceClass.TIMESTAMP:
|
||||
return dt_util.utc_from_timestamp(state.state)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue