From 5b5e861f94e3c3172e1cd4c49c599c552f3285b1 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 6 Sep 2018 03:02:16 +0200 Subject: [PATCH] Implemented distance sensors backend --- platypush/backend/sensor/distance/__init__.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/platypush/backend/sensor/distance/__init__.py b/platypush/backend/sensor/distance/__init__.py index e69de29bb..3813d7c14 100644 --- a/platypush/backend/sensor/distance/__init__.py +++ b/platypush/backend/sensor/distance/__init__.py @@ -0,0 +1,23 @@ +from platypush.backend.sensor import SensorBackend +from platypush.context import get_plugin + + +class SensorDistanceBackend(SensorBackend): + """ + Backend to poll a distance sensor. + + Requires: + + * ``RPi.GPIO`` (``pip install RPi.GPIO``) + * The :mod:`platypush.plugins.gpio.sensor.distance` plugin configured + """ + + def get_measurement(self): + """ get_measurement implementation """ + plugin = get_plugin('gpio.sensor.distance') + return plugin.get_data().output + + +# vim:sw=4:ts=4:et: + +