Building a Damn Simple Calendar Layout with CSS Grid, Moment, and Vue
Image Post

How to send favorite photo memories via text with a click of a far-away button

Let me preface this by first saying we do not have any pets or plants. My wife works from home frequently, and as a result, I receive phone calls periodically throughout the day for ‘chit-chat.’ I am always happy to participate in this ‘chit-chat,’ but I often need to tell her that it interferes with meetings while I am at work. To help smooth over the disappointment whenever I need to decline the call, I decided to make her something. This decision happened to come around Valentine’s Day last year, so I went all in on a geeky-romantic something. This was early on in my quest to learn Python, a quest I am still on today, but I decided the something I would make her would somehow incorporate Python.
After stumbling across a random Reddit post about watering plants with a raspberry pi, I somehow was inspired to do something similar, only with an AWS IoT button instead of the Raspberry Pi. What I ultimately decided on was a button that would send a photo of the two of us to her via text message. I wanted her to be able to trigger the text message herself, so anytime I didn’t pick up her ‘chit-chat’ call she could go to the kitchen and push the button to receive a photo that made her smile. The button has been a huge success, so I’ve decided to turn it into a blog post in case any geeky-romantics out there want build on this idea!

Project Overview


We will be creating our script in Python using a virtual environment. For those that have not worked with Twilio or AWS before, you’ll need to set up an account for each. Most of these accounts give you free credits to use, but even after those run out I am paying less than $2/month to maintain the project (assuming my wife doesn’t get super nostalgic or chatty!). You also need to get your hands on a 1st generation AWS IoT button off Amazon.

Requirements

  • Unordered list can use asterisks
  • Or minuses
  • Or pluses
  • Unordered list can use asterisks
  • Or minuses
  • Or pluses
  • list item 7

Project overview


Installing python with pyenv

Pyenv is a neat little trick that helps to manage different projects with different dependencies targeting different Python
versions on your local machine. In other words, pyenv allows you to install different versions of Python local to a directory. We will install pyenv using homebrew. If you do not have a mac, then follow instructions here.

Installing pyenv using homebrew on macOS

$ brew install pyenv

Authenticating with Twilio

If you have not already signed up for Twilio and purchased a phone number, please do so now. Make sure to get an account that sends MMS, since we plan to send
a photo text message.

image @ghalhiera

Copy and paste these into your jar_button.py file and replace the account_sid and auth_token with your unique values. Your code should look like this:

from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = ‘ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX’
auth_token = ‘your_auth_token’ 

The steps read as follows:

  1. Place the button into configuration mode by pressing the button down for 5 seconds until it flashes blue
  2. Connect your computer to the button’s Wi-Fi network SSID “Button ConfigureMe — C21”, using your last 8 digits of your
  3. DSN number as the password
  4. Click the blue link and use the info Amazon provides to fill out the form. It should look like this: