PurpleAirSQLiteDataLogger module
Copyright 2023 carlkidcrypto, All rights reserved. A python class designed to use the PurpleAirAPI for requesting sensor(s) data. Data will be inserted into a SQLite3 database file.
For best practice from PurpleAir: “The data from individual sensors will update no less than every 30 seconds. As a courtesy, we ask that you limit the number of requests to no more than once every 1 to 10 minutes, assuming you are only using the API to obtain data from sensors. If retrieving data from multiple sensors at once, please send a single request rather than individual requests in succession.”
- class PurpleAirSQLiteDataLogger.PurpleAirSQLiteDataLogger(PurpleAirAPIReadKey, PurpleAirAPIWriteKey, sqlite_data_base_name)
Bases:
PurpleAirDataLogger
The logger class. For now we will insert data into a SQLite3 database file.
- store_sensor_data(single_sensor_data_dict)
Insert the sensor data into the database.
- Parameters:
single_sensor_data_dict (dict) – A python dictionary containing all fields for insertion. If a sensor doesn’t support a certain field make sure it is NULL and part of the dictionary. This method does no type or error checking. That is upto the caller.