I’ve four kids (and we’re done). My oldest is 9, and my youngest is 2. The oldest always wakes up around 5am, and the toddler wakes up around 6:30. I don’t like waking up at 6:30, and the oldest can now get her out of the crib.
So, every morning around 6:30, I hear the two year old start crying and then get my phone and text my son, who goes to get her. This is mostly great, except I have to wake up enough to send a text message (even just to copy/paste a previous request from the day before).
I could suggest that he get her up any time she starts crying after 6:30, but there are circumstances where we don’t want that, so I still want to be manually involved to some extent.
Enter the Amazon IoT Button. I hooked that up to an AWS Lambda function, which pings Pushover, which sends a push notification to my son’s iPad. So, now instead of sending a text, I just push a button and go back to sleep.
The code itself is pretty simple. I didn’t really care about input, so it’s just an unused Java inputstream (note that all of the Lambda stuff requires plain Java interactions, so .asJava is necessary if you’re returning a non-primitive). Full repo on GitHub: terrbear/iot-pinger:
I’m not really embracing Dispatch’s futures here, but that seemed reasonable for the way it’s running. Also, Lambda wants a class it can instantiate to call the handler method (from my tiny bit of experimentation).
Steps to reproduce:
- Buy an IoT button
- Install Pushover and make an account and register an app
- Make your own Lambda function - when you’re creating the Lambda function you’ll be given an opportunity to register your IoT Button.