unfortunately the consumption display did not work for me anymore.
I currently use the following code:
- name: "Energy Total"
unique_id: energy_total
state: >-
{{ states('sensor.phase_1_energy')|float(0) +
states('sensor.phase_2_energy')|float(0) +
states('sensor.phase_3_energy')|float(0) }}`
`unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
availability: >
{{ not 'unavailable' in
[ states('sensor.phase_1_energy'),
states('sensor.phase_2_energy'),
states('sensor.phase_3_energy') ] }}`
- name: "Power Total"
unique_id: power_total
state: >-
{{ (states('sensor.phase_1_power')|float(0) +
states('sensor.phase_2_power')|float(0) +
states('sensor.phase_3_power')|float(0)) }}
unit_of_measurement: W
device_class: power
state_class: total_increasing
availability: >
{{ not 'unavailable' in
[ states('sensor.phase_1_power'),
states('sensor.phase_2_power'),
states('sensor.phase_3_power') ] }}
I had changed this accordingly the state_class as total_increasing, which now (almost) works again as before. The solar module is connected to L2 in the apartment. In case of excess power the Shelly 3M measures negative and I get the following log:
Logger: homeassistant.components.sensor.recorder Source: components/sensor/recorder.py:331 Integration: Sensor (documentation, issues) First occurred: 13:20:10 (1 occurrences) Last logged: 13:20:10
Power is a momentary reading so definitely shouldn’t be set to total_increasing. That is why you are getting those errors. Sensors representing momentary readings should be set to measurement
Also if you have 3 sensors representing energy you don’t have to create a sensor that adds them for the Energy integration. You can just add all 3 sensors to the integration and it will not only take care of adding them for you it will also give you more detailed bar graphs.
Thanks so far for your answer.
I set it back to measurement: Now I am waiting for enough sun to get into “negative measurement” Germany isn´t the sunniest place actually.
I know, that I can use all three sensors for the energy integration, but the Solar Panel is connected to L2. Therefore that code above summarizes all 3 main cables in the appartement together - including the solar production. (I hope, I explained this correctly.)
Did you use the L2 return function from the Shelly 3M or do you use another one?
Honestly I just use a 390W Panel with a Hoymiles 350 Inverter on the Balkony. In my case it looks as follows (The current solar power is around 40Watts )
I use Aeotec Home Energy Meter Gen5 (zwave device). It does not have dedicated “return” function if that is what you are asking.
My inverter is connected behind the meter so when the PV production is high my entire usage on 2nd phase goes into negative. That is why I don’t have anything configured as return to grid.
If I configure my Inverter as return to grid my calculation in the energy panel is incorrect. (the PV production is counted twice, once as return to grid and once again because it lowers my real usage).
Technically my setup is not optimal and I should change it but I have to run new cable for the inverter from my fuse box so it is connected between meter and the incoming city supply.
I had the same problem. After changing my “Solar generation” to total_increasing it worked again, but showed huge negative numbers for today.
For now I restored the Backup I made this morning and continue to live with 2021.12 until theres a good solution.
I don’t think there will be a better solution. Using state_class: measurement was deprecated for a long time and will never be supported for accumulation sensors again.
In my case, the Shelly 3M device has a return function for every clamp. That means if a value gets negative, then this is going to be measured as return.
Anyway… The energy from the panel gets measure with a Shelly Plug S.
Until now…your solution works. Thanks so far for your help.
Yes. I restored the backup and while resoting I decided to update, change to “Total” and change my database at the same time to MAriaDB, because I wanted to do this since a long time.