Getting Alexa To Pronounce Ordinals

Today, I’m working on a project that requires Alexa to say things like “first,” “second,” or “twenty-first.”  I’ve gone through a few iterations of creating these ordinal strings.

First: Brute Force Attempt

I started the easy way: I created a hard-coded switch statement for the values from 1 – 10, and used a helper function to feed me the appropriate return value as a string..  Not the most elegant, but it got the job done.

Second: Slightly More Elegant and Scaleable

As my application grew, I realized that I would now need the values from 1 – 50 available in my application.  I added to my switch statement…until I got to 15.  At that point, I realized I needed a new solution that could scale to any number I passed in.  So I started writing some logic to append “st” to numbers that ended in 1, “nd” to numbers that ended in 2, “rd” to numbers that ended in 3, and “th” to pretty much everything else.  I had to write some exception cases for 11, 12, and 13.

It was at this point that I made an amazing discovery.

Third: Alexa is already too smart for me.

While playing with my second solution, I used the Voice Simulator that is available when you are building an Alexa skill.  I wanted to see if Alexa would pronounce the words the same if I just appended the suffixes like “th” or “nd” to the actual number value, rather than trying to convert the whole thing to a word.

This is where the discovery was made.

I tried getting her to say “4th,” and she pronounced it as I expected: “fourth.”

On a whim, I added “th” to the number 2, which would normally be incorrect.  She pronounced it “second.”  I had the same experience with “1th,” which she still got correct as “first.”

If you append “th” to the end of any number, Alexa will pronounce the appropriate ordinal.

My mind was slightly blown today.  Thanks, Alexa.

The Art of the Coding Tutorial

As part of my new responsibilities at Amazon, I’m working to re-write the Alexa development tutorials for a couple of reasons:

  1. We want them to be as easy to follow as possible for developers of all skill levels.
  2. The Amazon Developer Portal and AWS will forever be making changes to their interfaces, and we want to be able to easily keep up with updating our screenshots.
  3. We want to be able to re-use as much of each tutorial as possible, again to minimize the maintenance costs that come with updates.

Before anything else, however, we want tutorials that help developers get from Point A (no Alexa skill) to Point B (published Alexa skill) with as few barriers as possible.

So I ask these questions of you, my wonderful readers:

  1. What are some examples of tutorials that you have found effective?
  2. Which is the best format for you to follow a tutorial?
    1. One long web page that covers every step.
    2. One web page that covers the essential steps, but has links to the “fringe-y” stuff that only some developers will require.
    3. Multi-page tutorial that breaks the process into 5-6 digestible chunks.
    4. A video.
  3. Is it more important to get to Point B, or understand *how* you got there?

Holy Cow Garageio!

I’ve decided to start a series of posts about the ever-growing list of smart home devices I’ve decided to bring into my home.  These won’t be on a regular schedule, but as I continue to add functionality to my house, I’ll do my best to provide my opinions and experience with those products.

Today, I want to talk about Garageio.

garageio

You can probably guess from the name, but Garageio is a device that you connect to your garage doors to open/close them, as well as monitor their state.  In addition, you can connect Garageio to Alexa, and make all of that functionality happen with your voice.

Yes, there are certainly cheaper options.  Yes, you could probably build one yourself.  But to get all of this functionality in a package that works reliably, had IFTTT integrations, a great mobile experience, AND works with Alexa?  That’s a tougher deal to beat.

In fact, I tried.  I bought a WeMo Maker device ($70) and hooked that up to my garage door.  It worked, but it didn’t manage state.  So I added a webcam to my garage so that I could see whether the door was open.  It also only allowed me to send an “event” to my door, which meant that it would close if it was open, and open if it was closed.  Not a great experience.

Installation

Installation was surprisingly easy.  The entire contents of the box boiled down to five parts. (I have the two-door model, but the different models really just determine how many wires you get.  It appears it’s always the same box.)

  • The Garageio Black Box
  • Wire for connecting box to garage door opener #1.
  • Wire for connecting box to garage door opener #2.
  • Sensor for garage door #1.
  • Sensor for garage door #2.

Basically, you connect all four wires to the box, connect the box to your wifi, and you’re off and running.  Incredibly easy.

garageioproductphotos-6

Using the Garageio App

For most smart home devices, the app that drives everything is a make-or-break experience.  Thankfully, the Garageio team knocked this one out of the park.  I have a horizontal scrolling list of my doors, and swiping up on a door opens it, swiping down closes it.

20161107_151428000_ios

I also get notifications if a door stays open for 15 minutes.  This is a nice feature, but as a parent of two active kids, the door is constantly open in the afternoons after school.  My daughter gets home at 3pm, and so nearly every day at 3:15pm, I get a notification that the door is still open.  You only get one notification, however, so it’s not annoying.

You can see from my screenshot that there’s also the ability to “Share Doors.”  This allows me to grant temporary (or permanent) access to my garage door to others.

20161107_152049000_ios

IFTTT Integration

As expected, they also did an excellent job with their IFTTT integrations, so that all of the functionality I want can be triggered by all of the other services I use.  For example, I can set a geofence on my phone, so that if I enter a specific area, my garage door automatically opens.

