|
|
|
@ -57,19 +57,47 @@ def readout_monitoring_telegram(monitoring_file_path):
|
|
|
|
|
pd_monitoring_data_dict['storage_used'] = line_split[2] |
|
|
|
|
pd_monitoring_data_dict['storage_total'] = line_split[4] |
|
|
|
|
elif "RAM" in line: |
|
|
|
|
line_split=line.split(" ") |
|
|
|
|
line_split = line.split(" ") |
|
|
|
|
pd_monitoring_data_dict['ram_used'] = line_split[1] |
|
|
|
|
elif "Current CPU" in line: |
|
|
|
|
line_split = line.split(" ") |
|
|
|
|
pd_monitoring_data_dict['cpu_used'] = line_split[3] |
|
|
|
|
elif "Last reboot at" in line: |
|
|
|
|
line_split=line.split(" ") |
|
|
|
|
line_split = line.split(" ") |
|
|
|
|
pd_monitoring_data_dict['last_reboot'] = line_split[3] + "T" + line_split[4].strip() |
|
|
|
|
elif line[0:2] == "20": |
|
|
|
|
split_line = line.split(",") |
|
|
|
|
datetimes.append(split_line[0]) |
|
|
|
|
temps.append(split_line[1].strip().split("\t")[1].split(" ")[0]) |
|
|
|
|
humids.append(split_line[2].strip().split(" ")[1]) |
|
|
|
|
elif "SBE19+ serial" in line: |
|
|
|
|
pd_monitoring_data_dict["sbe_serial"] = line.split(":")[1].strip() |
|
|
|
|
elif "Main battery" in line: |
|
|
|
|
pd_monitoring_data_dict["main_battery"] = line.split(" ")[2].strip() |
|
|
|
|
elif "Backup battery" in line: |
|
|
|
|
pd_monitoring_data_dict["backup_battery"] = line.split(" ")[2].strip() |
|
|
|
|
elif "Operating current" in line: |
|
|
|
|
pd_monitoring_data_dict["operating_current"] = line.split(" ")[2].strip() |
|
|
|
|
elif "Pump current" in line: |
|
|
|
|
pd_monitoring_data_dict["pump_current"] = line.split(" ")[2].strip() |
|
|
|
|
elif "SBE 43 current" in line: |
|
|
|
|
pd_monitoring_data_dict["sbe_43_current"] = line.split(" ")[3].strip() |
|
|
|
|
elif "Samples used" in line: |
|
|
|
|
pd_monitoring_data_dict["samples_free_used"] = line.split(":")[1].strip() |
|
|
|
|
elif "Pump delay" in line: |
|
|
|
|
pd_monitoring_data_dict["pump_delay"] = line.split(" ")[2].strip() |
|
|
|
|
elif "FLNTUS serial" in line: |
|
|
|
|
pd_monitoring_data_dict["flntus_serial"] = line.split(":")[1].strip() |
|
|
|
|
elif "Averaged over x" in line: |
|
|
|
|
pd_monitoring_data_dict["averaged_measurements"] = line.split(":")[1].strip() |
|
|
|
|
elif "Number of samples" in line: |
|
|
|
|
pd_monitoring_data_dict["number_samples"] = line.split(":")[1].strip() |
|
|
|
|
elif "Number of cycles" in line: |
|
|
|
|
pd_monitoring_data_dict["number_cycles"] = line.split(":")[1].strip() |
|
|
|
|
elif "Internal memory on" in line: |
|
|
|
|
pd_monitoring_data_dict["memory_on_off"] = line.split(":")[1].strip() |
|
|
|
|
elif "Internal memory used" in line: |
|
|
|
|
pd_monitoring_data_dict["memory_used"] = line.split(":")[1].strip() |
|
|
|
|
else: |
|
|
|
|
print(line) |
|
|
|
|
|
|
|
|
@ -85,7 +113,16 @@ def readout_monitoring_telegram(monitoring_file_path):
|
|
|
|
|
internal_temperature TEXT, |
|
|
|
|
internal_humidity TEXT) |
|
|
|
|
""") |
|
|
|
|
pd_dht_readout.to_sql('dht_measurements', conn, if_exists='append', index=False) |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
pd_dht_readout.to_sql('dht_measurements', conn, if_exists='append', index=False) |
|
|
|
|
except db.IntegrityError as e: |
|
|
|
|
if e.args[0].startswith('UNIQUE constraint failed'): |
|
|
|
|
print("ERROR: Duplicate data found!") |
|
|
|
|
raise |
|
|
|
|
else: |
|
|
|
|
raise |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# file Raspberry Pi status into database |
|
|
|
|
c.execute(""" |
|
|
|
@ -185,8 +222,15 @@ def readout_data_telegram(data_file_path):
|
|
|
|
|
count_ntu TEXT, |
|
|
|
|
count_thermistor TEXT) |
|
|
|
|
""") |
|
|
|
|
pd_flntus_data.to_sql('flntus_measurements', conn2, if_exists='append', index=False) |
|
|
|
|
# file Raspberry Pi status into database |
|
|
|
|
try: |
|
|
|
|
pd_flntus_data.to_sql('flntus_measurements', conn2, if_exists='append', index=False) |
|
|
|
|
except db.IntegrityErrora as e: |
|
|
|
|
if e.args[0].startswith('no such table'): |
|
|
|
|
exists = False |
|
|
|
|
else: |
|
|
|
|
raise |
|
|
|
|
|
|
|
|
|
# file Raspberry Pi status into database |
|
|
|
|
c2.execute(""" |
|
|
|
|
CREATE TABLE IF NOT EXISTS sbe_measurements ( |
|
|
|
|
sbe_rapsi_datetime TEXT PRIMARY KEY, |
|
|
|
|