mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-09-19 15:59:07 +02:00
Updated Custom Sensor (markdown)
+9
-3
@@ -3,6 +3,10 @@
|
|||||||
## Active Sensor
|
## Active Sensor
|
||||||
|
|
||||||
```
|
```
|
||||||
|
from modules import cbpi
|
||||||
|
from modules.core.hardware import SensorActive
|
||||||
|
from modules.core.props import Property
|
||||||
|
|
||||||
@cbpi.sensor
|
@cbpi.sensor
|
||||||
class DummyTempSensor(SensorActive):
|
class DummyTempSensor(SensorActive):
|
||||||
|
|
||||||
@@ -23,12 +27,12 @@ class DummyTempSensor(SensorActive):
|
|||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
'''
|
'''
|
||||||
Active sensor has to handle his own loop
|
Active sensor has to handle its own loop
|
||||||
:return:
|
:return:
|
||||||
'''
|
'''
|
||||||
while self.is_running():
|
while self.is_running():
|
||||||
self.data_received(self.temp)
|
self.data_received(self.temp)
|
||||||
socketio.sleep(5)
|
self.sleep(5)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def init_global(cls):
|
def init_global(cls):
|
||||||
@@ -43,4 +47,6 @@ class DummyTempSensor(SensorActive):
|
|||||||
|
|
||||||
## Passive Sensor`
|
## Passive Sensor`
|
||||||
|
|
||||||
Get's invoked by CraftBeerPi core every 5 seconds`
|
Get's invoked by CraftBeerPi core every 5 seconds`
|
||||||
|
|
||||||
|
COMMING SOON
|
||||||
Reference in New Issue
Block a user