PurpleAirCSVDataLogger 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 CSV files.

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 PurpleAirCSVDataLogger.PurpleAirCSVDataLogger(PurpleAirApiReadKey=None, PurpleAirApiWriteKey=None, PurpleAirApiIpv4Address=None, path_to_save_csv_files_in=None)

Bases: PurpleAirDataLogger

The logger class. For now we will insert data into a CSV file.

store_sensor_data(single_sensor_data_dict)

Insert the sensor data into CSV files.

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.