snsary.contrib.pimoroni

Factory to wrap Pimoroni sensor objects, many of which have different ways to read data and structure the results. Because this is just a wrapper class, you will need to separately install the Pimoroni library for each sensor you want to poll.

Example for the MICS6814 3-in-1 Gas Sensor:

# install the sensor library
pip3 install pimoroni-mics6814

# create the sensor to poll
GenericSensor.mics6814_i2c()

Warning: sensors like mics6814_i2c rely on the Pimoroni IO Expander library, which uses smbus2 internally and doesn’t implement any kind of locking. This means it’s possible for multiple sensors to conflict if they poll for data around the exact same time.

Module Contents

class snsary.contrib.pimoroni.GenericSensor(*, name, read_fn)

Bases: snsary.sources.PollingSensor

property name
classmethod mics6814_i2c()

Returns a sensor configured to scrape oxidising, reducing and nh3 values in Ohms. Calling this function also switches off the LED of the MICS 6814, which is on by default.

Requires the mics6814-python library. Note that, while Pimoroni do provide a library for CircuitPython (similarly to many Adafruit sensors), this only supports pin-based wiring.

sample(timestamp, **kwargs)