From e199b1eeab34dae7e6c78117d42630c2674f10ef Mon Sep 17 00:00:00 2001 From: firewiremb <63193396+firewiremb@users.noreply.github.com> Date: Tue, 28 Jul 2020 16:00:23 +0200 Subject: [PATCH 1/5] Update myscheduler.py --- myscheduler.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/myscheduler.py b/myscheduler.py index 7559565..1d7fe0e 100644 --- a/myscheduler.py +++ b/myscheduler.py @@ -326,7 +326,10 @@ def run(self): s = eventDetail[1][2:].strip() s1 = int(s) if s else -1 if (0 < s1 < 100): - self.shutter.risePartial(shutterId, s1) + if (self.shutter.getPosition(shutterId) <= s1): #Is Shutter below requested Position? + self.shutter.risePartial(shutterId, s1) + else: + self.LogWarn("Send action \""+eventDetail[1]+"\" to shutterId \""+shutterId+"\" was canceled! Shutter was already above requested position") else : for i in range(self.config.SendRepeat): self.shutter.rise(shutterId) @@ -335,7 +338,10 @@ def run(self): s = eventDetail[1][4:].strip() s1 = int(s) if s else -1 if (0 < s1 < 100): - self.shutter.lowerPartial(shutterId, s1) + if (self.shutter.getPosition(shutterId) >= s1): #Is Shutter above requested Position? + self.shutter.lowerPartial(shutterId, s1) + else: + self.LogWarn("Send action \""+eventDetail[1]+"\" to shutterId \""+shutterId+"\" was canceled! Shutter was already below requested position") else : for i in range(self.config.SendRepeat): self.shutter.lower(shutterId) From 6f1447005dcd9b726a8a87f0652d597658085749 Mon Sep 17 00:00:00 2001 From: firewiremb <63193396+firewiremb@users.noreply.github.com> Date: Wed, 5 Aug 2020 20:31:26 +0200 Subject: [PATCH 2/5] Update myscheduler.py --- myscheduler.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/myscheduler.py b/myscheduler.py index 1d7fe0e..d22e34f 100644 --- a/myscheduler.py +++ b/myscheduler.py @@ -326,10 +326,10 @@ def run(self): s = eventDetail[1][2:].strip() s1 = int(s) if s else -1 if (0 < s1 < 100): - if (self.shutter.getPosition(shutterId) <= s1): #Is Shutter below requested Position? + if (self.shutter.getPosition(shutterId) < s1): #Is Shutter below requested Position? self.shutter.risePartial(shutterId, s1) else: - self.LogWarn("Send action \""+eventDetail[1]+"\" to shutterId \""+shutterId+"\" was canceled! Shutter was already above requested position") + self.LogWarn("Send action \""+eventDetail[1]+"\" to shutterId \""+shutterId+"\" was canceled! Shutter was already at same or above requested position") else : for i in range(self.config.SendRepeat): self.shutter.rise(shutterId) @@ -338,10 +338,10 @@ def run(self): s = eventDetail[1][4:].strip() s1 = int(s) if s else -1 if (0 < s1 < 100): - if (self.shutter.getPosition(shutterId) >= s1): #Is Shutter above requested Position? + if (self.shutter.getPosition(shutterId) > s1): #Is Shutter above requested Position? self.shutter.lowerPartial(shutterId, s1) else: - self.LogWarn("Send action \""+eventDetail[1]+"\" to shutterId \""+shutterId+"\" was canceled! Shutter was already below requested position") + self.LogWarn("Send action \""+eventDetail[1]+"\" to shutterId \""+shutterId+"\" was canceled! Shutter was already at same or below requested position") else : for i in range(self.config.SendRepeat): self.shutter.lower(shutterId) From d4982d3812c8b3229697a309538b8937bb070f31 Mon Sep 17 00:00:00 2001 From: firewiremb <63193396+firewiremb@users.noreply.github.com> Date: Mon, 10 Aug 2020 11:28:13 +0200 Subject: [PATCH 3/5] Fixes error in command line operation see #25 Fixes error massage in command line operation as mentioned by @Secarius and @ssanden in Issue #25 _Error in MyConfig:ReadValue: 0x279621: invalid literal for int() with base 10: 'None' : myconfig.py:160_ For the object _getint()_ None ist not an valid type. But None ist used as initial value in the config file --- myconfig.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/myconfig.py b/myconfig.py index c1e3d8d..49f35c5 100644 --- a/myconfig.py +++ b/myconfig.py @@ -157,7 +157,10 @@ def ReadValue(self, Entry, return_type = str, default = None, section = None, No elif return_type == float: return self.config.getfloat(self.Section, Entry) elif return_type == int: - return self.config.getint(self.Section, Entry) + if self.config.get(self.Section, Entry) == 'None': + return None + else: + return self.config.getint(self.Section, Entry) else: self.LogErrorLine("Error in MyConfig:ReadValue: invalid type:" + str(return_type)) return default From df9f7b060be4c3275848f52eac732e739ca5b86f Mon Sep 17 00:00:00 2001 From: firewiremb <63193396+firewiremb@users.noreply.github.com> Date: Mon, 10 Aug 2020 12:34:00 +0200 Subject: [PATCH 4/5] Undo commit e199b1eeab34dae7e6c78117d42630c2674f10ef --- myconfig.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/myconfig.py b/myconfig.py index 49f35c5..c1e3d8d 100644 --- a/myconfig.py +++ b/myconfig.py @@ -157,10 +157,7 @@ def ReadValue(self, Entry, return_type = str, default = None, section = None, No elif return_type == float: return self.config.getfloat(self.Section, Entry) elif return_type == int: - if self.config.get(self.Section, Entry) == 'None': - return None - else: - return self.config.getint(self.Section, Entry) + return self.config.getint(self.Section, Entry) else: self.LogErrorLine("Error in MyConfig:ReadValue: invalid type:" + str(return_type)) return default From 5c4645104322eeabad42dd422cd31e9e41fa4a8f Mon Sep 17 00:00:00 2001 From: firewiremb <63193396+firewiremb@users.noreply.github.com> Date: Mon, 10 Aug 2020 12:39:36 +0200 Subject: [PATCH 5/5] Fixes error in command line operation see #25 Fixes error massage in command line operation as mentioned by @Secarius and @ssanden in Issue #25 "Error in MyConfig:ReadValue: 0x279621: invalid literal for int() with base 10: 'None' : myconfig.py:160" For the object _getint()_ None ist not an valid type. But None ist used as initial value in the config file --- myconfig.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/myconfig.py b/myconfig.py index c1e3d8d..9b5d31b 100644 --- a/myconfig.py +++ b/myconfig.py @@ -157,7 +157,10 @@ def ReadValue(self, Entry, return_type = str, default = None, section = None, No elif return_type == float: return self.config.getfloat(self.Section, Entry) elif return_type == int: - return self.config.getint(self.Section, Entry) + if self.config.get(self.Section, Entry) == 'None': + return None + else: + return self.config.getint(self.Section, Entry) else: self.LogErrorLine("Error in MyConfig:ReadValue: invalid type:" + str(return_type)) return default