From e81a7cdcf12815e33c14e52f7da129c0c93ca6ab Mon Sep 17 00:00:00 2001
From: Dan <magoc@ginasystem.com>
Date: Wed, 9 Sep 2020 08:20:48 +0200
Subject: [PATCH 1/2] enable/disable GUI command for phenometrics PBR added

---
 custom/devices/Phenometrics/classes/PBR.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/custom/devices/Phenometrics/classes/PBR.py b/custom/devices/Phenometrics/classes/PBR.py
index 99f8001..c43f66f 100644
--- a/custom/devices/Phenometrics/classes/PBR.py
+++ b/custom/devices/Phenometrics/classes/PBR.py
@@ -37,6 +37,8 @@ def __init__(self, config: dict):
             "23": self.get_cluster_name
         }
 
+        self.disableGUI()
+
     def get_temp_settings(self):
         """
         Get information about currently set temperature, maximal and
@@ -318,5 +320,17 @@ def test_connection(self) -> bool:
         except Exception:
             return False
 
+    def disableGUI(self):
+        success, result = self.connection.send_command(self.device_id, "disableGUI", [])
+        if not success:
+            raise Exception(result)
+        return {'success': result.lstrip() == "disableGUI"}
+
+    def enableGUI(self):
+        success, result = self.connection.send_command(self.device_id, "enableGUI", [])
+        if not success:
+            raise Exception(result)
+        return {'success': result.lstrip() == "enableGUI"}
+
     def disconnect(self):
-        pass    # TODO
\ No newline at end of file
+        self.enableGUI()

From 2cd537adf8562be53ff7c7ff5c709cbeffdc8993 Mon Sep 17 00:00:00 2001
From: Dan <magoc@ginasystem.com>
Date: Fri, 11 Sep 2020 16:53:10 +0200
Subject: [PATCH 2/2] enableGUI temporary hotfix

---
 custom/devices/Phenometrics/classes/PBR.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/custom/devices/Phenometrics/classes/PBR.py b/custom/devices/Phenometrics/classes/PBR.py
index c43f66f..60a6bf3 100644
--- a/custom/devices/Phenometrics/classes/PBR.py
+++ b/custom/devices/Phenometrics/classes/PBR.py
@@ -330,7 +330,8 @@ def enableGUI(self):
         success, result = self.connection.send_command(self.device_id, "enableGUI", [])
         if not success:
             raise Exception(result)
-        return {'success': result.lstrip() == "enableGUI"}
+        # TODO: change "disableGUI" string to "enableGUI" after the bug on Phenometrics software is fixed
+        return {'success': result.lstrip() == "disableGUI"}
 
     def disconnect(self):
         self.enableGUI()