Skip to content

Fixed Aranet4 history returning 0 records in 2.6.0 (unknown model in _all_records)#70

Open
vruyr wants to merge 1 commit into
Anrijs:masterfrom
vruyr:fix/aranet4-history-unknown-model
Open

Fixed Aranet4 history returning 0 records in 2.6.0 (unknown model in _all_records)#70
vruyr wants to merge 1 commit into
Anrijs:masterfrom
vruyr:fix/aranet4-history-unknown-model

Conversation

@vruyr

@vruyr vruyr commented Jul 6, 2026

Copy link
Copy Markdown

Closes #69

Root cause

Version 2.6.0 introduced per-model entry_filter adjustments in _all_records() via a device-name prefix chain with branches for Aranet2, Aranet Radiation, and Aranet Radon — but no branch for Aranet4. Aranet4 device names matched no branch, fell into the else, and were flagged as an unknown model, so get_all_records() returned an empty Record before issuing any history command.

Fix

An explicit Aranet4 branch is added (a pass-through — the default filter of temp/humi/pres/co2 is already correct for Aranet4). The prefix chain is extracted into a private helper, _apply_model_entry_filter(), so the model detection can be unit-tested without hardware; behavior for all other models is unchanged and the public API is untouched. Regression tests are added asserting that names like Aranet4 12345 are recognized while genuinely unknown names still short-circuit.

Other model-prefix chains were also checked: _find_nearby() (client.py line 468) already includes "Aranet4" in its prefix tuple, and the CurrentReading/advertisement paths key off AranetType, so _all_records() was the only spot with this bug.

Before / after

Before (2.6.0, Aranet4 fw v2.0.7): aranetctl <address> --records reads name/version/interval/total-readings, then disconnects without writing a history command and prints an empty table, even with thousands of stored datapoints. 2.5.1 works correctly.

After (2.6.0 + this patch): history downloads as in 2.5.1.

Verification

  • pytest — 25 passed (including the new regression tests); flake8 (CI settings) clean.
  • Verified against real hardware (Aranet4, firmware v2.0.7, macOS host): 2.5.1 works, 2.6.0 returns 0 records, 2.6.0 + this patch downloads history correctly.

v2.6.0 added per-model `entry_filter` adjustments in `_all_records()`
keyed on device-name prefixes, but had no branch for Aranet4 — those
names fell into the else, were flagged as an unknown model, and
`get_all_records()` returned an empty Record before issuing any history
command (confirmed on real hardware, Aranet4 firmware v2.0.7). Fixes Anrijs#69.

The fix is a pass-through branch, since the default filter
(temp/humi/pres/co2) is already correct for Aranet4. The prefix chain
was extracted verbatim into `_apply_model_entry_filter()` solely so
model detection could be regression-tested without hardware; behavior
for other models and the public API are unchanged. The pre-existing
`unknwon_model` typo was left alone to keep the diff minimal for
upstream.

Content-Type: text/markdown
Disclaimer: AI-generated
Claude-Code-Session-Name: Implement fix from brief documentation
Claude-Code-Session-Id: a75138c6-7227-48bf-843e-7e46533319c7
Claude-Code-Session-Context-Used:    56,167
Claude-Code-Session-Context-Size: 1,000,000
Claude-Code-Model-Name: Fable 5
Claude-Code-Model-Id: claude-fable-5
Claude-Code-Version: 2.1.201
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in 2.6.0: history fetch returns 0 records for Aranet4 (no "Aranet4" branch in _all_records model detection)

1 participant