Commit 93675829 authored by Rousseau Vincent's avatar Rousseau Vincent
Browse files

Add random sleep before while loop

parent 3423d791
No related merge requests found
Showing with 13 additions and 1 deletion
+13 -1
...@@ -4,6 +4,10 @@ from datetime import datetime ...@@ -4,6 +4,10 @@ from datetime import datetime
import threading import threading
import ADS1115 as ads1115_lib import ADS1115 as ads1115_lib
from influxdb import InfluxDBClient from influxdb import InfluxDBClient
from random import uniform
# Start sensors at different time after
time.sleep(uniform(10,60))
influx_host = os.getenv('INFLUX_HOST', 'localhost') influx_host = os.getenv('INFLUX_HOST', 'localhost')
influx_dbname = os.getenv('INFLUX_DBNAME', 'multi-sense') influx_dbname = os.getenv('INFLUX_DBNAME', 'multi-sense')
......
...@@ -3,6 +3,10 @@ import os ...@@ -3,6 +3,10 @@ import os
import smbus2 import smbus2
import bme280 import bme280
from influxdb import InfluxDBClient from influxdb import InfluxDBClient
from random import uniform
# Start sensors at different time after
time.sleep(uniform(10,60))
influx_host = os.getenv('INFLUX_HOST', 'localhost') influx_host = os.getenv('INFLUX_HOST', 'localhost')
influx_dbname = os.getenv('INFLUX_DBNAME', 'multi-sense') influx_dbname = os.getenv('INFLUX_DBNAME', 'multi-sense')
...@@ -27,5 +31,5 @@ while True: ...@@ -27,5 +31,5 @@ while True:
} }
] ]
influx_client.write_points(measurement) influx_client.write_points(measurement)
time.sleep(1) time.sleep(10)
...@@ -2,6 +2,10 @@ import time ...@@ -2,6 +2,10 @@ import time
import os import os
import psutil import psutil
from influxdb import InfluxDBClient from influxdb import InfluxDBClient
from random import uniform
# Start sensors at different time after
time.sleep(uniform(10,60))
influx_host = os.getenv('INFLUX_HOST', 'localhost') influx_host = os.getenv('INFLUX_HOST', 'localhost')
influx_dbname = os.getenv('INFLUX_DBNAME', 'multi-sense') influx_dbname = os.getenv('INFLUX_DBNAME', 'multi-sense')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment