linx5o commited on
Commit
e49c0e0
·
1 Parent(s): acb53e4

removal of creds

Browse files
Files changed (1) hide show
  1. app.py +46 -38
app.py CHANGED
@@ -41,7 +41,8 @@ if "experiment" not in st.session_state:
41
  "growth_rate_calculating": False,
42
  "stirring": False,
43
  "od_reading": False,
44
- "led_automation": False
 
45
  }
46
  st.session_state["client"] = None
47
 
@@ -59,11 +60,11 @@ if use_custom_credentials:
59
  # hivemq_port = st.number_input("HiveMQ Port", min_value=1, max_value=65535, step=1, value=8883)
60
  # reactor = st.text_input("PioReactor")
61
 
62
- hivemq_host = st.text_input("HiveMQ Host", "9bb69fc9bf6b4092abc4c92d76e602cd.s1.eu.hivemq.cloud",type="password")
63
- hivemq_username = st.text_input("HiveMQ Username", "Website",type="password")
64
- hivemq_password = st.text_input("HiveMQ Password", "Abcabcabc1",type="password")
65
  hivemq_port = st.number_input("HiveMQ Port", min_value=1, max_value=65535, step=1, value=8883)
66
- reactor = st.text_input("PioReactor", "pio1")
67
 
68
  submit_button = st.form_submit_button("Connect")
69
  else:
@@ -277,11 +278,12 @@ if submit_button:
277
  if st.session_state["jobs"]["stirring"]:
278
  print(rpm_mqtt)
279
  st.session_state["stirring_speed"] = rpm_mqtt
280
-
281
- st.session_state["channel_a"] = int(led_mqtt.get("A", 0))
282
- st.session_state["channel_b"] = int(led_mqtt.get("B", 0))
283
- st.session_state["channel_c"] = int(led_mqtt.get("C", 0))
284
- st.session_state["channel_d"] = int(led_mqtt.get("D", 0))
 
285
 
286
  st.session_state["experiments"] = experiments
287
 
@@ -293,6 +295,36 @@ if submit_button:
293
  if st.session_state["experiment"] is not None:
294
  st.title(f"Experiment: {st.session_state['experiment']}")
295
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  with st.form("experiment_form"):
297
  new_name = st.text_input("New Experiment Name")
298
  submit_new_experiment = st.form_submit_button("Create New Experiment")
@@ -389,30 +421,6 @@ if st.session_state["experiment"] is not None:
389
  time.sleep(3)
390
  st.rerun()
391
 
392
- st.header("Running Jobs")
393
-
394
- cols = st.columns(5)
395
-
396
- with cols[0]:
397
- st.write("Temperature")
398
- st.write(st.session_state["jobs"]["temperature_automation"])
399
-
400
- with cols[1]:
401
- st.write("Growth Rate")
402
- st.write(st.session_state["jobs"]["growth_rate_calculating"])
403
-
404
- with cols[2]:
405
- st.write("Stirring")
406
- st.write(st.session_state["jobs"]["stirring"])
407
-
408
- with cols[3]:
409
- st.write("OD Reading")
410
- st.write(st.session_state["jobs"]["od_reading"])
411
-
412
- with cols[4]:
413
- st.write("LED")
414
- st.write(st.session_state["jobs"]["led_automation"])
415
-
416
  st.divider()
417
 
418
  # Display the job details
@@ -773,7 +781,7 @@ if st.session_state["experiment"] is not None:
773
  st.session_state["client"].loop_start()
774
  st.session_state["client"].publish("pioreactor/control", payload_str, qos=1)
775
 
776
- time.sleep(1)
777
 
778
  # Check if the OD reading job is running
779
  get_running_jobs(st.session_state["client"], reactor)
@@ -1265,11 +1273,11 @@ if st.session_state["experiment"] is not None:
1265
  "reactor": reactor,
1266
  "filter_mod": 1,
1267
  "lookback": 100000,
1268
- "filter_mod2": 188,
1269
  "lookback2": 100000,
1270
- "filter_mod3": 188,
1271
  "lookback3": 100000,
1272
- "filter_mod4": 188,
1273
  "lookback4": 100000,
1274
  "amount": amount_of_data,
1275
  "amount2": amount_of_data2,
 
41
  "growth_rate_calculating": False,
42
  "stirring": False,
43
  "od_reading": False,
44
+ "led_automation": False,
45
+ "dosing_automation": False
46
  }
47
  st.session_state["client"] = None
48
 
 
60
  # hivemq_port = st.number_input("HiveMQ Port", min_value=1, max_value=65535, step=1, value=8883)
61
  # reactor = st.text_input("PioReactor")
62
 
63
+ hivemq_host = st.text_input("HiveMQ Host", type="password")
64
+ hivemq_username = st.text_input("HiveMQ Username", type="password")
65
+ hivemq_password = st.text_input("HiveMQ Password", type="password")
66
  hivemq_port = st.number_input("HiveMQ Port", min_value=1, max_value=65535, step=1, value=8883)
67
+ reactor = st.text_input("PioReactor")
68
 
69
  submit_button = st.form_submit_button("Connect")
70
  else:
 
278
  if st.session_state["jobs"]["stirring"]:
279
  print(rpm_mqtt)
280
  st.session_state["stirring_speed"] = rpm_mqtt
281
+
282
+ if led_mqtt is not None:
283
+ st.session_state["channel_a"] = int(led_mqtt.get("A", 0))
284
+ st.session_state["channel_b"] = int(led_mqtt.get("B", 0))
285
+ st.session_state["channel_c"] = int(led_mqtt.get("C", 0))
286
+ st.session_state["channel_d"] = int(led_mqtt.get("D", 0))
287
 
288
  st.session_state["experiments"] = experiments
289
 
 
295
  if st.session_state["experiment"] is not None:
296
  st.title(f"Experiment: {st.session_state['experiment']}")
297
 
298
+ st.header("Running Jobs")
299
+
300
+ cols = st.columns(6)
301
+
302
+ with cols[0]:
303
+ st.write("Temperature")
304
+ st.write(st.session_state["jobs"]["temperature_automation"])
305
+
306
+ with cols[1]:
307
+ st.write("Growth Rate")
308
+ st.write(st.session_state["jobs"]["growth_rate_calculating"])
309
+
310
+ with cols[2]:
311
+ st.write("Stirring")
312
+ st.write(st.session_state["jobs"]["stirring"])
313
+
314
+ with cols[3]:
315
+ st.write("OD Reading")
316
+ st.write(st.session_state["jobs"]["od_reading"])
317
+
318
+ with cols[4]:
319
+ st.write("LED")
320
+ st.write(st.session_state["jobs"]["led_automation"])
321
+
322
+ with cols[5]:
323
+ st.write("Dosing")
324
+ st.write(st.session_state["jobs"]["dosing_automation"])
325
+
326
+ st.divider()
327
+
328
  with st.form("experiment_form"):
329
  new_name = st.text_input("New Experiment Name")
330
  submit_new_experiment = st.form_submit_button("Create New Experiment")
 
421
  time.sleep(3)
422
  st.rerun()
423
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  st.divider()
425
 
426
  # Display the job details
 
781
  st.session_state["client"].loop_start()
782
  st.session_state["client"].publish("pioreactor/control", payload_str, qos=1)
783
 
784
+ time.sleep(2)
785
 
786
  # Check if the OD reading job is running
787
  get_running_jobs(st.session_state["client"], reactor)
 
1273
  "reactor": reactor,
1274
  "filter_mod": 1,
1275
  "lookback": 100000,
1276
+ "filter_mod2": 1,
1277
  "lookback2": 100000,
1278
+ "filter_mod3": 1,
1279
  "lookback3": 100000,
1280
+ "filter_mod4": 1,
1281
  "lookback4": 100000,
1282
  "amount": amount_of_data,
1283
  "amount2": amount_of_data2,