hultenvp / solis-sensor

HomeAssistant integration for the SolisCloud PV Monitoring portal via SolisCloud API
Apache License 2.0
208 stars 42 forks source link

Solis Inverter Energy Today starts the day with an erroneous offset #212

Closed GillesC closed 1 year ago

GillesC commented 1 year ago

Describe the bug As can be seen from the screenshot, the Solis Inverter Energy Today entity always outputs a wrong energy production value at the start of the day (after booting up). The issue seems somewhat related to #128.

Config N.A.

Versions Home Assistant 2022.11.3 Supervisor 2022.10.2 Operating System 9.3 Frontend 20221108.0 - latest

m.ginlong.com integration

Screenshots image

PieterVandenBerge commented 1 year ago

I have the same issue. My feeling is that when the invertor starts in the morning (as it's off over night), the last known value is shared again somehow. Which is also happening here.

Meaning you start from the last value of the the day before instead starting from 0.

hultenvp commented 1 year ago

Yes, the ginlong API only resets energy today in the morning when the device comes back online. The general rule I apply to filter this out is: If it's AM and the inverter is offline return "0". If it's AM and the inverter is online then return the actual value. If it's PM, return actual value.

What I see in the screenshot is that indeed "0" is returned as long as the sun is not up. But it looks like the inverter merrily continues adding to the energy today of the previous day after it comes back online until exactly 12 o'clock. I suspect your time or timezone settings are wrong. I'd check configuration of both the portal and your inverter, but my guess is the inverter is incorrectly configured because of an AM/PM misconfiguration

PieterVandenBerge commented 1 year ago

So do you create a new entity then to make this work (resetting daily solar)? Sorry about the noob question but would be great if you could share the code for this. Thanks!

On Tue, 29 Nov 2022, 20:03 hultenvp, @.***> wrote:

Yes, the ginlong API only resets energy today in the morning when the device comes back online. The general rule I apply to filter this out is: If it's AM and the inverter is offline return "0". If it's AM and the inverter is online then return the actual value. If it's PM, return actual value.

What I see in the screenshot is that indeed "0" is returned as long as the sun is not up. But it looks like the inverter merrily continues adding to the energy today of the previous day after it comes back online until exactly 12 o'clock. I suspect your time or timezone settings are wrong. I'd check configuration of both the portal and your inverter, but my guess is the inverter is incorrectly configured because of an AM/PM misconfiguration

— Reply to this email directly, view it on GitHub https://github.com/hultenvp/solis-sensor/issues/212#issuecomment-1331156203, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKUTBVOBWXLNSRF5QXPXE3WKZHRFANCNFSM6AAAAAASFYM3YA . You are receiving this because you commented.Message ID: @.***>

PieterVandenBerge commented 1 year ago

image I do see the same happening on SOLIS cloud as well. It seems they don't reset immediately at start-up after begin OFF during the night..

image If the battery is powered on, the issue isn't happening. (My battery is currently switched off as it's charging from the net which is very undesired behavior and that is something that SOLIS is also currently investigating (at least according to my installer)).

hultenvp commented 1 year ago

So do you create a new entity then to make this work (resetting daily solar)? Sorry about the noob question but would be great if you could share the code for this. Thanks!

Nope, I simply filter the Energy today data received from the server before updating the sensor entity. The filtering code can be found here: https://github.com/hultenvp/solis-sensor/blob/master/custom_components/solis/service.py#L153-L176

hultenvp commented 1 year ago

image I do see the same happening on SOLIS cloud as well. It seems they don't reset immediately at start-up after begin OFF during the night..

image If the battery is powered on, the issue isn't happening. (My battery is currently switched off as it's charging from the net which is very undesired behavior and that is something that SOLIS is also currently investigating (at least according to my installer)).

Correct. That's why I filter, in the code you also see a 5 min grace period to avoid still catching the final measurement from previous day. Behaviour with battery on is different because the battery typically keeps the inverter on past midnight.

GillesC commented 1 year ago

So do you create a new entity then to make this work (resetting daily solar)? Sorry about the noob question but would be great if you could share the code for this. Thanks!

Nope, I simply filter the Energy today data received from the server before updating the sensor entity. The filtering code can be found here: https://github.com/hultenvp/solis-sensor/blob/master/custom_components/solis/service.py#L153-L176

So, as it is already implemented, I'll have to check the timezone to resolve the issue I am seeing now?

hultenvp commented 1 year ago

Yes, check time and locale settings both on the server and in your inverter. I've seen both scenarios.

GillesC commented 1 year ago

Yes, check time and locale settings both on the server and in your inverter. I've seen both scenarios.

Both are filled in correctly. I have checked, the HA host and the soliscloud show the same wall clock as expected.

hultenvp commented 1 year ago

Did you also check the timezone? It can't be coincidence your server data resets at 12 noon instead of 12 midnight.

GillesC commented 1 year ago

I was unaware that the timing shown on the soliscloud did not reflect the time used by the inverter. The inverter time was indeed 12h off.

[SOLVED] For others having this problem: check the manual of your inverter to see how to adjust the time and time zone.

Thank you for your patience @hultenvp!

hultenvp commented 1 year ago

Good to see it's solved! I indeed wanted to ask you to also double check the inverter itself.

PieterVandenBerge commented 1 year ago

I looked into the manual to see how I could change the time zone on my inverter: image However, there's only mention of time. Not timezone.

When I check then the datalogger on soliscloud: image It has the same timezone (I'm on Brussels' time).

So not really sure what I still need to change...