Skip to content

Latest commit

 

History

History
21 lines (13 loc) · 1.32 KB

README.md

File metadata and controls

21 lines (13 loc) · 1.32 KB

Connection lambdas

Part of the detector dag state is the current connection status of any given dag. This is in order reassure a user that their dag is working correctly, or to notify them when they cannot expect a power status update (because it is disconnected).

This is implemented using the AWS IoT lifecycle events:

  • $aws/events/presence/connected/clientId
  • $aws/events/presence/disconnected/clientId

These signals are debounced for a few reasons:

  • Spurious disconnection events can be sent immediately after a connection event, in the case where a device's connection is interrupted and then returns.
  • A user is unlikely to be interested in geniune disconnect/reconnect events if they only account for short periods of downtime (e.g. "lost for 10 minutes").

The solution

  1. All connected/disconnected events are listened to by the listener lambda function and the connection status and time are saved as a "transient" status in the device shadow.
  2. If the new status differs from the "current" status then the handler lambda function is scheduled to be executed 15 minutes later.
  3. The handler lambda function checks if the "transient" status was the same that triggered it's execution, and if it is the "current" status is updated.