Almost there
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import adafruit_dht
|
||||
import mh_z19
|
||||
from sys import stderr
|
||||
import sys
|
||||
from board import D4
|
||||
from datetime import datetime
|
||||
|
||||
@@ -17,12 +17,13 @@ try:
|
||||
raise RuntimeError()
|
||||
print(
|
||||
'Time:', str(datetime.now()),
|
||||
'Temp:', temp,
|
||||
'Humidity:', humidity,
|
||||
'CO2:', co2,
|
||||
sep='\n',
|
||||
'\nTemp:', temp,
|
||||
'\nHumidity:', humidity,
|
||||
'\nCO2:', co2,
|
||||
sep='\t',
|
||||
)
|
||||
except Exception as error:
|
||||
print('err:', error, file=sys.stderr)
|
||||
|
||||
sys.stdout = None
|
||||
dhtDevice.exit()
|
||||
10
server.go
10
server.go
@@ -111,14 +111,14 @@ func getSnapshotFromPythonScript() (*SnapshotSubmission, error) {
|
||||
)
|
||||
}
|
||||
tokens := strings.Split(string(output), "\n")
|
||||
if len(tokens) != 4 {
|
||||
if len(tokens) != 5 {
|
||||
return nil, errors.New(fmt.Sprintf("Strange python output: %s", output))
|
||||
}
|
||||
snapshot := SnapshotSubmission{
|
||||
Timestamp: tokens[0],
|
||||
Temp: tokens[1],
|
||||
Humidity: tokens[2],
|
||||
Co2: tokens[3],
|
||||
Timestamp: strings.Split(tokens[0], "\t")[1],
|
||||
Temp: strings.Split(tokens[1], "\t")[1],
|
||||
Humidity: strings.Split(tokens[2], "\t")[1],
|
||||
Co2: strings.Split(tokens[3], "\t")[1],
|
||||
}
|
||||
return &snapshot, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user