working
This commit is contained in:
parent
9ffd93c5fc
commit
4efe19e08f
11
monitor.py
11
monitor.py
@ -8,9 +8,9 @@ import influxdb_client
|
||||
import sys
|
||||
import signal
|
||||
|
||||
NUM_READS = 10
|
||||
NUM_READS = 15
|
||||
DELAY_PER_READ = 1
|
||||
DELAY_PER_MEASURE = 300
|
||||
DELAY_PER_MEASURE = 60
|
||||
|
||||
DB_TOKEN = 'sensor1234sensor'
|
||||
DB_ORG = 'sensor'
|
||||
@ -101,11 +101,10 @@ def main():
|
||||
|
||||
logging.info("Uploading data to database...")
|
||||
dbpt = data_to_point(data)
|
||||
logging.debug("DB point: " + str(dbpt))
|
||||
if not dbconn.write_api().write(DB_BUCKET, DB_ORG, dbpt):
|
||||
logging.error("Failed to update database.")
|
||||
dbconn.write_api().write(DB_BUCKET, DB_ORG, dbpt)
|
||||
|
||||
next_ms = cur_ms + DELAY_PER_MEASURE * 1000
|
||||
logging.debug("Next measurement point: " + str(next_ms))
|
||||
logging.info("Next measurement point: " + str(next_ms))
|
||||
else:
|
||||
logging.debug("Next measurement point hasn't arrived. Sleeping for 1s...")
|
||||
time.sleep(1)
|
||||
|
Loading…
Reference in New Issue
Block a user