Thanks for answering on list.
"Christian Z." <
chri...@zuckschwerdt.org> writes:
>> + As a way to deal with devices that have only a "battery is ok" vs
>> "battery is not ok" indication, we map ok to 1.0 and not ok to
>> 0.0.
>
> The current scheme is to map a battery low flag to integer 0 (and integer 1
> otherwise).
> This helps consumers detect if a range of values is available but comes at
> the cost of having a variable type.
> Since the type can always be parsed as a float it should not be a problem.
It is not really a problem, except that it is irregular for no good
reason. If battery_ok is defined to be a float, is there any downside
to changing the type to DATA_FLOAT everywhere it's used this way?
Or are you saying that it's a feature that value is polymorphic and that
the type denotes the semantics? That in my view is way too subtle. I
feel that if we want metadata about what's expressed then we should do
that somehow.
Are there any known users that key off 1.0 vs 1 in output? This feels theoretical.
>> + If a device reports voltage that can usefully be mapped to
>> battery_ok and also a binary ok/not-ok, we should discuss how to
>> proceed.
>
> I think that we won't need a binary flag if a range of steps is available.
> The binary battery low info is included in something like "battery_ok <=
> 0.2".
I'm fine with that. My goal here is first to get us on "written plan,
follow it".
> We would need to document where we want that last level to be. Imagine a
> device with four steps, is the last one 25 %? Or maybe a device with three
> steps (full/ good/ low) -- is that 100 / 67 / 33 %? Or perhaps better 100 /
> 50 / 20 %? I.e. demand the last level to be at or below 0.2?
(The value is 0-1 and we as people are discussing %. That's totally
fine but not an agreement that we should change the definition!)
It depends. I would say the rules are:
First, determine how the reported values correspond to % lifetime.
There is absolutely no way to have a rule that takes n steps from
random devices and gets that right.
Second, realize that the point of battery reporting is to convey
information that the battery is low and might need attention.
Therefore, if one has a report of step value X, the right % is the
largest remaining % such that it's a reasonably safe bet that with
that report, there is that much left.
Third, relax the second rule to be some blend of literal and close
enough that there is the right impression. Accept that 10% means "the
device is working but the battery is so low that you're on thin ice
and if you value reliable operation you should replace it right now.".
So imagine a device with 4 levels, and that reports them for a number of
days, after a fresh battery, with assumed constant drain
A: 30
B: 100
C: 120
D: 50
with the implication being that it stops transmitting after those 50 in
D. I'm totally making this example up, and to figure out how to map a
real device, one would need to put in a fresh battery and data log the
values for the batteries entire lifetime.
This sums to 300 days. I would map this
A: 100%
B: 50%
C: 20%
D: 10%
commentary:
A is "the battery is obviously new and things are great". I would be
fine with mapping A to 90% as well.
B is the battery is on the first half of usage. Might be 90%, might
be 50%. call it 50%
C is the battery is getting low, but it's not critical. 20% is close
to the 50/300, a bit higher but gives the right impression
D means you're on thin ice. Use the 10% signal, vs 0% when we are
sure it's dead.