From 7a4e9ad5f2caae9b708e259571cb780dfdfea411 Mon Sep 17 00:00:00 2001
From: awatlet <arnaud.watlet@umons.ac.be>
Date: Wed, 11 Oct 2023 12:42:12 +0200
Subject: [PATCH] Adds modbus assert in dps5005

---
 ohmpi/hardware_components/pwr_dps5005.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ohmpi/hardware_components/pwr_dps5005.py b/ohmpi/hardware_components/pwr_dps5005.py
index 7de83949..140924bd 100644
--- a/ohmpi/hardware_components/pwr_dps5005.py
+++ b/ohmpi/hardware_components/pwr_dps5005.py
@@ -4,7 +4,7 @@ import datetime
 import os
 import time
 from ohmpi.utils import enforce_specs
-#import minimalmodbus  # noqa
+from minimalmodbus import Instrument  # noqa
 
 # hardware characteristics and limitations
 SPECS = {'model': {'default': os.path.basename(__file__).rstrip('.py')},
@@ -30,6 +30,7 @@ class Pwr(PwrAbstract):
         super().__init__(**kwargs)
         if not subclass_init:
             self.exec_logger.event(f'{self.model}\tpwr_init\tbegin\t{datetime.datetime.utcnow()}')
+        assert isinstance(self.connection, Instrument)
         # if a controller is passed in kwargs, it will be instantiated
         #if self.ctl is None:
         #    self.ctl = ctl_module.Ctl(**CTL_CONFIG)
-- 
GitLab