ksheumaker / homeassistant-apsystems_ecur

Home Assistant custom component for local querying of APSystems ECU-R Solar System
Apache License 2.0
166 stars 42 forks source link

negative energy #174

Closed wallb35 closed 1 year ago

wallb35 commented 1 year ago

Hello, last two days 5 and 6 April 2023, I've got past day energy produced as a negative value in Energy Dashboard using ECU today Energy as Solar Production sensor (see two screenshots). Was working for month before. Between 2 and 3 am in Dashboard energy, probably when the sensor reset in my ECU-B, all previous production from passed day come as negative value. no problem with ECU total energy but with less precision. looks like the sensor have the good value (see attached file). I reboot my ECU-B today. Need to wait for tomorrow to see if it solved my issue. ECU-B 1.2.26 ECU Integration 1.2.28 Home assistant container 2023.3.0 Regards. Yannig

Capture d’écran 2023-04-06 à 10 38 40 Capture d’écran 2023-04-06 à 10 38 57

ecu today energy

Doudou14 commented 1 year ago

I have the same problem, so I use "sensor.ecu_lifetime_energy". But I don't see less precision.

HayaminiNL commented 1 year ago

I am experiencing the same thing with the integration: image

image

It gives the negative number of the amount of kW of the previous day.

wallb35 commented 1 year ago

I have the same problem, so I use "sensor.ecu_lifetime_energy". But I don't see less precision.

lifetime energy is one digit precision vs today 2 digit precision.

HayaminiNL commented 1 year ago

Just my 2 cents on the code change 3 days ago.

The 'sensor' that stores the value is using another value as its input: image image

It is changed to: "stateclass=SensorStateClass.TOTAL" from "stateclass=SensorStateClass.TOTAL_INCREASING".

Before the change both sensors use the TOTAL_INCREASING. Maybe this got mixed up, so that today_energy should use TOTAL_INCREASING and lifetime only TOTAL? Or both had to be TOTAL_INCREASING?

Does it make sense when I thing that it caused the 'total' going negative when being reset to zero at the new start of the day-measurement?

PS: I have changed the sensor.py file for my deployment to see if it makes are difference tonight/tomorrow. So I changed today_energy to TOTAL_INCREASING and lifetime_energye to TOTAL. (swapped it).

renini commented 1 year ago

Experienced exactly the same.

ViperRNMC commented 1 year ago

Same issue here, started from 5april

HayaminiNL commented 1 year ago

Swapping the variables fixed the issue on my side.

When you connect via Terminal to the HASS node, you can edit the PY file to make it work for now.

wallb35 commented 1 year ago

Swapping the variables fixed the issue on my side.

When you connect via Terminal to the HASS node, you can edit the PY file to make it work for now.

Thank you, modification done. Waiting for result tomorrow morning ;)

HayaminiNL commented 1 year ago

Well done for this quick merge!

@wallb35, did the code change result in 'normal operation for you too?

wallb35 commented 1 year ago

I forgot to restart home assistant :/ so no change yet. Hope this will be good tomorrow.

wallb35 commented 1 year ago

Latest version solved the problem. Fixed

Eraser127 commented 1 year ago

Same problem here with ECU-R, so just need to edit that sensor.py? Or will there be a automatic update? Edit: just replaced sensor.py, I'll see tomorrow if it worked.

HAEdwin commented 1 year ago

I guess this is fixed so I'll close the issue. Feel free to open a new issue if needed.