temphistory - wolfen351/public-micropython-iot-platform GitHub Wiki
Overview
The TempHistory
module is responsible for tracking and managing temperature data over time. It provides telemetry data, processes incoming telemetry, and serves historical temperature data through web routes.
Features
- Tracks hourly, daily, and monthly temperature data.
- Provides telemetry data such as min, max, and average temperatures.
- Stores and retrieves historical temperature data from disk.
- Serves temperature history details via web routes.
UI Hardware / Pinout Configuration
No specific hardware or pinout configuration is required for this module.
Telemetry Provided
The module provides the following telemetry data:
tempmin
: Minimum temperature recorded in the current hour.tempmax
: Maximum temperature recorded in the current hour.tempavg
: Average temperature recorded in the current hour.tempcount
: Number of temperature readings in the current hour.daymin
: Minimum temperature recorded in the current day.daymax
: Maximum temperature recorded in the current day.dayavg
: Average temperature recorded in the current day.daycount
: Number of temperature readings in the current day.
Telemetry Consumed
The module processes telemetry data with the following fields:
time
: ISO 8601 formatted timestamp of the telemetry data.tempReadAt
: Timestamp of the last temperature reading.temperature*
: Temperature readings (e.g.,temperature1
,temperature2
).
Commands Provided
The module does not provide any commands.
Commands Consumed
The module does not consume any commands.
Additional Information
-
Routes:
The module provides the following web routes:/temphistory
: Serves the main temperature history page./temphistorydetailtoday
: Provides detailed temperature data for the current day./temphistorydetailyesterday
: Provides detailed temperature data for the previous day./temphistorydetailmonth
: Provides detailed temperature data for the current month.
-
Data Storage:
The module saves historical temperature data to a file namedtemphistory.json
and loads it on startup. -
Dependencies:
- Requires the
datetime
module for processing timestamps. If not available, it attempts to install it using WiFi. - Uses
ujson
for JSON serialization and deserialization.
- Requires the