Added test for values < 0
This commit is contained in:
@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
<plugin key="SolarEdge_ModbusTCP" name="SolarEdge ModbusTCP" author="Addie Janssen" version="1.0.3" externallink="https://github.com/addiejanssen/domoticz-solaredge-modbustcp-plugin">
|
<plugin key="SolarEdge_ModbusTCP" name="SolarEdge ModbusTCP" author="Addie Janssen" version="1.0.4" externallink="https://github.com/addiejanssen/domoticz-solaredge-modbustcp-plugin">
|
||||||
<params>
|
<params>
|
||||||
<param field="Address" label="Inverter IP Address" width="150px" required="true" />
|
<param field="Address" label="Inverter IP Address" width="150px" required="true" />
|
||||||
<param field="Port" label="Inverter Port Number" width="100px" required="true" default="502" />
|
<param field="Port" label="Inverter Port Number" width="100px" required="true" default="502" />
|
||||||
@ -334,7 +334,7 @@ class BasePlugin:
|
|||||||
lookup_table = unit[Column.LOOKUP]
|
lookup_table = unit[Column.LOOKUP]
|
||||||
to_lookup = int(inverter_values[unit[Column.MODBUSNAME]])
|
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]
|
value = lookup_table[to_lookup]
|
||||||
else:
|
else:
|
||||||
value = "Key not found in lookup table: {}".format(to_lookup)
|
value = "Key not found in lookup table: {}".format(to_lookup)
|
||||||
|
|||||||
Reference in New Issue
Block a user