Engergy pv production sensor drops to zero, how to avoid in template sensor?

the problem is now fixed, the dropdown to 0 is now gone.

1 Like

Unfortunately problem here still not fixed. Every Friday at 02:20 total yield goes to 0. When the SMA inverter starts, total yield goes to it’s original value giving a spike in the energy page of the total yield.

You’re issue won’t be fixed by a core update, it needs to be fixed by you. If your sensor is dropping to zero and ramping back up, then it will add that to the calculation. You either need to fix that on your sensor side, or make a template sensor that filters out zero.

Strange. Am I the only one? Why did it work OK until December? Why does it only drop to 0 on Fridays?

exactly, what I wanted to say, you have to create a template sensor and then catch the spike, as I did.

I see the problem mostly in winter, when Sensor goes unavailable, due to less sunlight during the day

  - platform: template
    sensors:
      pv_production:
        unit_of_measurement: "kWh"
        value_template: >-
          {%  if (states('sensor.pv_gen_meter')| float | round(2)) > 0 -%}
            {{ (states('sensor.pv_gen_meter')| float | round(2))}}
          {%- else -%}
            {{ (states('sensor.pv_production')| float | round(2))}}
          {%- endif %}
        availability_template: >-
          {{ states('sensor.pv_gen_meter') not in ['unknown', 'unavailable', '0', '0.0']}}

That’s a question you need to ask yourself about whatever is creating that sensor. We can help if you give that information.

You’re focusing on the result, and not what’s producing the zero.

Problem solved. Applied the template. Now no more spikes on Friday. :slightly_smiling_face:

Now I have the spike on Tuesday. :cry:

Then you didn’t make the template sensor correctly, or you are using the wrong sensor for the calc.

Seems the SMA inverter does a reboot once a week. So no output (not even zero) between 01:30 and power-up.

Yes, and during that time the state should be unavailable. If it’s not, then you’ll have spikes that change your data.

Solved with 2022.2 release :slightly_smiling_face:

Thanks.

do you have to put this on the configuration.yaml?
if try to test in the template section (under developer tools) i got the correct value but when i try to put in the yaml file, it wont accept is

yes you need to create a remplate sensor, please let us know your error message.

i got this: https://snipboard.io/3eEOGS.jpg

you copy/pasted it wrong and the fields aren’t correctly lining up. Take a look at the copied code again and ensure all spacing is maintained.

I was very carefull now to correct it but stil got the same problem: https://snipboard.io/UKjyL6.jpg
when i try to type it in manually i even got the same problem when i select the sensor-template

can’t see the rest of the file for the spacing on the other items.

full file: https://snipboard.io/oRNZIQ.jpg