From 5be86e770339d263c8c6981935e15e982da70ab3 Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Tue, 12 Apr 2022 09:23:38 +0200 Subject: [PATCH] Fix: correct index boundaries for water control --- control/_Control.py | 6 +++--- setup.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/control/_Control.py b/control/_Control.py index ad5b6ba..9229ae7 100644 --- a/control/_Control.py +++ b/control/_Control.py @@ -124,7 +124,7 @@ class Control(threading.Thread): return self.__heat.state() def get_current_water_state(self, ident: int): - if ident > 0 and ident < len(self.__water_state): + if ident > 0 and ident <= len(self.__water_state): return self.__water_state[ident -1] return None @@ -138,7 +138,7 @@ class Control(threading.Thread): def set_water_state(self, ident: str): ident = int(ident) - if ident > 0 and ident < len(self.__water_state): + if ident > 0 and ident <= len(self.__water_state): pin = int(self.__config['water'][ident - 1]['pin']) self.__water_state[ident - 1] = True self.__log.info("water on by button") @@ -146,7 +146,7 @@ class Control(threading.Thread): def clear_water_state(self, ident: str): ident = int(ident) - if ident > 0 and ident < len(self.__water_state): + if ident > 0 and ident <= len(self.__water_state): pin = int(self.__config['water'][ident - 1]['pin']) self.__water_state[ident - 1] = False self.__log.info("water off by button") diff --git a/setup.py b/setup.py index db42ea7..de6e8ba 100755 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ from setuptools import setup from setuptools.command.install import install NAME = 'gardencontrol' -VERSION = '3' +VERSION = '4' AUTHOR = 'Thomas Klaehn' EMAIL = 'tkl@blackfinn.de' PACKAGES = ['config', 'control', 'gardencontrol', 'heat', 'remotecontrol']