Skip to content

igor47/mini-aqm

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

mini-aqm

Contains code that displays data from the MiniAQI device. For info on the device, see the accompanying blog post.

Setup

This repo uses poetry. You can install poetry globally:

$ pip install poetry

Running

Use poetry to install dependencies:

$ poetry install

Invoke with poetry:

$ poetry run ./main.py

You can get help by passing --help.

Options

By default, this program will scan a few possible tty ports to find a PMS7003. You may wish to pass the location explicitly, by using --port <port>.

Also, by default, the program will print quality measurements to the terminal. It will also print them, in influxdb line protocol format, to measurements.log. You may wish to disable printing to the terminal with --log-only, and customize the location of the log file with --log-path.

Running as a systemd service

On a recent Linux, you can run this as a service. Modify the included mini-aqm.service file, and edit the WorkingDirectory and ExecStart variables. WorkingDirectory should point at the location where you have this repo checked out. ExecStart (and ExecStartPre) should have the path to your poetry binary -- find it with which poetry. You may also wish to customize the arguments to main.py, for instance to set --log-path.

To install the service:

cat mini-aqm.service | sudo tee /etc/systemd/system/mini-aqm.service
sudo systemctl daemon-reload
sudo systemctl start mini-aqm

With telegraf

You might want to pull the measurements into a time series database using telegraf. You can do so by using the tail plugin. The configuration looks like this:

[[inputs.tail]]
   files = ["/home/igor47/repos/mini-aqm/measurements.log"]

Customize the path where your measurements.log file is found. You may wish to pass an explicit path to main.py using --log-path <path>.