I can also set specific times for it, so that at 10:30pm, it automatically shuts both of my doors so that I don’t leave them open all night.

If you’ve used IFTTT, you know this is only scratching the surface of what is possible, but there’s only so many creative ways to open and close a door.  So far, I’ve been delighted, however.

Alexa Integration

“Alexa, ask Garageio to close Bike Door.”

It works exactly as you would expect.

Garageio was an early entrant in to the world of Alexa, which is awesome.   I think that they will eventually hook it up to the new smart home skill API, which helps in simplifying how I communicate with it, but even now, it’s perfect. It recognizes the names I gave my doors, and works every time.  I’m really happy to have this device in my house, and I would highly recommend it for yours.

You can pick one up on Amazon for about $200.

My Frustrations with “Smart Home”

That’s not a fair title.  I LOVE the smart home movement.  I love being able to open/close my garage remotely.  I love having rooms light up as I walk into them.  I love concocting recipes on IFTTT to mash-up my smart devices into even smarter experiences.  I love telling Alexa to control my home with only my voice.

“If it is 10:30pm, and the garage door is open, close it.”

What I don’t love, however, is that much of the experience and joy that is meant to be created by smart devices seems to have been created exclusively for one person that lives by themselves.  Let me give you a few examples:

Smart Bulbs

Smart lightbulbs can be controlled by my phone.  They can change colors, be turned on and off, and even dance to my music.  Amazing, right?  Where this story falls apart quickly, however, is the traditional light switch.

If I turn the bulb off from my phone, the light switch becomes non-functional.

If I turn the bulb off with the switch, I lose all of the “smart” features.

If I am a single person living by myself, I can consciously make a decision to only control the bulbs from my phone, and everything is harmonious.  Once you introduce roommates, like a spouse, or even worse, children, this entire experiment falls apart.  The consistency that you require evaporates instantly.

Smart Plugs

 

 

This is another example of power management that has so much potential.  Plug this into the wall, and now you can control a lamp, a stereo, or really anything else that requires power.  You can even set timers, so it’s an incredible way to manage those random lamps you have around your home!

That is, until someone turns that lamp off in the traditional way.

catlight

Now your smart plug is a $40 brick that can control nothing.  It’s incredibly frustrating, and most of the frustration comes from the fact that our homes are not constructed with the idea of a smart home in mind.

Geofencing

geofencing

Geofencing might be one of the coolest ideas around when it comes to smart home functionality.

“When I pull into my driveway, open the garage, turn on the lights, set the thermostat to 71F, and turn on my favorite music.”

“When I am gone for more than 18 hours, set the entire house to away.  Light bulbs on timers, thermostat as low energy as possible, all doors closed and locked.”

If I lived by myself, This. Would. Be. Awesome.  Instead, it becomes an incredible way to scare my entire family to death as I dramatically announce my home arrival.  There HAS to be a better way.

Summary

In short, I love smart home stuff.  But as a software developer, my brain wants more.  Today, in our homes, we basically get the equivalent of a solitary IF statement.

IF I pull in the driveway, THEN do this stuff.

In order for this smart home stuff to be truly impressive (and accessible) to everyone, we need to be able to add as many conditions as we possibly can.

IF I pull in the driveway AND my family is home, THEN open the garage.
ELSEIF my family isn’t home, THEN open the garage AND turn the house up to eleven.

Smart home is still really in its infancy for consumers.  If we want to make it more accessible, we need to be able to provide this level of customization in an easy to use format.  IFTTT and Stringify have made huge strides here, but we still have a long way to go.

I, for one, look forward to the very near future.  This stuff is amazing, even if it’s also frustrating sometimes.

Echo and Alexa

If you’ve talked to me in the past year, or visited my home, I’m certain I’ve mentioned the Amazon Echo.  I’ve been playing with it a ton lately, so I thought I’d write some of my thoughts for all of you to read.

feature-hero

Amazon Echo is am amazing little device that sits on your kitchen counter or desk.

You talk to it.

amazonecho

Alexa is the voice that speaks to you and listens to your commands.  It does all the basic stuff incredibly well:

  • “Alexa, what’s the weather like today?”
  • “Alexa, what time is it?”
  • “Alexa, how many cups are in a gallon?”
  • “Alexa, what’s the current price of AMZN stock?”
  • “Alexa, order me some AA batteries.”
  • “Alexa, play some classic rock.”
  • “Alexa, set a timer for 9 minutes.”

What you may not know, however, is that you can also add additional skills to Alexa.  There’s a growing collection of skills being created by developers, much like app stores of the mobile phone world. There any many cool skills you can add, but the home automation ones have had the biggest impact in my household:

  • “Alexa, how much gas do I have in my tank?”  (via Automatic)
  • “Alexa, trigger the garage.”  (opens or closes my garage, via WeMo Maker)
  • “Alexa, trigger the office lights.” (flips the lights in my office, via WeMo Switch.)
  • “Alexa, order a pizza from Domino’s” (places my standard order with Domino’s.)
  • “Alexa, ask FitBit how I’m doing today.” (tells me my step count via FitBit.)
  • “Alexa, ask Capital One how much money I have.” (via Capital One)

I’ve even built my own simple skill, a game of Would You Rather.  It poses a situation for you, and it’s up to you and your friends to answer it.  Like I said, pretty simple, but a good way to include Alexa in your next game night.

I’m going to write another post next week with a simple tutorial on how to build an Alexa skill.  It’s surprisingly easy.

Making Changes

About a year ago, I took a chance on my career.  I left the stable, secure world of Microsoft to join and help found a startup.  I don’t regret this decision at all.  But I failed.

I failed because I didn’t make my expectations known.

I failed because I didn’t figure out what was expected of me.

I failed because I was scared to stand up for myself.

I failed because I didn’t communicate effectively.

I’ve always prided myself on being an excellent communicator, but it showed me that I’d made a mistake.  I took the job for the money, for the prestige, and for the wrong reasons.  I chased promises rather than reality.  From Day #1 I was counting the days to our acquisition.  This is absolutely the wrong approach, and I wouldn’t know this if I hadn’t taken that chance.

So I’ve decided to start making some changes in my life.

First, I am going to exercise every single day.  Between work and travel, I wasn’t taking any time for myself, and my energy levels reflect that.  I need to be healthier at 40 than I was at 30.

Second, I need to find “the right job.”  I’ve had a few of these in my career, where I can’t wait to get started every morning, and don’t want it to end every night.  I’ve started a pretty extensive job search, but it’s a slow, slow process.

Third, I need to get back to focusing on my family.  The weekly travel to startupland didn’t do any lasting damage to my relationship with my family, but I owe it to them to give them everything I have.  None of this other stuff matters if I can’t spend my time with my wife and children.

Finally, I need to find a hobby.  I’ve been scattered across a number of “interests,” but I’ve never really landed on one that really consumes my time.  I love golf, but it’s time consuming and expensive.  I like playing with Lego Robotics, but mostly with my kids.  I love writing, but I never seem to find the time to do it (as evidenced by the infrequency of my posts.)  The one I keep coming back to, however, is writing.  I’ve been sitting on the first 20 pages of a sci-fi novel for a couple of years now, and I think it’s time to dust it off and bring it to life.  Keep an eye out for something from me later this year, I hope.

I don’t like failing.  I don’t like accepting that a decision I made was a bad one.  But it was, and I did.  Here’s to making the next decision a good one, and making several aspects of my life better than they’ve ever been.

Leaving the Nest

For the first 9 years of my career, I was a software developer.  It hadn’t even occurred to me to be anything else.  Then, one day, I met a guy named Drew Robbins, who said he was an evangelist for Microsoft.  He introduced me to Josh Holmes, one of the best speakers I have ever met.  The way they described it, they spent most of their time learning the bleeding edge of software, and the rest of their time teaching people how to use it.  On that day, I asked Drew when he’d be looking for a different job, because that was exactly the kind of thing I wanted to do.  He eventually did, and I was fortunate enough to get the opportunity to replace him in the summer of 2007, thanks to a very unexpected decision by Sam Henry.

I can honestly say that I will never be as excited to start another job as I was to start this one.

For six amazing years, I got to spend my time traveling through what Microsoft calls the “Heartland District”, and I got to know these states well.  I’m not sure why I decided to do it, but I have kept every single plastic hotel key I’ve ever had since I started this job.  There’s 163 of them in this photo.

hotelkeys

I met people from every type of company, writing every type of software, with every type of concern about Microsoft and every one of our development technologies.  And I loved it.  I helped start conferences (like Stir Trek), and encouraged others to do the same.  I spoke anywhere someone would listen.  I did all of it because I loved it, and Microsoft empowered me to share my passion.

I had the pleasure of working closely with Jennifer Marsman and Brian Prince for years.  I made lifelong friends in Clark Sell, Sarah Dutkiewicz, Mike Eaton, Matt Davis, Andrew Maxey, Rick Kierner, Matt Casto, Brian Jackett, Ryan & Travis Lowdermilk, and literally dozens of others.  Practically my entire social circle is a result of my work as an evangelist.  I am so thankful to have met all of these people, and all of you reading this.

My passion for software and evangelism led me to write over 500 articles, a book, and dozens of apps. That passion took me to a new role two years ago at Microsoft.  I got to share my passion with four high-profile software companies in the healthcare industry.  We talked about Windows and Azure at length, and I got to help them make some significant architectural decisions about their products.  It was still evangelism, but for a highly focused set of individuals.

It is that same passion that has me writing this today.  I have decided to leave Microsoft after 8 years of amazing.  8 years of learning.  8 years of loving what I do, with the freedom to do it.

I will miss every single thing about evangelism here at Microsoft.  Sincerely.  The people are amazing.  The mission is worth fighting for.  I can only hope that my path will cross with yours again time after time.  Thank you all for teaching me so much.

Jeff Blankenburg

On May 18th, I’m starting a new adventure.  I’m joining a startup as their Director of Product Management.  We’re going to try to change how the world thinks about software and healthcare together.  As we get close to a release, I’ll have plenty more to share about this endeavor.