Fixed Aranet4 history returning 0 records in 2.6.0 (unknown model in _all_records)#70
Open
vruyr wants to merge 1 commit into
Open
Fixed Aranet4 history returning 0 records in 2.6.0 (unknown model in _all_records)#70vruyr wants to merge 1 commit into
vruyr wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #69
Root cause
Version 2.6.0 introduced per-model
entry_filteradjustments 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 theelse, and were flagged as an unknown model, soget_all_records()returned an emptyRecordbefore 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 likeAranet4 12345are 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 theCurrentReading/advertisement paths key offAranetType, so_all_records()was the only spot with this bug.Before / after
Before (2.6.0, Aranet4 fw v2.0.7):
aranetctl <address> --recordsreads 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.