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