Energy creates negative production at end of day

Hi everyone,
I am 2 weeks new with HA and just added my Solar using REST integration (JSON reading via Curl).

All those things work well throughout the day, but after the midnight, I get negative value shown.

I am pulling this every 4 minutes from the API. And I noticed that it may take few minutes for the Solax Cloud system to reset the stats overnight, so I stopped pulling from 11:50 PM till 12:10 AM to make sure no value goes over midnight which would cause this.

WHile it seemed promising yesterday, I received negative reading today again. Can you think of anything particular that could be causing this? As you can see in the JSON, the value is not negative.

The value used for Solar yield is “yieldtoday” which just keeps growing all day and gets reset around midnight.

{
  "success": true,
  "exception": "Query success!",
  "result": [
    {
      "inverterSN": "xxxxxxxxxxxxxxx",
      "sn": "xxxxxxxxxxxxxx",
      "acpower": 0,
      "yieldtoday": 48.8,
      "yieldtotal": 1391.8,
      "feedinpower": -2810,
      "feedinenergy": 825,
      "consumeenergy": 1793.56,
      "feedinpowerM2": 0,
      "soc": 0,
      "peps1": 0,
      "peps2": 0,
      "peps3": 0,
      "inverterType": "14",
      "inverterStatus": "100",
      "uploadTime": "2024-03-29 23:57:24",
      "batPower": 0,
      "powerdc1": 0,
      "powerdc2": 0,
      "powerdc3": null,
      "powerdc4": null,
      "batStatus": "2"
    }
  ],
  "code": 0
}

Can you paste a screen-shot of the history graph for this sensor?

Use the history panel, not the more-info pop-up card.

This is also strange, this shows also just fine. No negatives.

I have also just pushed end and start of value reading for 20 before and past midnight in case there was something strange in the values around midnight. I will be able to tell if it made a difference in around 16h.

Ok, so even after the adjustment, it still gets into negatives between 12 and 1 AM. Last time I pulled the API manually, I saw the cloud reset the stats within 5m after midnight.

Can you think of anything ?

I am getting the same effect with the latest HAOS 12.1 and Grott for Growatt integration. I was suspecting it could be coming from this Grott part but now see I am not alone.
Screenshots for reference.
Today, Apr 2:


Yesterday, Apr 1, it was all the same in the negative (1 embedded picture limitations on me as a new account, so I can’t really add another screenshot). It had -6.1kWh seen at the start of the day, and the day before yesterday on Mar 31 all was fine with no negatives. But exactly 6.1kWh of energy was produced Mar 31, the “good” day.

Just curious what might be breaking the calculations.

Can you zoom in to the times the glitch occurred and see if your history graph shows any slight decrease in energy?

I had the same issue and it was because the inverter self consumption caused my solar energy sensor to go backwards very slightly at night.

Here is mine:

That’s way too far past midnight. Needs to reset at 00:00:00

I mean, it resets few minutes after midnight. If I pull the API, it shows 0 within first 5m.

THis delay is more likely caused by my automation running the pull on the API with delay.

I will check this again tomorrow and run API on the side to get this confirmed.

It needs to

Not negotiable.

I don’t think the Solax Cloud does it natively. It updates values every approx 5 minutes.

So even if I pull the API every minute, it may not change 4 times. And because these update times are not exactly aligned by a minute, it may go overnight. You can see just now example where i pulled before and after 12:13:21 (CET).

This is why I run automation which stops pulling 20m before midnight and then starts 20, 30, or so past. But as you can see, when I pushed the script start for 30m after midnight, the value dropped at that time.

I may need to run another automation to reset this value at midnight locally in HA and then by time it gets to live pull, it will be already reset.

Feed it through a daily cycle utility meter helper and use the helper in your dashboard then.

Ok, I’ve done that. Getting the value in via the helper sensor which seems fine. HOwever even if it resets at midnight based on daily measuring in the helper, I think it could ingest those values that may come in few minutes past midnight.

I still have stopped reading around midnight, so I will see how it handles it tomorrow.

Ok, so far it is looking good. With the API pulling script stopped 10 before and 20 after midnight.

I think we can close this up. With the utility and me not measuring around the midnight, it is all sorted. Thanks for the tip.