Repository navigation
LoadML Error: ML Component: Failed during ML work:...... #4407
Replies: 1 comment 1 reply
|
Odd I can't explain why load ML is failing with the template that's in the documentation, I wrote that template and am using it quite successfully as the load_today input in my apps.yaml with LoadML enabled. The only suggestion I have is that maybe the midnight rollover is confusing load ML as I have a slightly different version of the template in use: I have three inverters so you'll have to cut it down to match your single inverter setup, but basically it's the same but with additional logic to roll the sensor to zero at midnight. I found that since givtcp polls every 30 seconds the battery charge/discharge, PV gen, etc would reset to zero at anywhere between 00:00:00 and 00:00:30 and this caused problems in HA displays. I don't recall that it was a problem with Load ML but I had changed this a while ago so maybe pre-empted load ML. Try this. I'll need to update the documentation with this latest version |
Uh oh!
There was an error while loading. Please reload this page.
I get this error in my predbat log, and the LoadML chart fails to increment:
2026-08-01 11:44:32.671763: Error: ML Component: Failed during ML work: Traceback (most recent call last):
File "/config/load_ml_component.py", line 760, in run
self._publish_entity()
File "/config/load_ml_component.py", line 1028, in _publish_entity
output_value = round(value - reset_amount + self.load_minutes_now, 4)
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'LoadMLComponent' object has no attribute 'load_minutes_now'. Did you mean: 'minutes_now'?
This is when I use a template helper sensor to calculate load_energy_today because the GivTCP sensor for this appears to be wrong. My template sensor code is (adapted from the predbat documentation, and is giving sensible values) - located in configuration.yaml:
- trigger: - platform: time_pattern minutes: "/5" sensor: - name: "House Load Today" unique_id: "house_load_today" unit_of_measurement: kWh state_class: total device_class: energy state: > {% set pv = states('sensor.givtcp_fe2446a022_pv_energy_today_kwh') %} {% set dis = states('sensor.givtcp_fe2446a022_battery_discharge_energy_today_kwh') %} {% set chg = states('sensor.givtcp_fe2446a022_battery_charge_energy_today_kwh') %} {% set import = states('sensor.givtcp_fe2446a022_import_energy_today_kwh') %} {% set export = states('sensor.givtcp_fe2446a022_export_energy_today_kwh') %} {% if pv in ['unknown','unavailable'] or dis in ['unknown','unavailable'] or chg in ['unknown','unavailable'] or import in ['unknown','unavailable'] or export in ['unknown','unavailable'] %} {{ this.state }} {% else %} {% if now().hour == 0 and now().minute < 1 %} 0.0 {% else %} {% set load = (import | float(0) + pv | float(0) + dis | float(0) - export | float(0) - chg | float(0)) | round(2) %} {% set previous = this.state | float(0) %} {{ [load, previous] | max }} {% endif %} {% endif %}If I use an alternative template helper sensor I don't get the same error, and the LoadML chart does increment.
{{ (states('sensor.givtcp_fe2446a022_load_energy_today_kwh')|float(0)) - (states('sensor.givtcp_fe2446a022_pv_energy_today_kwh')|float(0)) }}All reactions