jbouwh / omnikdatalogger

Datalogger for Omnik solar power inverters with DSMR integration and output to Home Assistant, PVOUTPUT, InfluxDB and MQTT

Home Page:https://jbsoft.nl/site/omnik-datalogger/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MQTT Warnings in home assistant core log

jbouwh opened this issue · comments

Background

When the sun is down, omnik inverters stop providing data. Omnikdatalogger caches the last total_energy and today_enery. Other attributes are omitted. This causes warning in the log wen using the MQTT auto discovery in Home Assistant.

2021-10-07 06:35:08 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'operation_hours' when rendering '{{(value_json.operation_hours)}}'
2021-10-07 06:35:08 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'current_power_pv' when rendering '{{(value_json.current_power_pv)}}'
2021-10-07 06:40:08 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'current_power' when rendering '{{(value_json.current_power)}}'
2021-10-07 06:40:08 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_ac1' when rendering '{{(value_json.power_ac1)}}'
2021-10-07 06:40:08 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_pv1' when rendering '{{(value_json.power_pv1)}}'
2021-10-07 06:40:08 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_pv2' when rendering '{{(value_json.power_pv2)}}'

Cause

Omnikdatalogger publishes al inverter states over one shared state topic, but all entities listening to this state topic will be triggered. When certain attributes are omitted (the ones shown in the log), Home Assistant cannot update the state, which it should not, but it still causes a warning.

Possible solutions:

Possible solutions are:

  • Use a unique state topic for each attribute.
  • Publish all attributes, even at night, using cached values. Power attributes can be set to 0.

Using a state per attribute will give much more payload, and will break usecases for MQTT-users not using Home Assistant.
Adding this missing attributes will take away the warnings. A disadvantage is that updates need to be processed, even when there is no update. For users that do not want to retain MQTT messages this will be good, since the state will recover automatically for these attributes.

P.S. The warnings do not impact presenting the correct values over MQTT.

Fixed with release v1.7.5