What's with the spikes??

Post Reply
TheDomOfThree
Posts: 15
Joined: Wed Jul 03, 2024 12:36 pm

I have H1 integrated with HA via Waveshare modbus. @Dave Foster helped me setting all this up, as I have made few small mistakes when building the solution... I now have a working integration with a lot of stats in Energy dashboard of HA. HOWEVER, there is a daily random spike of solar generation that I have difficulties explaining - usually happens between 21-22.00. Spike indicates between 18 to 40kWh generation that never happened, but it breaks all the statistics... I know how to correct this in Dev tools but it is boring to do that every day... This spike does not come from the inverter - H1 web statistics do not show similar spike...

I did a bit of a research and I've found posts in HA forum, dated 2022, with similar issues on different inverters... Response from some forum users was very patronising "fix your sensor" with extremely scarce information how to do that... As i use Modbus integration I have no idea where my sensors are defined and if I could "fix them" anyway... Apparently it is something to do with sensor availability...

From where I sit it does look like the issue is with HA or modbus integration but I am happy to be corrected here...

Would anyone like to discuss further??
FoxESS H1 5kW with 4.6kWp solar array
HA integration via Waveshare Modbus
Zappi
Octopus Go Intelligent
MG4 Trophy Long Range
Dave Foster
Posts: 1111
Joined: Thu Oct 13, 2022 7:21 pm

I've just noticed you have posted on another thread that you are looking for batteries, do you currently have any batteries on this system ?

The timing looks spookily about the time that there is not enough voltage on your PV and without batteries the H1 would normally go into standby ('waiting') - i'm not sure what would happen on the modbus when that happens but are you able to show the trace of one of the sensors for the hour before and after the 'spike' occurs.
TheDomOfThree
Posts: 15
Joined: Wed Jul 03, 2024 12:36 pm

Hello @Dave,

you are correct. I did post indeed. There are no batteries on the current system. I am in the process of securing funds from my "finance director"...

Where do I get those traces, are those the generation graphs from the modbus entity you're referring to??
FoxESS H1 5kW with 4.6kWp solar array
HA integration via Waveshare Modbus
Zappi
Octopus Go Intelligent
MG4 Trophy Long Range
Dave Foster
Posts: 1111
Joined: Thu Oct 13, 2022 7:21 pm

You can see all of the sensors that the integration is providing by clicking on Settings, Devices & Services, find the Foxess-Modbus integration and click on '1 Device'

That will list all available sensors, if you then click on the one that says 'Solar Generation Today' it should open a history graph on the screen.

There's a link in blue that says 'show more' and when you click that it will change to allow you to enter a start and end date/time range - if you pick a day where you know it has done it and set the start date/time an hour before, and the end date/time an hour after and click on the select it will draw the graph for that period of the Solar generation sensor, can you screen shot the graph and attach it below please so we can see what the sensor is doing.
TheDomOfThree
Posts: 15
Joined: Wed Jul 03, 2024 12:36 pm

Screenshot 2024-07-22 at 20.23.44.png
Is that what you need??
FoxESS H1 5kW with 4.6kWp solar array
HA integration via Waveshare Modbus
Zappi
Octopus Go Intelligent
MG4 Trophy Long Range
TheDomOfThree
Posts: 15
Joined: Wed Jul 03, 2024 12:36 pm

I think I managed to fix this issue... I need to test it for the next 2-3 days to make sure... I will update this post when I know for sure...

Bit of a background... I was playing with Energy dashboard in HA, adding and removing sensors, tweaking entities etc. I got to the point where ALL my sensors were added to the dashboard (electricity, solar, gas, some individual devices and battery). HA was happily collecting statistics and as an extra bonus I had a daily unexplained spike of solar generation that did not happen in a real life... Last night, I decided to tidy up a bit and remove sensors that do not collect any data yet - read BATTERY... Surprise, surprise, there was no spike last night... Could be coincident, could be a fix...
Last edited by TheDomOfThree on Tue Jul 23, 2024 12:07 pm, edited 1 time in total.
FoxESS H1 5kW with 4.6kWp solar array
HA integration via Waveshare Modbus
Zappi
Octopus Go Intelligent
MG4 Trophy Long Range
Dave Foster
Posts: 1111
Joined: Thu Oct 13, 2022 7:21 pm

Looking at the trace, I think that would cause trouble when the inverter is shutting down once there isn't enough solar left to keep the MPPT up.

It looks like the trace is going up and down several times, I assume as the inverter is detecting enough voltage threshold to start up, before it then shuts down again - each one of those to zero and back to positive will result in the energy dashboard think you've just had a load of solar power.

The state_class of the sensor is total_increasing, so a lower state (even from e.g. 10 to 9) will be interpreted as a reset of the sensor, HA will think the sensor has been reset to 0 and then increased to a new value again. The long term statistic will then use the value it was plus the value it now is and that means because the sensor has gone to 0 temporarily, it will double when it returns to the correct state.

If the sun goes down quickly it won't happen, but most importantly once you have batteries fitted the hybrid will never shut down as it stays operational from the batteries.
TheDomOfThree
Posts: 15
Joined: Wed Jul 03, 2024 12:36 pm

Thanks for that. Could that be fixed in any way or is it something I have to leave with for now??
FoxESS H1 5kW with 4.6kWp solar array
HA integration via Waveshare Modbus
Zappi
Octopus Go Intelligent
MG4 Trophy Long Range
Dave Foster
Posts: 1111
Joined: Thu Oct 13, 2022 7:21 pm

TheDomOfThree wrote: Tue Jul 23, 2024 12:09 pm Thanks for that. Could that be fixed in any way or is it something I have to leave with for now??
I think it's possible to work round it, but you'll have to do the calculations rather than rely on the solar generation register that comes directly from the inverter.

If you add this to your configuration.yaml under the `sensor:` section

Code: Select all

sensor:

  - method: left
    name: pv_total_sum
    platform: integration
    round: 2
    source: sensor.pv_power
    unit_time: h

Then this in the configuration yaml under the `utility_meter:` section

Code: Select all

utility_meter:
  daily_pv_sum:
    source: sensor.pv_total_sum
    cycle: daily
    always_available: true
And then restart Home Assistant.

What this will do is to use the inverter 'PV power' sensor as the source for a Riemann sum that integrates it over time and converts power (kW) to energy (kWh)

That 'sum' is then used as the source for a utility_meter which will reset daily at midnight and will never become unavailable so it's value should always be consistent.

Finally you need to go to Settings, Dashboards - click on Energy and under 'Solar Production' remove the sensors there and replace with `sensor.daily_pv1_sum`
TheDomOfThree
Posts: 15
Joined: Wed Jul 03, 2024 12:36 pm

Hello All,

just a quick summary. My previously mentioned possible fix was just a coincidence that did not last long... However I have configured the new sensor as per above post. Thank you @Dave Foster. Everything seem to be working exactly as it should be. No more random spikes etc.

@Dave if you keep helping me the way you do with my HA, I am gonna need to make a goat sacrifice or at least send some 6 pack your way...

Thank you very much again. I do have a question however. This type of issue seem to be very common. I have seen very old posts, in various places, referring to similar problems observed with different inverters... Any idea why wasn't the fix implemented globally yet?? It does not look extremely complicated. Am I missing something here??
FoxESS H1 5kW with 4.6kWp solar array
HA integration via Waveshare Modbus
Zappi
Octopus Go Intelligent
MG4 Trophy Long Range
Post Reply