Skip to content

Commit

Permalink
Merge pull request #88 from firewiremb/firewiremb-patch-2
Browse files Browse the repository at this point in the history
ixes error in command line operation see #25
  • Loading branch information
MichaelB2018 authored Aug 29, 2020
2 parents b79e7b6 + 5c46451 commit 2786329
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion myconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions myscheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 at same or above requested position")
else :
for i in range(self.config.SendRepeat):
self.shutter.rise(shutterId)
Expand All @@ -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 at same or below requested position")
else :
for i in range(self.config.SendRepeat):
self.shutter.lower(shutterId)
Expand Down

0 comments on commit 2786329

Please sign in to comment.