From def874583b219c5dd4af675f39d6d2ad169c138e Mon Sep 17 00:00:00 2001 From: Christian Tremblay Date: Tue, 22 Aug 2017 22:28:48 -0400 Subject: [PATCH] Quick modification of enumValue to correct a bug with TEC3000 (JCI) where some weird multiStateValue are hard to resolve. More work to be done, take that as a quick fix. Signed-off-by: Christian Tremblay --- BAC0/core/devices/Points.py | 8 +++++++- BAC0/infos.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/BAC0/core/devices/Points.py b/BAC0/core/devices/Points.py index f779f61e..a01aafca 100644 --- a/BAC0/core/devices/Points.py +++ b/BAC0/core/devices/Points.py @@ -545,7 +545,13 @@ def enumValue(self): """ returns: (str) Enum state value """ - return self.properties.units_state[int(self.history.dropna().iloc[-1]) - 1] + try: + return self.properties.units_state[int(self.history.dropna().iloc[-1]) - 1] + except IndexError: + value = 'unknown' + except ValueError: + value = 'NaN' + return value @property diff --git a/BAC0/infos.py b/BAC0/infos.py index 9d876842..81d98c0f 100644 --- a/BAC0/infos.py +++ b/BAC0/infos.py @@ -12,5 +12,5 @@ __email__ = 'christian.tremblay@servisys.com' __url__ = 'https://github.com/ChristianTremblay/BAC0' __download_url__ = 'https://github.com/ChristianTremblay/BAC0/archive/master.zip' -__version__ = '0.99.105' +__version__ = '0.99.106' __license__ = 'LGPLv3'