gpio.sensor.envirophat

class platypush.plugins.gpio.sensor.envirophat.GpioSensorEnvirophatPlugin(**kwargs)[source]

Bases: GpioSensorPlugin

Plugin to interact with a Pimoroni enviropHAT device. You can use an enviropHAT device to read e.g. temperature, pressure, altitude, accelerometer, magnetometer and luminosity data, plus control the status of its RGB LEDs.

Requires:

  • envirophat (pip install envirophat)

get_measurement(qnh=1020.0)[source]
Param:

qnh: Local value for atmospheric pressure adjusted to sea level (default: 1020)

Returns:

dict. Example:

output = {
    "temperature": 21.0,   # Celsius
    "pressure": 101555.08, # pascals
    "altitude": 10,        # meters
    "luminosity": 426,     # lumens

    # Measurements from the custom analog channels
    "analog": [0.513, 0.519, 0.531, 0.528],

    "accelerometer": {
        "x": -0.000915,
        "y": 0.0760,
        "z": 1.026733
    },
    "magnetometer": {
        "x": -2297,
        "y": 1226,
        "z": -7023
    },
}