Add offset additionally to multiplier to make it possible to support devices which report Voltages
midcode opened this issue · 2 comments
midcode commented
Is your feature request related to a problem? Please describe.
I'm trying to add some entities which report voltages instead of battery percentage to my battery state list. Unfortunately the multiplier is not enough as a battery is empty way above 0V
Describe the solution you'd like
Add a offset value which gets subtracted before multiplication with the multiplier. So for 2 AA battery devices which have a working voltage range of about 2V = empty to 3V = full, you could set offset = 2 and multiplier = 100.
maxwroc commented
Should be easy to add in v3. Adding below just for the reference
https://github.com/maxwroc/battery-state-card/blob/next/src/rich-string-processor.ts#L94