Starting anew, before I changed to a custom chart
This commit is contained in:
29
app-dist/scripts/climate-pinger.py
Executable file
29
app-dist/scripts/climate-pinger.py
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import adafruit_dht
|
||||
import mh_z19
|
||||
import sys
|
||||
from board import D4
|
||||
from datetime import datetime
|
||||
|
||||
try:
|
||||
dhtDevice = adafruit_dht.DHT22(D4)
|
||||
temp = dhtDevice.temperature
|
||||
humidity = dhtDevice.humidity
|
||||
co2 = mh_z19.read()
|
||||
if co2 is not None:
|
||||
co2 = co2['co2']
|
||||
else:
|
||||
raise RuntimeError()
|
||||
print(
|
||||
'Time:', str(datetime.isoformat(datetime.now())),
|
||||
'\nTemp:', temp,
|
||||
'\nHumidity:', humidity,
|
||||
'\nCO2:', co2,
|
||||
sep='\t',
|
||||
)
|
||||
except Exception as error:
|
||||
print('err:', error, file=sys.stderr)
|
||||
|
||||
sys.stdout = None
|
||||
dhtDevice.exit()
|
||||
9
app-dist/scripts/pinger-test.py
Normal file
9
app-dist/scripts/pinger-test.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from datetime import datetime
|
||||
|
||||
print(
|
||||
'Time:', str(datetime.isoformat(datetime.now())),
|
||||
'\nTemp:', 20,
|
||||
'\nHumidity:', 60,
|
||||
'\nCO2:', 500,
|
||||
sep='\t',
|
||||
)
|
||||
Reference in New Issue
Block a user