Of nothing in particular

by James Miller

PostedJune 27th, 2018#Mac#Screensaver

Other than memories of early computer gaming and getting interested in software development, I don’t have rose colored glasses for the Windows computing days of yore. Seeing where we are now and where we were, it’s hard for me to muster up much nostalgia. There are a few things, however, that do evoke that feeling. One of those things was After Dark screensavers. In particular, the Flying Toaster screensaver.

It exists on the web still in various forms for most platforms but seeing as how screensavers are a technology of the past, you don’t see them too much and most people don’t put much if any thought into them. Especially in todays world where so much computing happens on laptops and we simply shut the lid when we’re done.

I wanted this screensaver, however dumb that is. The problem being, I did not want to give up my beloved Padbury Clock Screensaver. I was also just generally curious what it takes to create a screensaver in 2018.

So I combined the two.

It was surprisingly easy, but with all things you can make it as difficult as you’d like. Many people opt to include SpriteKit in their screensaver to do simple animations. For what I was doing, that felt like unneeded complexity.

So I present to you, (probably) the stupidest thing I’ve ever developed.

Flying Toasters

Feel free to download it here, and if you’d like to modify it or just check out the source that can be done on the project’s Github repository.

Now if I can just get someone to recreate the Johnny Castaway screensaver for Mac, I’ll be living in 90s computing “bliss.”


PostedFebruary 21st, 2018#Puppies

Before we bought our house, I had always wanted to have a dog named Zero. At the time, my wife and I were studying Japanese for a trip we planned to take to visit a friend who was studying abroad in Tokyo (here are a few pictures from that trip). I made an offhand joke once to my wife that if I did ever get a dog named Zero, I'd have to also have one named Ichi (the number one in Japanese) so that I could have binary dogs.

Well, the day we bought our house my wife and parents surprised me with two Shiba puppies. It was a total shock and I couldn't have been more happy.

So. Cute.

Though they love to get in the trash and tear things up (you should have seen our baseboards on our beautiful new house...), they've been great dogs for our family. We even had an album we posted about them go semi viral when we had our daughter. Just stay away from the comments if you go searching... They're exactly what you'd expect.

Puppies and Ash by the fire

What face am I making?


PostedFebruary 13th, 2018#Alexa#Echo#Urban Dictionary

Several months ago, Amazon ran a promotion where they would give you a free Echo Dot if you wrote and published (read 'had approved') an Alexa skill. At the time, we were part of a D&D campaign with some friends and, as D&D campaigns are want to do, things often got off the rails. On more than one occasion someone would make a joke about something lewd and one or two of us would run to Urban Dictionary and, as you can probably guess, the game would come to a grinding halt once the definition was read aloud.

So, I thought why not cut out the middle man and add a middle woman named Alexa?

So that's what I did and Amazon didn't like it one bit...

Needless to say, I never got my Echo Dot but now I have this awesome Urban Dictionary skill which, honestly, is cooler than having yet another Echo Dot around the house (Seriously, they're like Tribbles. They're everywhere.).

If you'd like to have your very own bad-mouthed Alexa, I created a Github repository with all of the information and code you'll need.

Fair warning, you will need an Amazon Developer Account. It'll probably ask you for a credit card, but that card is only used if you actually somehow rack up a bill. That really shouldn't happen unless you use this skill A LOT or somehow manage to get Amazon to publish it and it becomes popular. Just a fair warning that you could be charged should it get a lot of use.

Like this, except with Echoes


PostedMarch 25th, 2017#Raspberry Pi#MQTT#GPIO#Go

I've wanted to formalize this project for a while and just recently got some free time to do so. gpio-to-mqtt is a Go application that monitors state changes to GPIO pins on a Raspberry Pi and relays those changes as JSON messages to an MQTT broker.

That's a mouthful. Hear me out though.

Say you have an old alarm system in your house that you aren't using. You have the little magnetic reed switches on your windows and maybe some door jamb switches that all run back to a central security system box somewhere in a laundry room, garage, basement, or wherever. With this application, you can repurpose those devices and make them smart. gpio-to-mqtt will notify anyone listening when the those switches are tripped.

All it requires is a Raspberry Pi, a network connection, and Go + gpio-to-mqtt to get running.

Once you have this up and running, you can write any number of utility applications to listen to the broker on your network and perform other actions. Maybe you get a notification every time your front door opens or when someone opens a window unexpectedly. You could even just connect physical buttons to the GPIO pins and use them as network attached buttons.

There is still some development work to be done at this point, a lot of which surrounds additional MQTT options (like the ability to connect using certificates). I'm going to follow this post up with my set up for people to reference if needed. For the time being, here's what my install looks like.

Have fun!

Raspberry Pi with a Pi EzConnect HAT running gpio-to-mqtt


PostedAugust 11th, 2016#Amazon#IoT#AWS

In my last post about hacking Amazon Dash buttons, I mentioned there were some hiccups you would run into when trying to make an ordinary Dash Button work for IoT purposes. Namely, you would get an annoying popup on your phone about how you haven't configured an item to ship when pressed.

Item Not Selected Notification

Annoying...

Sure, there were ways around it, but the tradeoffs weren't things I was willing to deal with.

So it sits on my dryer, awaiting the day I feel like blowing extra cash on detergent...

And then my AWS IoT Button finally shipped. After what, three months? I thought Prime was quicker than that...

AWS IoT Button 1 AWS IoT Button 2 AWS IoT Button 3

Ok, ok, it was a preorder, but still, that was a long wait.

The good news is, it works as you would expect without any annoying popups or other weirdness. At least, none that I ran into.

So how does it work? The process is fairly straight forward.

Overview

After you have the button set up (which I'll go into later), pressing it allows the button to turn on, connect to AWS, and fire off a Lambda function that you configure during set up. For those that don't know, Amazon Lambda allows you specify a block of either Java, Javascript, or Python code that is run in the cloud every time the button is pressed.

This raised at least one obvious question for me. What if the device I want this button to interact with exists on my local network and is not accessible from the greater internet? Unless that device itself has some cloud connectivity, you're going to wind up crafting something custom.

Luckily, the AWS IoT button works the same way the original Dash button works in that when it's pressed, it sends out an ARP request on the local network which can be captured fairly easily. I used the go-dash-button library written by Mike Flynn to do my initial tinkering with the button and it worked just fine.

That being said, there are tons of ways to get this to interact with your local network besides using the ARP request method.

I wanted to integrate the button with my Home Assistant install and as such, I typically use MQTT for sharing messages on my local network. After exposing my MQTT server to the greater web and locking it down, I was able to configure the AWS Lambda function to connect to my home MQTT broker and send a message that Home Assistant could then use for automation.

Setup

This was the part that seemed a little unpolished for me. With the Dash button, the wifi is configured through the Amazon app and is a pretty seemless process if I remember correctly. With the AWS IoT button though, it's a bit different. Not unlike many other IoT devices that require internet connectivity, the button creates its own wifi network that you have to connect to with another device.

Before you even get to that point though, you have to set up your Lambda function within the AWS management console and grab some assorted information (including a certificate and private key) to plug into the button's set up page. This part was a little cumbersome, but not too terrible.

Once you've done that, you are instructed to connect to the device's wifi network and pull up a webpage using the IP of the device to configure it. It looks like this:

AWS IoT Button Set Up

Once that's done though, it's easy to use and modify to your liking. You can simply edit your Lambda code and it'll fire at will when pushed.

A Caveat

I mentioned earlier that the way I got the button to work with my home network was to have my Lambda function connect to a publicly accessible MQTT broker. I wanted to clarify one caveat for why I did that instead of just using the go-dash-button library to send MQTT messages so that I don't have to rely on internet connectivity. The reason I did this is that the AWS IoT button supports three different button pushes: single, double, and long press. If you use the ARP library approach, you just get a notification that it's been pressed (or rather, you get a notification that the button is sending an ARP request as it connects to your local network). That's it. If you want to take advantage of those three different modes, I believe the only way is to use the Lambda approach.

I essentially had the Lambda function send an MQTT message with a payload that specifies how the button was pressed so that my Home Assistant install can make use of all three modes.

A Tip

One tip that I came across for making the button a little bit snappier is to get the button's MAC address and set up an IP reservation with your local DHCP provider. The button would often take between 10 and 20 seconds to connect and execute the Lambda function and after giving it a DHCP reservation, it cut this time down some. It seems that some significant portion of that time was spent negotiating an IP.

James Miller