Simplified SensorBackend implementations

This commit is contained in:
Fabio Manganiello 2018-06-11 23:49:37 +02:00
parent f8506d6d25
commit 33a507f047
2 changed files with 1 additions and 9 deletions

View File

@ -29,6 +29,7 @@ class SensorBackend(Backend):
def run(self):
super().run()
self.logger.info('Initialized {} sensor backend'.format(self.__class__.__name__))
while not self.should_stop():
new_data = self.get_measurement()

View File

@ -1,21 +1,12 @@
import serial
from platypush.backend.sensor import SensorBackend
from platypush.context import get_plugin
class SensorSerialBackend(SensorBackend):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def get_measurement(self):
plugin = get_plugin('serial')
return plugin.get_data().output
def run(self):
self.logger.info('Initialized serial backend')
super().run()
# vim:sw=4:ts=4:et: