Ha ha, get it? The first Rest API? Programmer humor, right? Anyway, someone who knows that I love Smart Lights sent me a Hatch Baby Rest as a gift, and I was excited to unbox it and try it out. The Rest is a small nightlight that pairs with an Android or iOS app to set the color, auto-timer/schedule for turning on and off, and controlling the volume of the built-in speaker which plays soothing sounds.
Now, it’s supergreat that the light has an app, but I’ve got like 20 lights in my house and if each one had its own app I’d have a hard time keeping track of 20 different apps for controlling the lights. Luckily I’m a handy guy and I’ve got a home automation setup that could slot in this light quite nicely.
If only it had an API, that is. I mean, in this day and age, what smart light maker doesn’t have one?
clickity-clickity-click (sound of me writing to Hatch Baby to ask about it…)
Hmmmm…. well that sucks…
So — you know where this is going, don’t you… fast forward a few hours and I’m happy to introduce to you a great .NET API for the Hatch Baby Rest. Thanks to Windows 10’s improved support (in the Creators Update 15063) for Bluetooth LE pair-less communication, it was actually pretty quick to do. UPDATE: I later on got a note from Ken (VP of software at Hatch Baby) that they’d be happy to contribute to OSS projects in the future, which is super awesome to hear coming from the company, kudos to them.
Here’s a sample, just a few lines of code. Hope this could be useful to other home automators.
If you’re wondering why after so many years there’s still no app to unlock your August Lock from your Android Wear watch, you’re not alone. But now you can unlock your August locks from your watch using the Zones app!
Just set up a geofence zone in the app with a special action url:
To get the key, offset and id, use the instructions here. Getting the keys is a little technical, but if you have an Android Wear watch you’re probably already a super nerd, so I trust you’ll get it.
Then when you’re “in the zone”, a wear notification will pop up and you can press it to unlock your door. Sweet!
You can also trigger other HTTP APIs using the app, if you’ve got any of those lying around. And if you’d like to integrate August Smart Locks into your Xamarin App, check out the plugin I wrote to provide this functionality, Plugin.Android.AugustLock. Happy unlocking!
Today in #ThingsIWishExisted: August Smart Lock API
I bought an August Smart Lock three years ago so I could stop carrying around door keys and have my doors magically unlock themselves. Actually that’s not really true, I really bought a crowdfunded Lockitron three years ago but the dang thing was going to be so delayed I impulse bought the August lock while in an Apple store. I later rationalized the purchase thinking that I’d compare it to the Lockitron when it eventually arrived, and return one of them. It ended up being OVER THREE YEARS before the Lockitron finally showed up, and by that time I’d moved out of my apartment in Boston to Texas where my new place had a door that no longer fit the Lockitron.
Long story short, I’ve been using the August lock for a while. The thing that sucks about it is that the August Auto-Unlock feature is pretty crappy. The dream is that I walk up to the door, it magically unlocks itself and I open it and stride through like a man from the future. The reality is that I do that about 25% of the time, I stand awkwardly in front of the door waiting for it to eventually open 50% of the time, and 25% of the time it never opens and I sigh and use the Android app to unlock the door (or I use the key I never stopped carrying). First world problems, right?
This wouldn’t be too much of a problem if August would create an Android Wear app for my smartwatch, so I could quickly just tap my wrist while walking up to the door to unlock it instead of fishing my phone out of my pockets, unlocking it, opening the app, waiting for it to start up and then tapping my house icon and waiting and then tapping the unlock button. Terrible! But they haven’t made an Android Wear app probably because there aren’t enough people willing to look like nerds and wear Android watches to justify the expense. Well, that’s fine, I could just write my own Android Wear app, but I’d need access to the August Smart Lock API and they don’t make it public. What’s the point of having a Smart Lock if the smart features aren’t available for tinkerers to tinker with? So frustrating.
A smart guy reverse engineered the bluetooth protocol and released a NodeJs program that could run on a Raspberry Pi to open the August lock, but running Wifi, Bluetooth and NodeJs on a Raspberry Pi was asking for trouble, and my setup crashed often enough to fail the WAT1. I ended up creating a horribly complicated system derived from the Node library which now involves an old phone, a Microsoft Azure Function and Google Firebase notifications to work with my old Geolocation Watch App to unlock the door. It’s working for now, so we’ll see if it ends up being reliable enough to pass the WAT.
UPDATE 3/18/2017: It ended up being too slow and unreliable so I ported the August bluetooth API to Xamarin (and made a plugin) so I could build this functionality into my Zones app. Works much better.
Oh, and the Lockitron that arrived 3 years late and doesn’t fit my door? It has a public API.
I reinstalled Windows on my desktop and laptop from scratch earlier this week to fix some nagging issues and clear out the cruft. Starting from a blank slate with a fresh install (vs an upgrade or install in-place) always makes me feel great. That’s a little sick, I know. But all the apps work like they’re supposed to and the computer just feels more… solid. As more of my life goes into the cloud, the list of software I need to reinstall gets shorter, and with Chocolatey and a USB drive with a few installers, I can do full OS reinstall in under an hour. With Chrome Sync, after reinstalling the browser and logging in, all my extensions, settings, saved passwords and bookmarks magically re-appear. Everything is awesome!
Until I try to open up a few of my favorite services and try to log in there…
I could go on for a while, since every site that I can turn on 2-factor authentication for I have done so. This greatly increases my security in case my password is ever hacked or I get phished. It also means that after reinstalling I got to spend tons of time and annoyance getting SMS text messages, Google Authenticator codes, security code emails, and typing in answers to security questions. Normally the 2-factor authentication only requires verification periodically, and you mark your browser as a “registered device” to avoid having to jump through the hoops. To do this, your browser stores a “cookie” with an authentication token used on future visits to the sites you register. And although Chrome Sync restored 29 apps, 16 extensions, 202 settings, 415 passwords and 52 bookmarks for me, it does not sync cookies!!
This is of course by design. Normally syncing cookies would be a really bad idea since it would defeat the purpose of 2-factor authentication. But when reinstalling your computer, it would be nice if there was a way to bring over cookies. You used to be able to do this by copying the Chrome User Data folder, but this was a bit of a security risk because that meant your passwords and cookies were sitting around on your disk unprotected and could potentially be stolen. So in 2014 Chrome started encrypting protected data like cookies, using a special encryption key that is different for every user and computer.
I’d reinstalled Windows a few times since 2014, so I’ve gone through 2-Factor-Apocalypse a few times, with each time getting worse as more sites allow 2-Factor Authentication or implement security questions or email processes. To make things worse, I’ve started installing Windows Insider pre-release builds, so I’ll probably reinstall from scratch again soon and have to go through the whole thing again. Madness!
I did a search to see if there were any solutions for backing up and restoring Chrome cookies, and it didn’t look like there were any suited to my use case, so I spent a few hours cooking one up. (See what I did there? lol)
It slices, it dices, it backs up and restores cookies for multiple profiles at once. You can check out the tool on GitHub, and use it to avoid 2-F-Apocalypse the next time you update your machine! Just make sure you run the backup before you wipe out your old install since you need to log on with the Windows user account of the Chrome profile to create the decrypted backup file. And sorry, it doesn’t work on Linux1 or macOS since the encryption used there is different.
If you’re an avid reader of blogs and still got your head in the sand using RSS you probably use a feed aggregator service like Feedly to read your news. Putting aside the argument of whether RSS is dead and everyone uses Twitter or Reddit to get their news, feed readers can be useful at least to provide an app like Reeder or GReader content for you to sync offline and read while you suffer through internet withdrawal on a plane (although this has changed much in recent years with most flights, even over the Pacific or Atlantic getting internet service).
Offline content is great, but the dreaded “partial feed” can cause a particularly link-baity headline like “26 Things That Will Make You Say ‘Hmmm, That’s Interesting’” end in disappointment as you see the truncated excerpt and then the taunting “Click here to read more” link only you can’t click there since you don’t have internet!1
Well, have no fear dear reeders, and enjoy whiling the time away in-flight (assuming you remembered to sync your feeds before you went into airplane mode), because Feedability is here! Feedability is a full feed readability server, which takes existing RSS or Atom feeds as input, and replaces the truncated article synopsis with the full Readability‘d version of the feed entry links. As shown in the screenshot above, you can preview article content to tweak it with CSS white/blacklist selectors before generating a feed link–the Readability library (the same one used in Firefox for its “Readability mode”) does a pretty good job at extracting the page content but sometimes needs a few hints to find all the article content and exclude non-content. Feel free to fiddle with the demo site, but if you want to use it for real you’ll have to set up your own server since the demo site has IP throttling to avoid tons of people from using it and overloading my demo server.
This is another tool that’s aimed at the techie crowd, but let’s face it–normals don’t really use RSS anyway. Besides, there’s some joy in tweaking the CSS selector rules to get your feed looking just right (until the authors change the page layout, but whatever). So, hope this is useful to you and if not at least now all of my feeds are full-feed, and as a bonus I got to learn about the Materialize CSS library (to the point: don’t use it, too immature) and then Polymer (two-word review: thumbs up!), and the recently released ASP.Net Core 1.0.