From f9cc7747c2d790558b073975255bb24eafa767a8 Mon Sep 17 00:00:00 2001 From: Addie Janssen <55428983+addiejanssen@users.noreply.github.com> Date: Fri, 9 Oct 2020 17:07:04 +0200 Subject: [PATCH] Added test for values < 0 --- plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.py b/plugin.py index 26a15f6..1d75212 100644 --- a/plugin.py +++ b/plugin.py @@ -9,7 +9,7 @@ # """ - + @@ -334,7 +334,7 @@ class BasePlugin: lookup_table = unit[Column.LOOKUP] to_lookup = int(inverter_values[unit[Column.MODBUSNAME]]) - if to_lookup < len(lookup_table): + if to_lookup >= 0 and to_lookup < len(lookup_table): value = lookup_table[to_lookup] else: value = "Key not found in lookup table: {}".format(to_lookup)