Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remaining Capacity is a negative number? #27

Open
codepriince opened this issue Aug 13, 2024 · 6 comments
Open

Remaining Capacity is a negative number? #27

codepriince opened this issue Aug 13, 2024 · 6 comments

Comments

@codepriince
Copy link

codepriince commented Aug 13, 2024

Hello, thank you first and foremost for your excellent work! I have a UPS expansion board with a rated voltage of 3.7V, which allows for the parallel installation of two 18650 batteries, each with a capacity of 3400mAh. Consequently, when connected in parallel, the total capacity becomes 6800mAh. I have successfully integrated it into HA. However, the Remaining time remains unknown, and the Remaining Capacity displays a negative number. Could you please advise if these numerical results are correct? I would greatly appreciate your assistance.

The output result:
Screenshot_2024-08-13-18-43-53-298-edit_com oray sunlogin

My UPS is:
https://wiki.52pi.com/index.php?title=EP-0136

HA config(HAOS):

ina219_ups_hat:

name: Hassio UPS HAT B
unique_id: hassio_ups_hat_b
addr: 0x40
scan_interval: 60
batteries_count: 2
max_soc:x 95
battery_capacity: 6800
sma_samples: 5
min_online_current: -100
min_charging_current: 50

I2C address:
mmexport1723547655882

Are all the result correct? Please help me. Thank you.

@e3e6
Copy link

e3e6 commented Aug 13, 2024

https://github.com/odya/hass-ina219-ups-hat/blob/master/custom_components/ina219_ups_hat/coordinator.py#L73C17-L73C43

soc = self._socOcvProvider.get_soc_from_voltage(smooth_bus_voltage / self._batteries_count)
...
 remaining_battery_capacity = (self._battery_capacity / 100.0) * soc
  1. So technically value can be negative.
  2. The voltage seems to be too low

Have you tried changing addr: 0x40 to 40, 45 or 17?
Which exactly UPS board you're using? B, C, D?

@codepriince
Copy link
Author

I have tried changing addr: 0x40 to 40, 45 or 17, the result of Remaining Capacity is still a negative number and the Remaining Time is unknown.
Sorry, I don't understand what u say about UPS board B C D. But i give the UPS Link above.
I am a new.

@codepriince codepriince changed the title REmaining Capacity is a negative number? Remaining Capacity is a negative number? Aug 13, 2024
@e3e6
Copy link

e3e6 commented Aug 13, 2024

@codepriince this component is based on the source provided by Waveshare which was originally designed to work with Waveshare UPSs:

The (EP-0136) UPS you're using has completely different architecture that's why the values calculations might be wrong.

You may try asking for help here: https://github.com/frtz13/UPSPlus_mqtt
There are already some HASSIO dashboard examples, but I'm not sure how they run the python script

@codepriince
Copy link
Author

The UPS Plus I'm using is a new generation of UPS power management module that supports OTA (Over-The-Air) firmware upgrades and features an onboard RTC (Real-Time Clock). Furthermore, it incorporates two INA219 chips, which are used to detect the battery voltage and the voltage output from the UPS Plus to the Raspberry Pi.
I thought it would be universal with INA219, maybe as you said, the architecture is different.
My UPS uses the Raspberry Pi's 5V 3A power supply as its power input, so the voltage of 4.9V may be the correct value. I think I also got some correct data using your Integration.
Thank you very much!

@e3e6
Copy link

e3e6 commented Aug 13, 2024

My UPS uses the Raspberry Pi's 5V 3A power supply as its power input, so the voltage of 4.9V may be the correct value.

I guess that's the issue, because waveshare UPS are using 8.4V (2S) input.
Also, keep in mind that the original code assume a 0.1 shunt ohm resistor is present: https://github.com/waveshare/UPS-Power-Module/blob/master/ups_display/ina219.py

@codepriince
Copy link
Author

My UPS uses the Raspberry Pi's 5V 3A power supply as its power input, so the voltage of 4.9V may be the correct value.

I guess that's the issue, because waveshare UPS are using 8.4V (2S) input. Also, keep in mind that the original code assume a 0.1 shunt ohm resistor is present: https://github.com/waveshare/UPS-Power-Module/blob/master/ups_display/ina219.py

Thanks to your reply and guidance, I found 52PI UPS. And that's it:https://github.com/archef2000/homeassistant-upsplus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants