get_air_quality_history
Retrieve historical air quality data stored on the device's SD card. Filter by time range, select specific sensors, and control response size with downsampling.
Instructions
Get historical air quality data stored on the device's SD card.
IMPORTANT — 'sensors' must be a JSON array, not a plain string.
Correct: sensors=["pm1","pm2_5"]
Wrong: sensors="pm1"
IMPORTANT — response size: air-Q records every ~2 minutes, so long ranges
produce large responses (24 h ≈ 720 readings × ~25 sensors). Always use
'sensors' and 'max_points' when querying more than 1–2 hours to stay within
response size limits. Example for a 24 h chart: sensors=["pm1","pm2_5","pm10"],
max_points=150.
Time range — specify one of:
- 'last_hours' — data from the last N hours (default: 1 hour)
- 'from_datetime' / 'to_datetime' — ISO 8601 strings
(e.g. "2026-03-10T14:00:00" or "2026-03-10T14:00:00+01:00")
'from_datetime' takes precedence over 'last_hours'.
'to_datetime' defaults to now.
- 'timezone_name' — optional IANA timezone such as "Europe/Berlin".
Naive datetimes are interpreted in this timezone. Output timestamps are
localized into `datetime` using the same timezone.
Optional filtering:
- 'sensors' — list of sensor names to include (e.g. ["pm1", "pm2_5", "pm10"]).
Omit to get all sensors.
- 'max_points' — downsample to at most this many evenly spaced points.
Response: column-oriented JSON with `timestamp` (Unix seconds) and localized
`datetime` columns. Compound sensor values like `[value, quality]` are split
into `<sensor>` and `<sensor>_quality`. Includes `_sensor_guide` and
`_history_guide`.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device | No | ||
| last_hours | No | ||
| from_datetime | No | ||
| to_datetime | No | ||
| sensors | No | ||
| max_points | No | ||
| timezone_name | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |