Add mAh, Ah as a new BATTERY_CAPACITY device class #1052
-
|
This seems to be a pretty important missing unit. Currently we have support for energy capacity, but not battery capacity, which is useful for a lot of battery based devices (in my case the Ecoflow batteries) which report this value. |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 13 replies
-
|
Ah is actually quite a poor indicator of battery capacity since it's unit isn't Joule, the measure of energy (you thus need the voltage with Ah to get to that). Wouldn't this value be mostly a constant anyway? Or are you actually talking about remaining capacity here? |
Beta Was this translation helpful? Give feedback.
This comment has been minimized.
This comment has been minimized.
-
|
Please list the integrations that could leverage the new device class. Integrations that can leverage anything, like template and MQTT aren't interesting. |
Beta Was this translation helpful? Give feedback.
-
|
I also use this integration with a device for RPI where the battery capacity is defined in mAh |
Beta Was this translation helpful? Give feedback.
-
|
In my opinion, HA should be capable of handling at least some Standard Units - and Ah / mAh is one. There are other examples of Units that could be integrated - even If they are not that common... MW (Mega Watt) etc. that could be easily added without causing issues If they are not beeing used immediately. You can Just Setup a Rest API Sensor or create a template that would utilize such a measurement value... |
Beta Was this translation helpful? Give feedback.
-
|
Hello! I was also very surprised that there is no Ah. Ah is a very important indicator for autonomous systems, since modern batteries do not allow you to estimate the remaining charge simply by measuring the voltage. ALL battery controllers simply sum up the charge time multiplied by the charge current (A*h). I use ESPHOME to get data from various BMS - and just ignored the device class error. I thought I didn't read the documentation well enough. Thanks, now I understand - it's not a bug, it's a feature) |
Beta Was this translation helpful? Give feedback.
-
|
I did a quick search of the codebase, only one integration uses the
However, I found some interesting cases where calculations are made so that the sensor can have a unit compatible with the energy storage device class:
And there are other integrations that implement battery info without informing a unit, which makes one wonder if they are not using units derived from Ah. I believe that the current behavior of validating the unit as compatible with the device class has caused developers to fail to implement sensors with units and without device classes, which may mask research. Despite the small number of integrations that currently use units derived from Ah, I believe that after implementation new use cases will appear. |
Beta Was this translation helpful? Give feedback.
-
|
@frenck Since listing core codebase integration seems pivotal to this enhancement, let me give "Modbus" as an example. I'm adding a configuration yaml for the eFoy fuel cells, which make use of this unit. Right now I have to use device_class 'None', which of course is possible, but don't provide a proper 'unit_of_measurement'. |
Beta Was this translation helpful? Give feedback.
-
|
@frenck I do not understand your demonstrative protest against AmpereHours as STANDARD UNIT. We are in 21th century and have now the year 2025! |
Beta Was this translation helpful? Give feedback.
-
|
Hi everyone! 👋 So, this proposal has been sitting around for a bit now, and there has been some back-and-forth. I scheduled it to be discussed in our architectural core team meeting last week, and so we did. Unfortunately, we have decided not to accept this proposal in our architecture at this time. Besides discussion as pointed out in one of the first comments, the bigger issue we have is that the number of integrations we currently have available in our core codebase that can use this is actually quite slim. Although custom integrations may exist, they do not drive our code-base design and decision-making. For now, we're going to decline this proposal. However, if the potential use in our codebase grows in the future, we may reconsider it. That said, declining a device class, isn't a blocking factor entities to use the units today. If this unit of measurement fits the sensors you are creating, you use these units. ../Frenck |
Beta Was this translation helpful? Give feedback.
Hi everyone! 👋
So, this proposal has been sitting around for a bit now, and there has been some back-and-forth. I scheduled it to be discussed in our architectural core team meeting last week, and so we did.
Unfortunately, we have decided not to accept this proposal in our architecture at this time.
Besides discussion as pointed out in one of the first comments, the bigger issue we have is that the number of integrations we currently have available in our core codebase that can use this is actually quite slim. Although custom integrations may exist, they do not drive our code-base design and decision-making.
For now, we're going to decline this proposal. However, if the potential use in o…