refactoring
This commit is contained in:
parent
1e85ddb9a6
commit
ae0f2c7cb1
1 changed files with 4 additions and 3 deletions
|
@ -36,7 +36,7 @@ else:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from influxdb import InfluxDBClient
|
from influxdb import InfluxDBClient
|
||||||
influxClient = InfluxDBClient(host='localhost', port=8086, username='admin', password='admin')
|
influxClient = InfluxDBClient(host='localhost', port=8086, username='admin', password='raspberry')
|
||||||
influxClient.switch_database("sensors")
|
influxClient.switch_database("sensors")
|
||||||
except:
|
except:
|
||||||
print("influx init error")
|
print("influx init error")
|
||||||
|
@ -71,9 +71,9 @@ class BaudChanger(threading.Thread):
|
||||||
time.sleep(15)
|
time.sleep(15)
|
||||||
print "Change"
|
print "Change"
|
||||||
if self.baud:
|
if self.baud:
|
||||||
rfm.SetParams(Datarate = 9.579)
|
rfm.set_params(Datarate = 9.579)
|
||||||
else:
|
else:
|
||||||
rfm.SetParams(Datarate = 17.241)
|
rfm.set_params(Datarate = 17.241)
|
||||||
self.baud = not self.baud
|
self.baud = not self.baud
|
||||||
|
|
||||||
baudChanger = BaudChanger()
|
baudChanger = BaudChanger()
|
||||||
|
@ -99,6 +99,7 @@ def writeInflux(payload):
|
||||||
|
|
||||||
influxClient.write_points([wr])
|
influxClient.write_points([wr])
|
||||||
|
|
||||||
|
time.sleep(4)
|
||||||
print "Waiting for sensors..."
|
print "Waiting for sensors..."
|
||||||
cache = {}
|
cache = {}
|
||||||
while 1:
|
while 1:
|
||||||
|
|
Loading…
Reference in a new issue