Closed drzero42 closed 1 year ago
I see that @mjenda already did a PR for this. Any chance we can get it merged soon?
Same issue here.
Source: util/logging.py:168
First occurred: 11:05:48 (1 occurrences)
Last logged: 11:05:48
Exception in message_received when handling msg on 'etrv/Elutuba suur radiaator/state': '{"name": "Elutuba", "battery": 88, "room_temp": 24.0, "set_point": 23.0, "last_update": "2022-10-09 11:05:48.319576"}' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 44, in wrapper msg_callback(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 303, in message_received self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state if (state := self.state) is None: File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 414, in state raise ValueError( ValueError: Invalid datetime: sensor.elutuba_suur_radiaator_last_update provides state '2022-10-09 11:05:48.319576', which is missing timezone information```
As a temporary solution I just created a few tempate sensors to grab the values from the MQTT sensors to have LTS (long term statistics) support.
- name: Elutuba suur radiaator temperatuur
unique_id: living_room_large_radiator_temperature
device_class: temperature
state_class: measurement
unit_of_measurement: "°C"
icon: "mdi:radiator"
state: >
{{ state_attr('climate.elutuba_suur_radiaator_thermostat', 'current_temperature') | float }}
availability: >
{{ states('climate.elutuba_suur_radiaator_thermostat') not in ['unknown', 'unavailable'] }}
- name: Elutuba suur radiaator power
unique_id: living_room_large_radiator_power
device_class: battery
state_class: measurement
unit_of_measurement: "%"
icon: "mdi:radiator"
state: >
{{ states('sensor.elutuba_suur_radiaator_battery') | int }}
availability: >
{{ states('sensor.elutuba_suur_radiaator_battery') not in ['unknown', 'unavailable'] }}```
So much for that, it looks like 2022.10.4 killed that.
fixed
Since upgrading to Home Assistant 2021.12, I am receiving errors in my log, because the Last Updated values from etrv2mqtt do not contain timezone information. This means that in Home Assistant, my thermostats will have a value of "Unknown" in the Last Updated field.
This is one of the errors from my logs:
As far as I can tell, it should be enough to add
timezone.utc
to thedatetime.now()
call (timezone needs to be imported from the datetime module). That would be here: https://github.com/keton/etrv2mqtt/blob/626f6f5cf3b30f86bf9bb0d1e4608aee70aa4b00/etrv2mqtt/etrvutils.py#L34Here is my small little test of it: