Files
EOS/tests
b2c5820925 fix(devices): use the nearest valid measurement of a key
DataSequence.key_to_value took the record nearest in time and returned
the key from it, even when that record did not hold the key. Feeders
write measurement keys one at a time, seconds apart, and every write
creates its own record. A battery temperature written at 10:00:00 and a
SoC written at 10:00:01 then gave no temperature for a lookup at 10:01,
so battery temperature, SoC factor, charge/discharge power and the
inverter temperature fell back to the reference operating point (25 degC,
SoC 0.5, 45 degC). Profiles with a temperature or SoC dependent charge
limit were evaluated there, e.g. with too high a charge power for a cold
battery.

key_to_value now returns the nearest value of the key itself: records
where the key is None or NaN are skipped, as dropna does for the other
key accessors. The search window and its bounds are unchanged; without
a window only an exact match counts.

Additional changes
Developer docs describe key_to_value as the nearest valid value of a key

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
2026-11-28 08:08:37 +01:00
..