Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
fix bug when input may have multiple true or multiple false values
fix bug where non-unicode iputs weren't converted to lowercase
  • Loading branch information
kmarkley committed Apr 25, 2020
1 parent d3cb757 commit 1b515ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Timed Devices.indigoPlugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>0.0.24</string>
<string>0.0.25</string>
<key>ServerApiVersion</key>
<string>2.0</string>
<key>IwsApiVersion</key>
Expand Down
12 changes: 5 additions & 7 deletions Timed Devices.indigoPlugin/Contents/Server Plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,8 @@ def doTask(self, task, arg1=None, arg2=None):
def devChanged(self, oldDev, newDev):
if newDev.id in self.deviceStateDict:
stateKey = self.deviceStateDict[newDev.id]
if oldDev.states[stateKey] != newDev.states[stateKey]:
rawVal = newDev.states[stateKey]
boolVal = self.getBoolValue(rawVal)
boolVal = self.getBoolValue(newDev.states[stateKey])
if boolVal != self.getBoolValue(oldDev.states[stateKey]):
if self.plugin.verbose:
self.logger.debug(u'"{}" devChanged:"{}" [stateKey:{}, raw:{}, type:{}, input:{}]'
.format(self.name, newDev.name, stateKey, rawVal, type(rawVal), boolVal))
Expand All @@ -498,9 +497,8 @@ def devChanged(self, oldDev, newDev):
#-------------------------------------------------------------------------------
def varChanged(self, oldVar, newVar):
if newVar.id in self.variableList:
if oldVar.value != newVar.value:
rawVal = newVar.value
boolVal = self.getBoolValue(rawVal)
boolVal = self.getBoolValue(newVar.value)
if boolVal != self.getBoolValue(oldVar.value):
if self.plugin.verbose:
self.logger.debug(u'"{}" varChanged:"{}" [raw:{}, type:{}, input:{}]'
.format(self.name, newVar.name, rawVal, type(rawVal), boolVal))
Expand Down Expand Up @@ -542,7 +540,7 @@ def getBoolValue(self, value):
result = not result
elif self.logic == 'complex':
try:
if self.valType == 'str' and not isinstance(value, unicode):
if self.valType == 'str':
value = unicode(value).lower()
elif self.valType == 'num':
value = float(value)
Expand Down

0 comments on commit 1b515ec

Please sign in to comment.