MickMake / GoSungrow

GoLang implementation to access the iSolarCloud API updated by SunGrow inverters.
https://mickmake.com/
GNU General Public License v2.0
148 stars 42 forks source link

Update interval question #50

Open KLucky13 opened 1 year ago

KLucky13 commented 1 year ago

I made a sensor calculation to know what the actual power drawn is in my house like this:

Elektriciteitsload calculation- In kilowatt (Solarpower - gridInjection + griduse = Load)

  total_elektriciteitsload:
    friendly_name: "Total Elektriciteitsload"
    unit_of_measurement: "kW"
    icon_template: "mdi:lightning-bolt"
    value_template: >-
      {% set a = states('sensor.gosungrow_virtual_5180443_p83106') | float %}
      {% set b = states('sensor.electricity_meter_power_production') | float %}
      {% set c = states('sensor.electricity_meter_power_consumption') | float %}
      {{ (a - b + c) | round(3) }}

This results in having a sensor that outputs the total power I am drawing in the house (not the Net drawn power, the actual power usage).

However since the update interval of the Sungrow sensors are 5 minutes, these calculations are wrong. The other 2 sensors used in my calculations come straight from my "smart" power meter (P1 port connection). These update every second.

This means that the calculation is wrong if the power produced by the solar panels changes quickly (caused by clouds for example). At soms points I'm measuring a negative total elektricity load, which is not possible in this formula. So is there a way to increase this interval so my calculated sensor shows correct data?