Moved the webapp to a webpack with some typescript, updated server wtih new endpoints

This commit is contained in:
Daniel Ledda
2020-11-14 01:06:29 +01:00
parent 6dba158ff0
commit 4e57a8eb47
21 changed files with 11118 additions and 20964 deletions

28
climate-pinger.py Normal file
View File

@@ -0,0 +1,28 @@
#!/usr/local/bin/python3
import adafruit_dht
import mh_z19
from sys import stderr
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.now()),
'Temp:', temp,
'Humidity:', humidity,
'CO2:', co2,
sep='\n',
)
except Exception as error:
print('err:', error, file=sys.stderr)
dhtDevice.exit()