Mqtt template and the new energy monitoring capability

I have integrated my SMA solar converter using the instructions given here:Integration with SMA Solar STP 10000TL-20 via SBFspot

I cannot get the sensor to show up as energy source.

I have:

- platform: mqtt
  state_topic: "sbfspot_304991214"
  name: "Inverter Total Yield"
  value_template: "{{ value_json.ETotal }}"
  last_reset_value_template: "{{ as_datetime('1970-01-01T00:00:00+00:00') }}"
  unit_of_measurement: 'kWh'
  icon: mdi:solar-power
  state_class: "measurement"
  device_class: "energy"

as sensor configuration.
The last_reset_value_template is working. If I put that template as value_template, I get some 2000 weeks ago.

In the Developer tools, I also don’t see the last_reset appear.

state_class: measurement
unit_of_measurement: kWh
friendly_name: Inverter Total Yield
icon: mdi:solar-power
device_class: energy

Any idea what I am overlooking ?

Trhis should work :

- platform: mqtt
  state_topic: "sbfspot_304991214"
  name: "Inverter Total Yield"
  value_template: "{{ value_json.ETotal }}"
  unit_of_measurement: 'kWh'
  icon: mdi:solar-power
  state_class: "measurement"
  device_class: "energy"
  last_reset_topic: "sbfspot_304991214"
  last_reset_value_template: '1970-01-01T00:00:00+00:00'

You can’t use last_reset_value_template without last_reset_topic

Thank you Francis, I would never have come up with the link between the 2. It makes a lot of sense however.

It ended up to be adding the topic but keeping the template. The following is the working one.

- platform: mqtt
  state_topic: "sbfspot_304991214"
  name: "Inverter Total Yield"
  value_template: "{{ value_json.ETotal }}"
  last_reset_topic: "sbfspot_304991214"
  last_reset_value_template: "{{ as_datetime('1970-01-01T00:00:00+00:00') }}"
  unit_of_measurement: 'kWh'
  icon: mdi:solar-power
  state_class: "measurement"
  device_class: "energy"

The template was not really necessary, mine work hardcoded. But if it works, it works :slight_smile: