class platypush.plugins.gpio.sensor.accelerometer.GpioSensorAccelerometerPlugin(g=4, precision=None, *args, **kwargs)[source]

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


  • Adafruit_Python_GPIO (pip install Adafruit_Python_GPIO)
__init__(g=4, precision=None, *args, **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)

Extends GpioSensorPlugin.get_measurement()

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