sleevezipper / hass-workstation-service

Provide useful sensors and services from your workstation to Home Assistant.
Apache License 2.0
613 stars 54 forks source link

Missing TimeZone information breaks LastActive sensor (HA 2021.12.0b6) #145

Closed ccorderod closed 2 years ago

ccorderod commented 2 years ago

Hi. Missing TimeZone information on timestamp device_class sensors (aka LastActive) breaks the sensor on HA 2021.12.0b6.

Exception in message_received when handling msg on 'homeassistant/sensor/G02ESXN04197/G02ESXN04197LastActive/state': '2021-12-10T13:49:02' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 37, in wrapper msg_callback(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 249, in message_received self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _async_write_ha_state state = self._stringify_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 511, in _stringify_state if (state := self.state) is None: File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 411, in state raise ValueError( ValueError: Invalid datetime: sensor.g02esxn04197lastactive provides state '2021-12-10 13:49:02', which is missing timezone information

Hankanman commented 2 years ago

Can confirm, seeing the same behaviour here

kailashrao commented 2 years ago

Same Here,

image

It seems the timestamp formatting has changed ^

sleevezipper commented 2 years ago

Thanks for creating an issue! I'm seeing this as well. I'll work on a fix.

sleevezipper commented 2 years ago

Fixed! I'll put out a new release later today.

ccorderod commented 2 years ago

@sleevezipper Thanks!. Merry Christmas :).

varunsridharan commented 2 years ago

Same issue.. waiting for the new release