Commit bbb3f4c9 authored by Cédric Crettaz's avatar Cédric Crettaz 🖥

Replace app.py for the Carouge fountain.

parent 9e7e85e3
......@@ -298,8 +298,8 @@ def get_values_from_raw_reading(message_data):
values_registry)
)
# print("modbus / LoRa registers status : {}".format("{0:b}".format(int(status_registry, 16))))
# print("modbus / LoRa registers values : {}".format(values_registry))
app.logger.info("modbus / LoRa registers status : {}".format("{0:b}".format(int(status_registry, 16))))
app.logger.info("modbus / LoRa registers values : {}".format(values_registry))
return [v for v in resp if v] # clean emtpy values (modbus module always the 16 channels in the logger)
......@@ -338,7 +338,8 @@ def _update_fountain_entity(sensor_dataFrame, timestamp):
if len(values) == 1: # this is LoRa Device w/ the turbidity sensor
entity = get_model_water_quality_observed(
turbidity=values[0],
#turbidity=values[0],
turbidity = (65536 - values[0]) / 10,
dateObserved=timestamp,
)
......@@ -403,7 +404,8 @@ def _update_historical_db_from_local_raw_files():
if len(values) == 1: # this is LoRa Device w/ the turbidity sensor
entity = get_model_water_quality_observed(
turbidity=values[0],
#turbidity=values[0],
turbidity = (65536 - values[0]) / 10,
dateObserved=json_data['metadata']['time'],
meta_datetime=json_data['metadata']['time'], # only needed for historical data collected offline
)
......
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