question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for battery state of charge

See original GitHub issue

After some research (as it does not seem to be documented by Huawei) I found a way to obtain the state of charge from the inverter. Here I found a reply pointing to it: 37004 - 1 register - unsigned integer - 1 decimal (so you have to divide by 10 to get the % value)

In record 37005 I get 1000 as value so my guess is that 37004 is the soc and 37005 is the range (so % may be (reg[37004]/reg[37005])*100… however just dividing by 10 seems safe enough and requires just one call.

As huawei-solar python library does not return such information as named register I made a custom modification in my home assistant installation by creating a new attribute in sensor.py file this way: self._storage_soc = int.from_bytes(self._inverter.read_register(37004, 1), byteorder="big")/10

And now I am getting the percentage of charge so I can use it on my cards imagen

I am not making a pull request as probably the correct way to add this should be to add the record to the huawei-solar python library first but I am opening this ticket to provide all the information I have

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Emilv2commented, Jul 9, 2021

Hi, I got the latest modbus definitions from Huawei, the extra battery definitions are in there so we don’t need to guess 😃

0reactions
Emilv2commented, Nov 8, 2021

This is supported in the latest version

Read more comments on GitHub >

github_iconTop Results From Across the Web

State of Charge - an overview | ScienceDirect Topics
Thermal management of batteries​​ The state of charge is defined as the ratio of the available capacity Q(t) and the maximum possible charge...
Read more >
Monitor the Battery Level and Charging State
Determine the current charging state ... Start by determining the current charge status. The BatteryManager broadcasts all battery and charging ...
Read more >
iPhone Battery and Performance - Apple Support
This performance management works by looking at a combination of the device temperature, battery state of charge, and battery impedance. Only if ...
Read more >
Battery Maintenance | Trojan Battery Company
Charge your batteries fully after each period of use.​​ Allowing your batteries to sit in a low state of charge for extended periods...
Read more >
Check battery level on your Pixel phone - Google Support
Under "Battery," see how much charge you have left, and about how long until a full charge. Learn more about charging your phone....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found