Create an emergency button in under 10 minutes
This post will provide a Step-By-Step guide to create an emergency button to notify SMS and email subscribers.
1 Before you start
You need to have following parts to start:
- AWS IoT Button (https://www.amazon.com/All-New-AWS-IoT-Button-Generation/dp/B01KW6YCIM/ref=sr_1_1?ie=UTF8&qid=1515345656&sr=8-1&keywords=iot+button)
- AWS Free Tier subscription (https://aws.amazon.com/free/)
- Email Address
- Smartphone to receive SMS
2 Getting started
- Sign in to AWS IoT Console — https://docs.aws.amazon.com/iot/latest/developerguide/iot-console-signin.html
- Register you button in the Thing Registry — https://docs.aws.amazon.com/iot/latest/developerguide/register-device.html
- Create a device certificate — https://docs.aws.amazon.com/iot/latest/developerguide/create-device-certificate.html
- Configure your button — https://docs.aws.amazon.com/iot/latest/developerguide/configure-iot.html
- Test your button — https://docs.aws.amazon.com/iot/latest/developerguide/view-mqtt-messages.html
In this scenario we are using the IoT Button to send emergency messages using the AWS IoT Stack, a Lambda function written in Python and SNS to inform the subscribers via SMS and email.
- Open the AWS IoT Console
- Create new rule
3. add action
4. create Lambda function using the python code below. Change TopicArn to your sns topic. https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/US_SetupSNS.html will help you to configure SNS. Configure two subscribers: (1) for SMS and (2) for Email.
Now you can test your button.
Single click shall notify your configured SNS subscribers with the message “Need help”.
Double click shall notify your configured SNS subscriber with “Need help, it’s urgent.”
Long click shall notify your configured SNS subscriber with “Need help, it’s urgent.”