Hi, there, I really like the Idea of the Energy view and history and directly added the energy counters via mqtt, but it seems like the time of last reset is somehow wrong and I don’t know what I’m doing wrong.
Somehow it is counted as negative at the time of the reset: (the exact value, it generated the day before)
Which is correct regarding the actual energy value because it is reset at midnight, but I thought this is compensated by the last_reset attribute?
The last_reset value in the attributes looks correct to me:
state_class: measurement
last_reset: 2021-08-20T00:00:00
unit_of_measurement: Wh
friendly_name: e3dc_hist_sol_total
device_class: energy
and the sensor-entry in the config looks like this: (for all hist_* entries in the json below)
- platform: mqtt
name: e3dc_hist_sol_total
state_topic: e3dc/power
unit_of_measurement: "Wh"
device_class: energy
state_class: measurement
value_template: "{{ value_json.hist_sol_total | int }}"
last_reset_topic: e3dc/power
last_reset_value_template: "{{ value_json.last_reset | int | timestamp_local | as_datetime }}"
the value, coming over mqtt looks like this:
{
"battery": -879,
"house": 863,
"solar": 0,
"solar2": 0,
"grid": -16,
"stateOfCharge": 89,
"hist_bat_in": 14405.25,
"hist_bat_out": 11060,
"hist_sol_1": 57337,
"hist_sol_2": 31594,
"hist_sol_total": 88931,
"hist_grid_in": 40120,
"hist_grid_out": 227.5,
"hist_house": 42380,
"last_reset": 1629410400
}
And the script which creates the data for mqtt switches the last_reset with the same message, when the hist_* values change to 0.
Did I understand something wrong about the last_reset attribute? Or is it shown with a different timezone in the developers entity list? So maybe I need to move it to a different timezone-offset?
Thanks for all ideas in advance