class platypush.plugins.sensor.envirophat.SensorEntityMapping(name: str, entity_type: ~typing.Type[~platypush.entities.sensors.Sensor], unit: str | None = None, kwargs: ~typing.Dict[str, ~typing.Any] = <factory>)[source]#

Bases: object

Maps sensor attributes returned by SensorEnvirophatPlugin.get_measurement() to native sensor entities.

__init__(name: str, entity_type: ~typing.Type[~platypush.entities.sensors.Sensor], unit: str | None = None, kwargs: ~typing.Dict[str, ~typing.Any] = <factory>) None#
property id#

Standard format for an Envirophat sensor external ID.

class platypush.plugins.sensor.envirophat.SensorEnvirophatPlugin(*_, **__)[source]#

Bases: SensorPlugin

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.


  • envirophat (pip install envirophat)


get_measurement(*_, qnh: float = 1020.0, **__)[source]#

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


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
transform_entities(entities: Dict[str, int | float]) List[Device][source]#

This method takes a list of entities in any (plugin-specific) format and converts them into a standardized collection of Entity objects. Since this method is called by publish_entities() before entity updates are published, you may usually want to extend it to pre-process the entities managed by your extension into the standard format before they are stored and published to all the consumers.