While Dash buttons may have been discontinued, their design lives on with AWS’s IoT Buttons. Instead of ordering junk food, these can be set up to trigger AWS Lambda functions, allowing you to script your own functionality with NodeJS and Python.
What Does the IoT Enterprise Button Do?
What’s even better is that the button has three modes—single-click, double-click, and long-press—which is passed to the Lambda function and can trigger different actions based on the press type. This essentially turns this one button into three with the alternate modes.
They’re great, and were actually surprisingly simple to set up and get working. The main issue though is the latency—because these things are designed to run off a single battery for thousands of presses, they stay in low-power mode until you press them. Because of this, it takes about four seconds for the button to turn on, connect to Wi-Fi, and trigger the Lambda function. Depending on your use case, this can be a dealbreaker, but I’ve been using one to control my smart lights in lieu of an automation hub and haven’t found it to be too annoying.
AWS makes a few types of these IoT buttons, but the IoT Enterprise button is the upgrade version of the old “IoT Button”. Most notably, it’s much easier to set up and manage deployments through AWS’s “IoT 1-Click” service without having to install or manage certificates. At $20 a pop, and being small enough to fit in a pocket, these buttons are great.
AWS also makes an LTE variant of this button, in conjunction with AT&T. Due to the nature of setting up a Wi-Fi based-IoT device like this, it’s not very feasible to give the standard IoT Enterprise buttons out to remote clients without configuring the buttons on-site on their network. It’s a bit pricier, at $40, and is quite a bit bigger, but will work anywhere there is cell signal, and is reportedly a lot faster than the Wi-Fi-based variant. The setup for these should be mostly the same, as they use the same backend under the hood.
Either way, you can’t really proceed with setup until you order one, so you’ll probably want to bookmark this page for later, and come back in a few days once it arrives.
Setting Up an IoT Button
Once your button arrives, download the IoT button setup app for iOS or Android. This acts as a scanner that will link buttons to your account. This requires you to be on the same Wi-Fi network as them, which makes setup super simple for the IoT Enterprise buttons.
Open the app, sign in with your AWS account or IAM user credentials, and select “Configure WiFi” under the IoT Enterprise section:
This will bring up a scanner which will ask you to scan the device ID found on the packaging of the device. Once scanned, you’ll have to claim the devices, and put them in pairing mode by holding down the button for 6 seconds. This will connect to the device over Bluetooth, and configure it with the WiFi credentials you’ve chosen.
You can add any number of devices this way, and if you’ve already set up your IoT project, you can add them directly to it from the app.
If you’re just following along, you’ll have to create a project to configure the settings for your devices and handle placements. Head over to the IoT Console in your browser, and create a new project under Manage > Projects:
Give it a name, then move on to the next screen. The first thing you’ll need to add is a device template. This basically defines the type of device you’re deploying, and what action it triggers when it’s pressed. If you’re just configuring one device, you’ll still need to create a template to add it to. If you have multiple devices, you can create multiple-device templates for different actions, or add multiple devices to the same template to have two buttons that do the same thing.
Your options are sending SMS, email, or triggering a Lambda function. You’ll probably want to trigger a Lambda function, so select the function here. Annoyingly, there’s no option to refresh this list, so if you just created a Lambda function for this template, you’ll have to refresh the page and start the project setup over.
That should complete the project setup. On the next screen, choose to add a new “Device Placement,” which basically associates a physical device with a device template and project, and is used to track devices in the field.
Once that’s done, the button should be connected. If you press it, it should run your chosen Lambda function, and generate a new press event in the log. If it’s not working, you should test your Lambda function to make sure it’s not an issue with that, and make sure the press is showing up in the log.
The press information is passed to the Lambda function in the event parameter of the handler function:
The most useful thing here is the deviceEvent and clickType, which you can use in your function to do execute different actions depending on whether or not the user single-clicked, double-clicked, or long-pressed. If you ignore this value in your script, all press types will be the same.
From here, programming it is up to you. You can read our guide to working with Lambda functions to learn more.