Skip to content

Simple example of sending AWS IoT Button events through AWS Lambda then on to Firebase

License

Notifications You must be signed in to change notification settings

stursby/aws-iot-button

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS IoT Button

Simple example of sending AWS IoT Button events through AWS Lambda then on to Firebase.

Web

Simple webpage using Firebase that will display button push events. There are three types (SINGLE, DOUBLE, and LONG). Button events will automagically be added to the page thanks to Firebase’s child_added event.

The website it located at /web/index.html

Sample Firebase security rules

{
    "rules": {
        ".read": true,
        "$uid": {
            ".write": "auth !== null && auth.uid === $uid"
        }
    }
}

Lambda

AWS Lambda Node.js (4.3) script. This handles the payload from the AWS IoT Button and passes it along to Firebase.

The Lambda script is located at /lambda/index.js

To run it, you’ll need to create your own Firebase, and insert the base URL, along with generating a token so you can POST data to it.

Sample payload

{
    "serialNumber": "G030JF059405K485",
    "batteryVoltage": "1615mV",
    "clickType": "SINGLE"
}

Lambda logs can be found in AWS Cloudwatch, too.

Node

You can also run a normal Dash button (or the IoT Button) using node-dash-button. Once the button is configured (on your local network), you can run the bin/findbutton script to detect your button’s MAC address.

Example node script is located at /node/app.js

To run it, cd into the node directory and install the dependecies.

npm install

Then run the app (must use sudo)

sudo node app.js

If eveything is confiured correctly you should see Button pressed! logged out in the Terminal.

About

Simple example of sending AWS IoT Button events through AWS Lambda then on to Firebase

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published