Reputation: 560
I am working on an IoT based project, where I get data from raspberryPi and send it to AWS IoT cloud.
I have created a couple of rules to save data in DynamoDB and send emails on certain conditions. But I am struggling with how to send an email if the device gets DISCONNECTED.
Basically I was wondering if there is any way to get the eventType: disconnected
Screenshot and perform an action upon this event.
Any kind of help would be greatly appreciated.
Thank you !
Upvotes: 2
Views: 464
Reputation: 134
You need to make a rule that periodically attempts to connect with your device and, in the instance of a failure, sends you an email. Your device is not going to send a message as it disconnects because that would require it to know in advance that it was going to disconnect.
Pseudo code:
Run every x amount of time:
if connectionTest == false
sendEmail()
To clarify - you will not get an event type "disconnected" because if your device is disconnected it will not be able to return an event object. You will instead get an error which you will have to catch.
Upvotes: 1
Reputation: 560
I found the solution, basically you have to create a rule that gets executed when the disconnected lifecycle event is triggered. In my case its like this
For more reference you can follow this link: http://docs.aws.amazon.com/iot/latest/developerguide/life-cycle-events.html
Upvotes: 3