Commit a3564d28 authored by telegnom's avatar telegnom 🐧

air pressure with 2 decimal places

parent 98cb3881
......@@ -274,11 +274,11 @@ class BME280:
def pressure(self):
"Return the temperature in hPa."
p = self.read_pressure() // 256
return round(p / 100., 1)
return round(p / 100, 2)
@property
def humidity(self):
"Return the humidity in percent."
h = self.read_humidity()
return round(h / 100., 1)
return round(h / 1000., 1)
......@@ -29,12 +29,13 @@ def json_sensor():
}
return ujson.dumps(measurement)
_ = json_sensor()
while True:
conn, addr = sock.accept()
print("Connection from {}".format(str(addr)))
request = conn.recv(1024)
request = str(request.decode("ascii"))
request = request.split("\r\n")
print("Request: {}".format(request))
try:
sensor_data = json_sensor()
......
Markdown is supported
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