From a8fa8fb0cdfc5da7699d74ead70e5cd59e665e91 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Mon, 7 Dec 2020 11:38:53 +0100
Subject: [PATCH] Allow explicit reinitialisation through Init(), and disabled
 direct On() command.

---
 RCUSCC/RCUSCC/RCUSCC.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/RCUSCC/RCUSCC/RCUSCC.py b/RCUSCC/RCUSCC/RCUSCC.py
index 6fd823a82..30bd2aabe 100644
--- a/RCUSCC/RCUSCC/RCUSCC.py
+++ b/RCUSCC/RCUSCC/RCUSCC.py
@@ -206,21 +206,12 @@ class RCUSCC(Device):
 
         self.debug_stream("Mapping OPC-UA MP/CP to attributes done.")
 
-
     def init_device(self):
         """Initialises the attributes and properties of the RCUSCC."""
-        Device.init_device(self)
-
-        self.Init()
 
-    @command(
-    )
-    @DebugIt()
-    def Init(self):
-        """
+        # NOTE: Will delete_device first, if necessary
+        Device.init_device(self)
 
-        :return:None
-        """
         self.set_state(DevState.INIT)
 
         # Init the dict that contains attribute to OPC-UA MP/CP mappings.
@@ -312,6 +303,7 @@ class RCUSCC(Device):
 
         self.Off()
         self.debug_stream("Shut down.  Good bye.")
+
     # ------------------
     # Attributes methods
     # ------------------
@@ -438,6 +430,17 @@ class RCUSCC(Device):
     # Commands
     # --------
 
+    @command(
+    )
+    @DebugIt()
+    def Init(self):
+        """
+
+        :return:None
+        """
+
+        self.init_device()
+
     @command(
     )
     @DebugIt()
-- 
GitLab