How readings are assigned
The steps that turn the scale's adverts into one weigh-in and choose the person it belongs to.
The scale reports a weight and an impedance code. It does not say who is standing on it, so the integration chooses the person by weight.
From adverts to a weigh-in#
The scale sends adverts while someone stands on it. The settling buffer turns them into one Weigh-in:
- It collects adverts that carry the stable status.
- Three stable adverts within 0.5 kg and 5 seconds make a weigh-in.
- If the scale goes quiet for 5 seconds first, the last stable adverts make the weigh-in.
One step on the scale gives one set of values.
Choosing the person#
- If Weighing in, Next person or
set_next_personnamed a person in the last 60 seconds, that person gets the weigh-in. - The integration sets aside people whose
personentity isnot_home. - If the scale has one person, that person gets the weigh-in.
- Each remaining person with an Expected weight becomes a candidate. The distance is the difference between the weigh-in and the expected weight.
- The closest candidate wins when two conditions hold. The distance is within the tolerance,
max(5 kg, 7 % of the expected weight). The next candidate is at least the margin, 2 kg, further away. - Any other weigh-in becomes a Pending measurement.
Worked example#
Jupiter has an expected weight of 81.0 kg and Sarah 64.0 kg.
| Weigh-in | Distance to Jupiter | Distance to Sarah | Result |
|---|---|---|---|
| 80.2 kg | 0.8 kg | 16.2 kg | Jupiter, source weight_match. |
| 72.5 kg | 8.5 kg | 8.5 kg | Pending, reason no_match: Jupiter's tolerance is 5.67 kg and Sarah's is 5 kg. |
| 95.0 kg | 14.0 kg | 31.0 kg | Pending, reason no_match, and a repair to add a person. |
With Jupiter at 70.0 kg and Sarah at 68.0 kg, a weigh-in of 69.2 kg is 0.8 kg from Jupiter and 1.2 kg from Sarah. Both are within tolerance and the gap is 0.4 kg, so the weigh-in is pending with reason ambiguous.
Expected weight#
The expected weight is an exponentially weighted average of the person's stored weights, oldest first, with alpha 0.3:
expected = 0.3 × weight + 0.7 × expectedThe history holds the last 50 weights. A starting weight is the first item of the history. Every assigned weigh-in joins the history, including forced and assigned ones, so one press of Weighing in seeds a new person.
A person with an empty history has no expected weight and is never a candidate.
Why weight#
The advert carries no user slot, and the integration never connects to the scale to read one. Weight is the only signal in the advert that differs between people. The person entity filter and the Weighing in button cover the cases where weight is not enough.