-
Notifications
You must be signed in to change notification settings - Fork 17
/
sensor_none.py
82 lines (58 loc) · 2.1 KB
/
sensor_none.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
###########################################################################
# Sint Wind PI
# Copyright 2012 by Tonino Tarsi <tony.tarsi@gmail.com>
#
# Please refer to the LICENSE file for conditions
# Visit http://www.vololiberomontecucco.it
#
##########################################################################
"""This module defines the base sensors none ."""
import threading
import time
import config
import random
import datetime
import sqlite3
from TTLib import *
import sys
import subprocess
import globalvars
import meteodata
import sensor_thread
import sensor
class Sensor_None(sensor.Sensor):
def __init__(self,cfg ):
sensor.Sensor.__init__(self,cfg )
def Detect(self):
return True,"","",""
def GetData(self):
seconds = datetime.datetime.now().second
if ( seconds < 30 ):
time.sleep(30-seconds)
else:
time.sleep(90-seconds)
globalvars.meteo_data.last_measure_time = datetime.datetime.now()
globalvars.meteo_data.idx = datetime.datetime.now()
globalvars.meteo_data.status = 0
globalvars.meteo_data.delay = 0
globalvars.meteo_data.hum_in = None
globalvars.meteo_data.temp_in = None
globalvars.meteo_data.hum_out = None
globalvars.meteo_data.temp_out =None
globalvars.meteo_data.abs_pressure = None
globalvars.meteo_data.wind_ave = None
globalvars.meteo_data.wind_gust = None
globalvars.meteo_data.wind_dir = None
globalvars.meteo_data.wind_dir_code = None
globalvars.meteo_data.rain = None
globalvars.meteo_data.illuminance = None
globalvars.meteo_data.uv = None
sensor.Sensor.GetData(self)
if __name__ == '__main__':
configfile = 'swpi.cfg'
cfg = config.config(configfile)
ss = Sensor_None(cfg)
while ( 1 ) :
ss.GetData()
print logData("http://localhost/swpi_logger.php")
time.sleep(0.2)