Skip to content

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

Description

@vruyr

Summary

aranetctl <address> --records returns an empty record set for an Aranet4 device on aranet4 2.6.0, even though the device reports thousands of stored datapoints and the connection/bond is fully working. Downgrading to aranet4 2.5.1 with the same device, same machine, and same bond fetches the history correctly, so this is a regression introduced in 2.6.0.

Environment

  • Library: aranet4 2.6.0 (broken) / 2.5.1 (works)
  • Device: Aranet4, firmware v2.0.7
  • Host: macOS 26.5 (bleak / CoreBluetooth backend)
  • Device is bonded; current readings, interval, "seconds since update", and total-readings count all read correctly over the encrypted connection

Steps to reproduce

  1. Pair/bond an Aranet4 with the host.
  2. aranetctl <address> → works, shows current reading and Logs: 5040.
  3. aranetctl <address> --records → prints the table header and zero rows.
  4. --records -l 20 and --records -s <date> behave the same (empty).
  5. uv run --no-project --with 'aranet4==2.5.1' aranetctl <address> --records -l 20records download fine.

Root cause

In client.py, _all_records() selects per-model parameters based on the device name prefix:

unknwon_model = False

if dev_name.startswith("Aranet2"):
    ...
elif dev_name.startswith("Aranet\u2622"):
    ...
elif dev_name.startswith("AranetRn"):
    ...
else:
    unknwon_model = True

There is no Aranet4 branch, so an Aranet4 device name (e.g. Aranet4 <serial>) falls into the else and is flagged as an unknown model. A few lines later:

if begin < 0 or end < 0 or unknwon_model:
    # Invalid model or invalid range. Most likely no points available
    return Record(dev_name, dev_version, log_size, rec_filter)

…the function returns an empty Record before any history command is ever written to the device. This is consistent with the bleak debug log below: the last GATT operation is the total-readings read (f0cd2001), followed immediately by disconnect — no write to f0cd1402, no notification subscription, no history reads.

Note this is platform-independent: whether get_name() returns the GAP device name or falls back to model + serial (as on macOS, where CoreBluetooth hides the Generic Access service), the name starts with Aranet4 and matches none of the three branches. It presumably affects every Aranet4 user on 2.6.0. The branch structure looks like it was introduced together with the Radon One support, and the Aranet4 pass-through case was lost.

Proposed fix

Add an explicit branch (defaults already select temp/humi/pres/co2 for Aranet4):

elif dev_name.startswith("Aranet4"):
    pass  # default entry_filter is already correct for Aranet4

Debug log (bleak DEBUG, trimmed and redacted)

Produced with a minimal script calling aranet4.client.get_all_records(address, entry_filter={}) and printing records_on_device and len(records.value):

DEBUG:asyncio:Using selector: KqueueSelector
DEBUG:bleak.backends.corebluetooth.CentralManagerDelegate:Bluetooth powered on
[... unrelated BLE device discovery lines removed ...]
DEBUG:bleak.backends.corebluetooth.CentralManagerDelegate:Discovered device XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX: Aranet4 XXXXX @ RSSI: -73 (kCBAdvData <nsdict_keys(['kCBAdvDataManufacturerData', 'kCBAdvDataTimestamp', 'kCBAdvDataIsConnectable', 'kCBAdvDataRxPrimaryPHY', 'kCBAdvDataRxSecondaryPHY', 'kCBAdvDataLocalName', 'kCBAdvDataServiceUUIDs'])>)
DEBUG:bleak.backends.corebluetooth.client:Connecting to BLE device @ XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
DEBUG:bleak.backends.corebluetooth.CentralManagerDelegate:centralManager_didConnectPeripheral_
DEBUG:bleak.backends.corebluetooth.client:Retrieving services...
DEBUG:bleak.backends.corebluetooth.client:Retrieving characteristics for service FE59
DEBUG:bleak.backends.corebluetooth.client:Retrieving characteristics for service 180F
DEBUG:bleak.backends.corebluetooth.client:Retrieving characteristics for service 180A
DEBUG:bleak.backends.corebluetooth.client:Retrieving characteristics for service FCE0
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic F0CD1401-95DA-4F4B-9AC8-AA55D312AF0C
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic F0CD1402-95DA-4F4B-9AC8-AA55D312AF0C
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic F0CD1503-95DA-4F4B-9AC8-AA55D312AF0C
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic F0CD2001-95DA-4F4B-9AC8-AA55D312AF0C
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic F0CD2002-95DA-4F4B-9AC8-AA55D312AF0C
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic F0CD2003-95DA-4F4B-9AC8-AA55D312AF0C
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic F0CD1502-95DA-4F4B-9AC8-AA55D312AF0C
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic F0CD2004-95DA-4F4B-9AC8-AA55D312AF0C
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic F0CD3001-95DA-4F4B-9AC8-AA55D312AF0C
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic F0CD2005-95DA-4F4B-9AC8-AA55D312AF0C
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic F0CD3002-95DA-4F4B-9AC8-AA55D312AF0C
DEBUG:bleak.backends.corebluetooth.client:Services resolved for BleakClientCoreBluetooth (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)
DEBUG:bleak.backends.corebluetooth.client:Read Characteristic 00002a24-0000-1000-8000-00805f9b34fb: bytearray(b'Aranet4')
DEBUG:bleak.backends.corebluetooth.client:Read Characteristic 00002a25-0000-1000-8000-00805f9b34fb: bytearray(b'REDACTED')
DEBUG:bleak.backends.corebluetooth.client:Read Characteristic 00002a26-0000-1000-8000-00805f9b34fb: bytearray(b'v2.0.7')
DEBUG:bleak.backends.corebluetooth.client:Read Characteristic f0cd1401-95da-4f4b-9ac8-aa55d312af0c: bytearray(b'\xf1\x03\x83\x00\xe8\x03x\x05 \x03\x84\x03')
DEBUG:bleak.backends.corebluetooth.client:Read Characteristic f0cd2004-95da-4f4b-9ac8-aa55d312af0c: bytearray(b'\x1d\x00')
DEBUG:bleak.backends.corebluetooth.client:Read Characteristic f0cd2002-95da-4f4b-9ac8-aa55d312af0c: bytearray(b'<\x00')
Next data point will be logged in 31 seconds
DEBUG:bleak.backends.corebluetooth.client:Read Characteristic f0cd2001-95da-4f4b-9ac8-aa55d312af0c: bytearray(b'\xb0\x13')
DEBUG:bleak.backends.corebluetooth.CentralManagerDelegate:centralManager_didDisconnectPeripheral_error_
DEBUG:bleak.backends.corebluetooth.CentralManagerDelegate:Peripheral Device disconnected!
5040 0

Reading of the log: device name resolved via model+serial fallback (Aranet4 …), firmware v2.0.7, interval 0x3c = 60 s, total readings 0x13b0 = 5040 — then the client disconnects without issuing any history command (f0cd1402 is never written, f0cd2003/f0cd2005 are never touched), and get_all_records returns records_on_device=5040 with an empty value list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions