sermatec-opensource / homeassistant-sermatec-inverter

Home Assistant custom component for the Sermatec solar inverter.
MIT License
9 stars 2 forks source link

Fix bad battery power sensor used for charging / discharging #17

Closed mathieupotier closed 1 year ago

mathieupotier commented 1 year ago

Changed the battery positive or negative collecting sensor to have proper sensor updated.

Fixes : https://github.com/andreondra/homeassistant-sermatec-inverter/issues/16

mathieupotier commented 1 year ago

Fixing this issue : https://github.com/andreondra/homeassistant-sermatec-inverter/issues/16

Noticed that there was an inversion about Negative or Positive sensor about battery power. It has been fixed.

mathieupotier commented 1 year ago

Need to review this : probably rely on the Battery state to put the correct value ... image

mathieupotier commented 1 year ago

Created to dedicated sensors : because they now have their own logic... Should fix the issue definitely, the battery state seems always have the relevant value charging / discharging

andreondra commented 1 year ago

Thanks, I'll test the modifications and merge if everything works.

mathieupotier commented 1 year ago

Hum, just wondering if power is not supposed to be int ... Maybe using ceil math function to have it rounded as int...

Need you insight before merging this one ...

andreondra commented 1 year ago

There could only be a problem with the Riemann sum integration, but according to the documentation it accepts any numeric value. I will deploy this version and let it run through the day to see if we get correct values in the energy dashboard. If not, we can use the round() function.

mathieupotier commented 1 year ago

used the same float value for battery power, was still int.

andreondra commented 1 year ago

Everything seems fine. I let the battery charge and discharge and both Riemann sum sensor and the Energy dashboard show correct values.