forked from platypush/platypush
Implemented distance sensors backend
This commit is contained in:
parent
5d1fd3a02f
commit
5b5e861f94
1 changed files with 23 additions and 0 deletions
|
@ -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:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue