From f0686b235f2cf35ec3c1eaf72e2a760506238eed Mon Sep 17 00:00:00 2001 From: Patrick McDonagh Date: Thu, 25 May 2017 14:59:58 -0500 Subject: [PATCH] Catch more errors, new configuration screen Writing values does not totally work. Waiting for help from Meshify --- POCloud/Channel.py | 3 + POCloud/HTML/ConfigurationNew.html | 465 +++++++++++++++++++++++++++++ POCloud/advvfdipp.py | 13 +- 3 files changed, 480 insertions(+), 1 deletion(-) create mode 100644 POCloud/HTML/ConfigurationNew.html diff --git a/POCloud/Channel.py b/POCloud/Channel.py index 6b48fd0..64e9f59 100644 --- a/POCloud/Channel.py +++ b/POCloud/Channel.py @@ -20,6 +20,9 @@ def read_tag(addr, tag): c.close() print("Could not connect during readTag({}, {})".format(addr, tag)) # print err + except AttributeError as e: + c.close() + print("AttributeError during readTag({}, {}): \n{}".format(addr, tag, e)) c.close() return False diff --git a/POCloud/HTML/ConfigurationNew.html b/POCloud/HTML/ConfigurationNew.html new file mode 100644 index 0000000..dfa217a --- /dev/null +++ b/POCloud/HTML/ConfigurationNew.html @@ -0,0 +1,465 @@ + + +
+
+

Control

+
+ + +
+ +
+
+

PID Settings

+
+ + + + + + + +
+ +
+
+

Shutdown Parameters

+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+

Well Parameters

+
+ +
+ +
+ +
+ +
+
+ + + + diff --git a/POCloud/advvfdipp.py b/POCloud/advvfdipp.py index d2f207e..e3b82f4 100644 --- a/POCloud/advvfdipp.py +++ b/POCloud/advvfdipp.py @@ -109,7 +109,7 @@ class start(threading.Thread, deviceBase): def run(self): """Actually run the driver.""" global persist - wait_sec = 30 + wait_sec = 10 for i in range(0, wait_sec): print("advvfdipp driver will start in {} seconds".format(wait_sec - i)) time.sleep(1) @@ -170,3 +170,14 @@ class start(threading.Thread, deviceBase): except KeyError: print("part of the schedule entry is missing") return False + + def advvfdipp_writeplctag(self, name, value): + """Write a value to the PLC.""" + new_val = json.loads(str(value).replace("'", '"')) + tag_n = str(new_val['tag']) # "cmd_Start" + val_n = new_val['val'] + w = write_tag(str(plc_ip_address), tag_n, val_n) + print("Result of advvfdipp_writeplctag(self, {}, {}) = {}".format(name, value, w)) + if w is None: + w = "Error writing to PLC..." + return w