diff --git a/RCUSCC/RCUSCC/RCUSCC.py b/RCUSCC/RCUSCC/RCUSCC.py index cf70f665a21783af0447477d01b77c134bed10e9..90fa69337a05b8d70ca165b8534c1d168c6b2b7d 100644 --- a/RCUSCC/RCUSCC/RCUSCC.py +++ b/RCUSCC/RCUSCC/RCUSCC.py @@ -57,6 +57,8 @@ class RCUSCC(Device): * -> OFF: Device is turned off. Triggered by the Off() command. FAULT -> INIT: Device is reinitialised to recover from an error. Triggered by the Init() command. OFF -> INIT: Device is turned on again. Triggered by the Init() command. + + For integration testing reasons, the user is allowed to manually set the device to FAULT. """ client = 0 name_space_index = 0 @@ -273,11 +275,11 @@ class RCUSCC(Device): self.client = opcua.Client("opc.tcp://{}:{}/".format(self.OPC_Server_Name, self.OPC_Server_Port), self.OPC_Time_Out) # timeout in seconds # Connect to OPC-UA -- will set ON state on success - self.opcua_connection = OPCUAConnection(self.client, self.On, self._Fault, self) + self.opcua_connection = OPCUAConnection(self.client, self.On, self.Fault, self) if not self.opcua_connection.connect(): # hardware or infra is down -- needs fixing first - self._Fault() + self.Fault() return # Retrieve and map server attributes @@ -285,7 +287,7 @@ class RCUSCC(Device): self._map_attributes() except Exception as e: self.error_stream("Could not map server interface: %s", e) - self._Fault() + self.Fault() return # Start keep-alive @@ -472,8 +474,11 @@ class RCUSCC(Device): # Turn off again, in case of race conditions through reconnecting self.set_state(DevState.OFF) - - def _Fault(self): + @command( + ) + @only_in_states([DevState.ON, DevState.INIT]) + @DebugIt() + def Fault(self): """ FAULT state is used to indicate our connection with the OPC-UA server is down.