Hello,
I'm running the Docker image and using Home Assistant 2026.8.1. Home Assistant repeatedly logs the following warning:
Logger: homeassistant.helpers.template
Source: helpers/template/__init__.py:685
Template variable warning: 'dict object' has no attribute 'history_event_list_1_datetime' when rendering '{{ value_json.history_event_list_1_datetime }}'
This occurred 400 times over ~26 minutes, so it's firing on (or near) every MQTT publish cycle.
Cause (as far as I can tell from SOFAR-HYD-3PH-AND-G3.json):
history_event_list_1 is a "normal" register (read directly at 0x1480), but history_event_list_1_datetime has no register field — it's computed via aggregate_datetime_bitmap from three separate registers (year_month 0x1481, day_hour 0x1482, minute_second 0x1483):
{
"name": "history_event_list_1_datetime",
"aggregate_datetime_bitmap": {
"year_month": "0x1481",
"day_hour": "0x1482",
"minute_second": "0x1483"
},
"ha": {
"name": "History Event List 1 - DateTime",
"value_template": "{{ value_json.history_event_list_1_datetime }}"
}
}
It looks like this computed key isn't always included in the sofar/state_all JSON payload — possibly only when the aggregation produces a non-empty/valid result. Since the HA auto-discovery config points value_template directly at value_json.history_event_list_1_datetime with no fallback, HA logs a warning every time the key is absent from the payload.
Suggested fix:
Either:
- Always include
history_event_list_1_datetime in state_all (e.g. null/empty string when the aggregate has no valid data yet), so the key is consistently present, or
- Add a default to the generated
value_template, e.g. {{ value_json.history_event_list_1_datetime | default('') }}, so HA doesn't warn when the key is briefly absent.
Happy to test a fix if useful — thanks for the great project!
Hello,
I'm running the Docker image and using Home Assistant 2026.8.1. Home Assistant repeatedly logs the following warning:
This occurred 400 times over ~26 minutes, so it's firing on (or near) every MQTT publish cycle.
Cause (as far as I can tell from
SOFAR-HYD-3PH-AND-G3.json):history_event_list_1is a "normal" register (read directly at0x1480), buthistory_event_list_1_datetimehas noregisterfield — it's computed viaaggregate_datetime_bitmapfrom three separate registers (year_month0x1481,day_hour0x1482,minute_second0x1483):{ "name": "history_event_list_1_datetime", "aggregate_datetime_bitmap": { "year_month": "0x1481", "day_hour": "0x1482", "minute_second": "0x1483" }, "ha": { "name": "History Event List 1 - DateTime", "value_template": "{{ value_json.history_event_list_1_datetime }}" } }It looks like this computed key isn't always included in the
sofar/state_allJSON payload — possibly only when the aggregation produces a non-empty/valid result. Since the HA auto-discovery config pointsvalue_templatedirectly atvalue_json.history_event_list_1_datetimewith no fallback, HA logs a warning every time the key is absent from the payload.Suggested fix:
Either:
history_event_list_1_datetimeinstate_all(e.g.null/empty string when the aggregate has no valid data yet), so the key is consistently present, orvalue_template, e.g.{{ value_json.history_event_list_1_datetime | default('') }}, so HA doesn't warn when the key is briefly absent.Happy to test a fix if useful — thanks for the great project!