SMA Inverter readings not showing up in Energy Dashboard

The objective is to get solar panel production data in the Home Assistant Energy dashboard.

On the MQTT broker in HomeAssistant messages are received from SBFspot which contain solar production data of the SMA Sunny Boy 5000-TL21 inverter. This is an example of a message, which was received this afternoon (taken from the HA Mosquitto MQTT broker add-on):

{
    "Timestamp": "26/01/2023 16:25:03",
    "SunRise": "26/01/2023 08:31:00",
    "SunSet": "26/01/2023 17:13:00",
    "InvSerial": xxxxxxxxxx,
    "InvName": "SN: xxxxxxxxxx",
    "InvTime": "26/01/2023 16:24:54",
    "InvStatus": "Ok",
    "InvTemperature": 15.13,
    "InvGridRelay": "Closed",
    "EToday": 3.038,
    "ETotal": 37774.256,
    "PACTot": 27,
    "UDC1": 323.22,
    "UDC2": 304.84,
    "IDC1": 0.082,
    "IDC2": 0.171,
    "PDC1": 26,
    "PDC2": 52
}

Two MQTT sensors have been configured in HA:

mqtt:
  sensor:
    - name: "Solar_Panels.EToday"
      unique_id: "solar_panels.etoday"
      state_topic: "sbfspot"
      value_template: "{{ value_jason.EToday | float | round(3) }}"
      unit_of_measurement: "kWh"
      device_class: power
      state_class: total_increasing
      icon: mdi:solar-power
      last_reset_topic: "sbfspot"
      last_reset_value_template: "1970-01-01T00:00:00+00:00"
    - name: "Solar_Panels.ETotal"
      unique_id: "solar_panels.etotal"
      state_topic: "sbfspot"
      value_template: "{{ value_jason.ETotal | float | round(3) }}"
      unit_of_measurement: "kWh"
      device_class: power
      state_class: total_increasing
      icon: mdi:solar-power
      last_reset_topic: "sbfspot"
      last_reset_value_template: "1970-01-01T00:00:00+00:00"

The sensors have been linked to the Energy dashboard:

An error message appears in the log files with respect to the sensors:

Logger: homeassistant.helpers.template
Source: helpers/template.py:589
First occurred: 4:22:11 PM (10 occurrences)
Last logged: 4:30:06 PM
Template variable error: 'value_jason' is undefined when rendering '{{ value_jason.EToday | float | round(3) }}'
Template variable error: 'value_jason' is undefined when rendering '{{ value_jason.ETotal | float | round(3) }}'

And nothing shows up on the dashboard:

It is running on HAOS 2023.1.7 on a RPi 3B.

Suggestions to resolve the errors from the log and get the readings into the dashboard would be greatly appreciated.

Related topic: https://community.home-assistant.io/t/sbfspot-sma-inverter-mqtt-and-wrong-energy-dashboard-values/446679

Should be

device_class: energy

Also it is value_json Not value_jason.

Also also remove the last_reset topic and templates.

1 Like

Works like a charm! Thx Tom.
A syntax error. How embarrassing :flushed:

1 Like