-
Notifications
You must be signed in to change notification settings - Fork 2
/
coral_enviro.py
34 lines (23 loc) · 1.18 KB
/
coral_enviro.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import logging
from datetime import datetime
from commons.data import Response
from sensors import Sensor
logger = logging.getLogger('root')
class CoralEnviroHumiditySensor(Sensor):
def __init__(self, name, topic, poll_freq_ms, flush_size, flush_after_s):
super().__init__(name, topic, poll_freq_ms, flush_size, flush_after_s)
def get_measurement(self):
logger.debug('humidity data')
return Response({'time': datetime.now().timestamp(), 'value': 35.7}, errors=None)
class CoralEnviroLightSensor(Sensor):
def __init__(self, name, topic, poll_freq_ms, flush_size, flush_after_s):
super().__init__(name, topic, poll_freq_ms, flush_size, flush_after_s)
def get_measurement(self):
logger.debug('light data')
return Response({'time': datetime.now().timestamp(), 'value': 105}, errors=None)
class CoralEnviroTemperatureSensor(Sensor):
def __init__(self, name, topic, poll_freq_ms, flush_size, flush_after_s):
super().__init__(name, topic, poll_freq_ms, flush_size, flush_after_s)
def get_measurement(self):
logger.debug('temp data')
return Response({'time': datetime.now().timestamp(), 'value': 37}, errors=None)