AWS IoT Button Project - Simple Check-In/Check-Out for Hotels and AirBnB
The Project
A simple way for guests staying at hotels or AirBnb to check-in, check-out or ask for help with the click of a button.
In this project, you will set an AWS IoT Button, using AWS cloud services, that can be used to send customized notifications using SMS text messages by a guest to the owner of a hotel or AirBnB host for easy check-in, check-out or request for help.
The button supports three actions- A single click will notify the guest has checked in with the time of check-in. A double click will notify the guest has checked out with time of check-out. A long press of the button will send a distress notification that the guest needs help, with the time at which help was requested.
The AWS architecture for this project is as follows-
The AWS IoT Button connects over wi-fi to the AWS IoT service. An AWS IoT rule triggers a Lambda function that hosts the logic for intercepting button clicks and invoking an SNS topic to send a text message to the registered phone number.
Before We Start
You will need the following before we begin-
- An Amazon Web Services (AWS) Account. Sign up here if you do not have one.
- AWS IoT Button. Buy it on Amazon
Set Up Your Button
Download the AWS IoT Button app. IoS - App Store or Android - Google Play
Sign in to the app using your AWS account credentials.
Follow the instructions on the app to register, configure and set up your button.
On the "Set button action" page, select "Send SMS (nodejs)" and enter the phone number where you would like to receive text messages (SMS).
Modify your Lambda function
The button set up process creates a Lambda function on your AWS account that is triggered by click of your IoT button and invokes Amazon SNS to send the notification text messages.
Log in to your AWS Console and from the Services menu, select Lambda. You should find a newly created Lambda function named "iotbutton_XXX" where XXX is your device code (DNS). If you do not see the function, make sure you are in the same AWS region where the button was registered.
Under the Code tab, delete all existing code and replace it with the code provided here: iot-button-lambda.js
Make sure you replace "const PHONE_NUMBER = '1-999-999-9999';" with the phone number that you want to use to receive SMS notifications.
Save your changes.
Start clicking!
Click your IoT button and test it works as expected.
Clicking once will send a check-in message that looks like this-
CHECK-IN ALERT! Guest in Room 1 has checked in at 22:37:04 PST
Clicking twice will send a check-out message that reads like this-
CHECK-OUT ALERT! Guest in Room 1 has checked out at 09:22:35 PST
Long pressing the button (longer than 2 seconds) will send a distress message that reads like this-
HELP ALERT! Guest in Room 1 needs help! Help requested at 23:18:24 PST