batteryLevel property
An estimate of the battery level of the eSense device.
It assumes a linear relationship based on a regression on these measures of battery and voltage levels:
B | V
----+------
1.0 | 4.1
0.8 | 3.9
0.6 | 3.8
0.4 | 3.7
0.2 | 3.4
0.0 | 3.1
which gives; B = 1.19V - 3.91
.
See e.g. https://en.wikipedia.org/wiki/State_of_charge#Voltage_method
Implementation
@override
int? get batteryLevel => (_voltageLevel != null)
? ((1.19 * _voltageLevel! - 3.91) * 100).toInt()
: null;