Skip to content

Commit

Permalink
Fixed a bug where non-enabled triggers would fire
Browse files Browse the repository at this point in the history
Added handlers for new event log events
bump to 1.0.17
  • Loading branch information
Michael Lamoureux committed Jul 3, 2019
1 parent 50e2908 commit 3a06a63
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion August Home.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>1.0.16</string>
<string>1.0.17</string>
<key>ServerApiVersion</key>
<string>2.0</string>
<key>IwsApiVersion</key>
Expand Down
20 changes: 18 additions & 2 deletions August Home.indigoPlugin/Contents/Server Plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,10 @@ def update_all_from_august_activity_log(self):

# Process any Invalid code triggers
for trigger in indigo.triggers.iter("self.invalidCode"):

if not trigger.enabled:
continue

self.logger.debug("Checking if trigger: \"" + trigger.name + "\" has occured. Max latency: " + str(trigger.pluginProps["maxLatency"]) + ", Event delta: " + str(delta_time.total_seconds()))
if int(delta_time.total_seconds()) <= int(trigger.pluginProps["maxLatency"]):
indigo.trigger.execute(trigger)
Expand Down Expand Up @@ -1052,8 +1056,8 @@ def update_all_from_august_activity_log(self):

elif activityItem.callingUser == "by Auto Relock":
indigo.server.log(u"received \"" + dev.name + "\" was Auto-Locked at " + activityItem.dateTime.strftime("%Y-%m-%d %H:%M:%S") + " (" + str(int(delta_time.total_seconds())) + " seconds ago)")
elif activityItem.action == "addedpin":
indigo.server.log(u"received \"" + dev.name + "\" PIN Code was added for a new user (ignored).")
elif activityItem.action == "addedpin" or "removedpined":
indigo.server.log(u"received \"" + dev.name + "\" PIN Code was added or removed for a user (ignored).")
break
elif activityItem.via == "via ZWave":
indigo.server.log(u"received \"" + dev.name + "\" was " + activityItem.action + "ed at " + activityItem.dateTime.strftime("%Y-%m-%d %H:%M:%S") + " (" + str(int(delta_time.total_seconds())) + " seconds ago) " + activityItem.via + extraText)
Expand All @@ -1074,6 +1078,10 @@ def update_all_from_august_activity_log(self):

# PROCESS LOCK TRIGGERS
for trigger in indigo.triggers.iter("self.lockByPerson"):

if not trigger.enabled:
continue

self.logger.debug("Checking if trigger: \"" + trigger.name + "\" has occured. Max latency: " + str(trigger.pluginProps["maxLatency"]) + ", Event delta: " + str(delta_time.total_seconds()))
try:
if int(delta_time.total_seconds()) <= int(trigger.pluginProps["maxLatency"]):
Expand All @@ -1091,6 +1099,10 @@ def update_all_from_august_activity_log(self):
self.logger.debug(" error while processing trigger: " + str(e))

for trigger in indigo.triggers.iter("self.lockByUnknownPerson"):

if not trigger.enabled:
continue

self.logger.debug("Checking if trigger: \"" + trigger.name + "\" has occured. Max latency: " + str(trigger.pluginProps["maxLatency"]) + ", Event delta: " + str(delta_time.total_seconds()))
try:
if int(delta_time.total_seconds()) <= int(trigger.pluginProps["maxLatency"]):
Expand Down Expand Up @@ -1118,6 +1130,10 @@ def update_all_from_august_activity_log(self):

# PROCESS DOORBELL TRIGGERS
for trigger in indigo.triggers.iter("self.doorbellMotion"):

if not trigger.enabled:
continue

self.logger.debug("Checking if trigger: \"" + trigger.name + "\" has occured. Max latency: " + str(trigger.pluginProps["maxLatency"]) + ", Event delta: " + str(delta_time.total_seconds()))
if delta_time.total_seconds() <= int(trigger.pluginProps["maxLatency"]):
if trigger.pluginProps["eventType"] == "any":
Expand Down

0 comments on commit 3a06a63

Please sign in to comment.