elad-bar / Hassio-addons

10 stars 16 forks source link

missing timezone information Error since homeassistant 2021.12 #14

Open vlebeau60 opened 2 years ago

vlebeau60 commented 2 years ago

Hello! I have just update my homeassistant to 2021.12.6 (from 2021.11) and I have this error since the update:

Exception in message_received when handling msg on 'DahuaVTO/SIPRegisterResult/Event': '{ "Action": "Pulse", "Code": "SIPRegisterResult", "Data": { "Date": "29-12-2021 15:36:11", "LocaleTime": "2021-12-29 15:36:11", "Success": true, "UTC": 1640788571.0 }, "Index": 0 }' 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.dahuavto_communication provides state '2021-12-29 15:36:11', which is missing timezone information

vlebeau60 commented 2 years ago

Hi, I've found the problem. It is my sensor in HA, i have to remove device_class

  - platform: mqtt
    name: "DahuaVTO Communication"
    state_topic: "DahuaVTO/SIPRegisterResult/Event"
    value_template: '{{ value_json.Data.LocaleTime }}'
#    device_class: timestamp