aqi -- command line utility for pulling sensor data from purpleair.com
$ aqi --sensor=<id>[,<id>,...] [options]
--api_url=<URL> set API url (default https://www.purpleair.com/json?show=) --average display averages per sensor rather than every value -g provide gestalt guess of net AQI -i round displayed numbers to their nearest integer values --no_errors squelch error notifications to stderr --no_warnings squelch warning notifications to stderr --now report current AQI instead of ten-minute average --prune-threshold=<fraction> set threshold for pruning additional outliers with -g (default 0.1 (10%)) --raw report raw concentration numbers, not EPA PM2.5 AQI --sensor=<IDS> numeric IDs of sensors to query (default 25407) --stash-path=<DIRECTORY> save fetched JSON blobs to given directory
See documentation for Weather::PurpleAir::API for details on these options.
Report is one line per sensor, each line consisting of tab-separated sensor name and PM2.5 values (or their average with --average).
The gestalt guess (-g option) is reported with sensor name "GUESSING".
The first value provided is the average of sensor readings. It will discount outliers if enough sensor readings were provided.
The second value is the standard deviation of the guess. Higher implies lower confidence (more skew between the average and the actual values).
The guess output is not influenced by the --average option.
The sensor readings are not always reliable. A car starting or a person smoking near the sensor can produce a false high reading. Right now the workaround is to specify multiple sensors and use the -g option. Future releases will provide alternative remedies.
$ aqi --sensor=22961,25407,26363,38887 -g City Of Santa Rosa Laguna Treatment Plant 97.4506528040242 97.2762981784708 Gravenstein School 105.746724675409 104.535337039851 Geek Orchard 110.119707305832 105.034255297563 Litchfield 101.627723408978 104.651888137621 GUESSING 104.140418315465 4.14926751407653 $ bin/aqi --sensor=22961,38887 -g -i City Of Santa Rosa Laguna Treatment Plant 109 108 Litchfield 109 121 GUESSING 109 6 $ aqi --sensor=22961,38887 --average City Of Santa Rosa Laguna Treatment Plant 98.5790284968979 Litchfield 103.551331508591
To install Weather::PurpleAir::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Weather::PurpleAir::API
CPAN shell
perl -MCPAN -e shell install Weather::PurpleAir::API
For more information on module installation, please visit the detailed CPAN module installation guide.