Package: aqimon
A simple Air Quality Index monitor, designed to work on the Raspberry Pi with the SDS011 Nova PM Sensor.AQIMONScreenshotInstallationPre-RequisitesInstallRunning AqimonConfigure With SystemdConfigurationContributingToolsetQuickstartUsing the Mock ReaderSubmitting a PRScreenshotInstallationPre-RequisitesPython 3.9+Installpip install aqimonRunning AqimonAqimon is a simple web server.  To start with all the defaults (assuming available SDS011 hardware on/dev/ttyUSB0), you can just run:aqimonAnd then go to your browser athttp://{serveraddress}:8000/to view the UI.If you don't have the requisite SDS011 hardware, you can use a mock data source via amock reader.Configure With SystemdGenerally, you'd want to runAqimonas an always-on service, usingsystemd.To do so, create a file at/etc/systemd/system/aqimin.servicewith the following contents:[Unit]
Description=AQIMON
After=multi-user.target

[Service]
Type=simple
Restart=always
ExecStart=aqimon

[Install]
WantedBy=multi-user.targetAnd then run:sudo systemctl daemon-reload
sudo systemctl start aqimonConfigurationAqimon uses environment variables for configuration, but all values should ship with sensible defaults.VariableDefaultDescriptionAQIMON_DB_PATH~/.aqimon/db.sqliteThe path to the database file, where read information is stored. It should be an absolute path; user home expansion is supported.AQIMON_POLL_FREQUENCY_SEC900 (15 minutes)Sets how frequently to read from the device, in seconds.AQIMON_RETENTION_MINUTES10080 (1 week)Sets how long data will be kept in the database, in minutes.AQIMON_READER_TYPENOVAPMThe reader type to use, either NOVAPM or MOCK.AQIMON_USB_PATH/dev/ttyUSB0The path to the USB device for the sensor.AQIMON_SLEEP_SEC_BETWEEN_READS5The number of seconds to wait for between each read in a set of reads.AQIMON_SAMPLE_COUNT_PER_READ5The number of reads to take with each sample.AQIMON_WARM_UP_SEC15The number of seconds to wait for the device to warm up before reading.AQIMON_COMMAND_WAIT_TIME1The number of seconds to wait for the device respond to a command.AQIMON_EPA_LOOKBACK_MIN60*8The number of minutes to look back at read data to calculate the EPA AQI.AQIMON_SERVER_PORT8000The port to run the server on.AQIMON_SERVER_HOST0.0.0.0The host to run the server on.ContributingToolsetTo start developing, you'll need to install the following tools:Python 3.9+- For API CodeElm 0.19- For client codepoetry- For python package managementjustfile- For buildselm-format- For auto-formatting elm code.Optionally, we havepre-commithooks available as well.  To install hooks, just runpre-commit installand then linters and autoformatting will be applied automatically on commit.QuickstartTo build the project, and install all dev-dependencies, run:just buildTo start the server in develop mode, run:poetry run aqimondTo compile elm changes, run:just compile_elmTo manually run lint checks on the code, run:just lintTo run auto-formatters, run:just formatUsing the Mock ReaderAqimon ships with a mock reader class that you can use in the event that you don't have a reader available on your
development computer.  The mock reader just returns randomized reads.  To use it, you can start the server like:AQIMON_READER_TYPE=MOCK poetry run aqimonSubmitting a PRMaster branch is locked, but you can open a PR on the repo.  Build checks must pass, and changes approved by a code
owner, before merging.