sensor-pmsx003

CLI reference

glasgow run sensor-pmsx003

Measure PM2.5 air quality with Plantower PMx003 family sensors.

This applet has been tested with PMS5003 and PMS7003.

usage: glasgow run sensor-pmsx003 [-h] [-V VOLTS] [--rx PIN] [--tx PIN]
                                  OPERATION ...
-h, --help

show this help message and exit

-V <volts>, --voltage <volts>

configure I/O standard and power supply (range: 1.8..5 V, or ‘S<port>’ to use sense pin; default: unchanged)

--rx <pin>

bind receive (data from the sensor) to PIN (default: ‘A0’, required)

--tx <pin>

bind transmit (data to the sensor) to PIN (default: ‘A1’, optional)

glasgow run sensor-pmsx003 log

usage: glasgow run sensor-pmsx003 log [-h] DATA-LOGGER ...
-h, --help

show this help message and exit

glasgow run sensor-pmsx003 log csv

Log data to a comma-separated value (CSV) file.

usage: glasgow run sensor-pmsx003 log csv [-h] [--dialect DIALECT] CSV-FILE
csv-file

write data to CSV-FILE

-h, --help

show this help message and exit

--dialect {excel,excel-tab,unix}

format CSV file according to DIALECT

glasgow run sensor-pmsx003 log influxdb

Log data to an InfluxDB 1.x endpoint over HTTP(S).

usage: glasgow run sensor-pmsx003 log influxdb [-h] [-r POLICY] [-t TAG=VALUE]
                                               -p PRECISION
                                               [--batch-size BATCH-SIZE]
                                               ENDPOINT DATABASE SERIES
endpoint

write to endpoint URL //ENDPOINT/write

database

write to database DATABASE

series

write to measurement SERIES

-h, --help

show this help message and exit

-r <policy>, --retention-policy <policy>

write to retention policy POLICY

-t <tag=value>, --tag <tag=value>

attach TAG=VALUE to all data points

-p {ns,us,ms,s,m,h}, --precision {ns,us,ms,s,m,h}

set timestamp precision to PRECISION

--batch-size <batch-size>

submit data in groups of BATCH-SIZE points

glasgow run sensor-pmsx003 log influxdb2

Log data to an InfluxDB 2.x endpoint over HTTP(S).

usage: glasgow run sensor-pmsx003 log influxdb2 [-h] [-t TAG=VALUE]
                                                -p PRECISION
                                                [--batch-size BATCH-SIZE]
                                                --token TOKEN
                                                ENDPOINT ORGANIZATION BUCKET
                                                SERIES
endpoint

write to endpoint URL //ENDPOINT/api/v2/write

organization

write to Organization ORGANIZATION (can be either the name or the id)

bucket

write to bucket BUCKET

series

write to measurement SERIES

-h, --help

show this help message and exit

-t <tag=value>, --tag <tag=value>

attach TAG=VALUE to all data points

-p {ns,us,ms,s,m,h}, --precision {ns,us,ms,s,m,h}

set timestamp precision to PRECISION

--batch-size <batch-size>

submit data in groups of BATCH-SIZE points

--token <token>

set the Token to use for Authentication

glasgow run sensor-pmsx003 log stdout

Log data to standard output in a human-readable format.

usage: glasgow run sensor-pmsx003 log stdout [-h]
-h, --help

show this help message and exit

glasgow run sensor-pmsx003 measure

usage: glasgow run sensor-pmsx003 measure [-h]
-h, --help

show this help message and exit

API reference

exception glasgow.applet.sensor.pmsx003.PMSx003Error
class glasgow.applet.sensor.pmsx003.SensorPMSx003Ports(*, supply: glasgow.abstract.GlasgowSupply, rx: amaranth.lib.io.PortLike, tx: amaranth.lib.io.PortLike | None)
supply: GlasgowSupply

configure I/O standard and power supply

rx: PortLike

receive (data from the sensor)

tx: PortLike | None

transmit (data to the sensor)

class glasgow.applet.sensor.pmsx003.PMSx003Interface(logger: Logger, uart_iface: UARTInterface)