jbouwh / omnikdatalogger

Datalogger for Omnik solar power inverters with DSMR integration and output to Home Assistant, PVOUTPUT, InfluxDB and MQTT
https://jbsoft.nl/site/omnik-datalogger/
GNU General Public License v3.0
10 stars 3 forks source link

Update value template filter for MQTT timestamp sensors #46

Closed jbouwh closed 2 years ago

jbouwh commented 2 years ago

From Home Assistant 2021.12.0 sensors with device_class == timestamp need be be assigned a native datetime type. The current implementation uses string formatted timestamps. But this will give warnings in the log.

This PR changes the value_template for the MQTT timestamp sensors of omnikdatalogger. The current filter |timestamp_local will be replaced with |as_datetime. The as_datetime filter will only allow time formatted strings with the current release of Home Assistant. The Home Assistant PR https://github.com/home-assistant/core/pull/60126 will add a UNIX timestamp filter to allow a direct conversion to datetime. For the PR to be merged it is needed that this new functionality of the as_datetime filter also comes available in Home Assistant 2021.12.0.

jbouwh commented 2 years ago

This PR will be implemented later.