class platypush.plugins.sensor.lis3dh.SensorLis3dhPlugin(*_, **__)[source]#

Bases: SensorPlugin

Plugin to interact with an Adafruit LIS3DH accelerometer and get X,Y,Z measurement. Tested with a Raspberry Pi over I2C connection.


  • Adafruit-GPIO (pip install Adafruit-GPIO)


__init__(g=4, precision=None, poll_interval=1, **kwargs)[source]#

Only LIS3DH in I2C mode is currently supported:

  • g (int) – Accelerometer range as a multiple of G - can be 2G, 4G, 8G or 16G

  • precision (int) – If set, the position values will be rounded to the specified number of decimal digits (default: no rounding)

get_measurement(*_, **__)[source]#

The sensor’s current position as a dictionary with the three components (x,y,z) in degrees, each between -90 and 90

transform_entities(entities: Dict[str, Any]) List[Accelerometer][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.