sensor.distance.vl53l1x#

class platypush.plugins.sensor.distance.vl53l1x.SensorDistanceVl53l1xPlugin(*_, **__)[source]#

Bases: SensorPlugin

Plugin to interact with an VL53L1x laser ranger/distance sensor

Requires:

  • smbus2 (pip install smbus2)

  • vl53l1x (pip install vl53l1x)

Triggers:

__init__(i2c_bus=1, i2c_address=41, poll_interval=3, **kwargs)[source]#
Parameters:
  • i2c_bus – I2C bus number (default: 1)

  • i2c_address – I2C address (default: 0x29)

  • poll_interval – How often the integration should poll for new measurements (default: 3 seconds).

get_measurement(*_, short=True, medium=True, long=True, **__)[source]#
Parameters:
  • short – Enable short range measurement (default: True)

  • medium – Enable medium range measurement (default: True)

  • long – Enable long range measurement (default: True)

Returns:

dict. Example:

output = {
    "short": 83,     # Short range measurement in mm
    "medium": 103,   # Medium range measurement in mm
    "long": 200,     # Long range measurement
}
transform_entities(entities: Mapping[str, int]) 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.