Module history

Source
Expand description

Historical data download.

This module provides functionality to download historical sensor readings stored on an Aranet device.

§Supported Devices

DeviceHistory SupportNotes
Aranet4FullCO₂, temperature, pressure, humidity
Aranet2FullTemperature, humidity
AranetRn+ (Radon)FullRadon, temperature, pressure, humidity
Aranet RadiationNot supportedReturns error - protocol undocumented

Note: Aranet Radiation devices do not support history download. Attempting to download history from an Aranet Radiation device will return an error. Use Device::read_current() for current radiation readings. The radiation_rate and radiation_total fields in HistoryRecord are reserved for future implementation.

§Index Convention

All history indices are 1-based, following the Aranet device protocol:

  • Index 1 = oldest reading
  • Index N = newest reading (where N = total_readings)

This matches the device’s internal indexing. When specifying ranges:

let options = HistoryOptions {
    start_index: Some(1),    // First reading
    end_index: Some(100),    // 100th reading
    ..Default::default()
};

§Protocols

Aranet devices support two history protocols:

  • V1: Notification-based (older devices) - uses characteristic notifications
  • V2: Read-based (newer devices, preferred) - direct read/write operations

Structs§

HistoryCheckpoint
Checkpoint data for resuming interrupted history downloads.
HistoryInfo
Information about the device’s stored history.
HistoryOptions
Options for downloading history.
HistoryProgress
Progress information for history download.
PartialHistoryData
Partially downloaded history data for checkpoint resume.

Enums§

HistoryParam
Parameter types for history requests.
HistoryParamCheckpoint
Serializable version of HistoryParam for checkpoints.

Functions§

raw_to_pressure
Convert raw pressure value to hPa.
raw_to_temperature
Convert raw temperature value to Celsius.

Type Aliases§

CheckpointCallback
Type alias for checkpoint callback function.
ProgressCallback
Type alias for progress callback function.