iOS Widgets for Home Assistant with Workflow

One of the key principles of home automation is being able to control things quickly and easily. I don’t want to have to unlock my phone, open an app, wait for it to load, and then finally find the device I want to control.

I like that SmartThings supports the Today screen widgets in iOS. They let me swipe dow on my locked phone and trigger a routine. For example, I have a button set up to run “Good Night” when I get to bed, which turns off lights, locks the door, and sets the thermostat.

I wanted the same in Home Assistant. It turns out that Workflow is perfect for this.

If you have the Workflow app installed, here’s an example workflow you can customize.

To make this, I created a new “Today Widget” workflow in the app. Basically we are going to create a call to the Home Assistant RESTful API, so to start you need to add a URL action. This should be in the form of https://your-home-assistant-site/api/services/domain/service. For example, if we want to toggle the bedroom lights of the Home Assistant demo site we would put in the URL https://home-assistant.io/demo/api/services/light/toggle

Next, add the “Get Contents of URL” action. Set the Method to POST, under headers add “x-ha-access” as the key and your Home Assistant password as the value. Set the Request Body to JSON and add any service parameters in the Request body. In our example we send a text value for “entity_id” as “group.bedroom”.

At this point you should be all ready to try it out! Here’s what it looks like:

IMG_2582.PNG

(note that is not my real passphrase)

Workflow is a great way to build easy-access buttons to run things in Home Assistant. Along with the Home Assistant native app, I think Workflow is a must-have for any iOS user.

My Home Automation Rules

In my last post about smart homes, I promised to outline what I have automated. A lot of home automation talk is about the gizmos and I don’t think enough is about the actual automation. These are actual automations; things a computer does to my house for me.

Our front porch light turns on at sunset. It turns off when we go to bed – I don’t want to contribute too much to light pollution by leaving it on all night. We manually hit a “Good Night” widget in iOS’s Notification Center to trigger this.

We also have interior lights come on at sunset if no one is home, as determined by the location of our phones, so that the dogs don’t get stuck alone in the dark. They don’t seem to mind the darkness but I feel bad enough to have created a rule to automate this.

We do not turn on the lights automatically when we are home. Sometimes it’s dark before sunset, sometimes it’s light after.  It’s less weird to manually turn on the lights. I might try to use some luminescence sensors to do this in the future.

The thermostat goes into energy saving mode when we are away from the house. High temperature in the summer, low in the winter. It uses less energy to return the house to normal temperature than it does to maintain normal temperature when no one is home. If you are going to do this, be sure to create a “Guest” mode for when you have a babysitter / houseguest.

The thermostat also changes to cooler temperatures when we go to sleep. It’s like having a programmable thermostat that is based around us instead of a clock.

I have an app that turns the furnace fan on for 10 minutes every hour, to even out the temperatures in the house. Our bedroom is closed off during the day so it’s extra warm in the summer and extra cool in the winter. It’s nice to come to bed and have the bedroom a normal temperature.

Our door from our house to our garage (as opposed to garage door) unlocks when we arrive home. This is awesome because we have an RFID key on our Honda, which means you can get in the house without ever having to take your keys out of your purse or pocket.

If the garage door is open when we go to bed, we get a push notification. It’s a handy reminder for when we accidentally leave it open.

If the smoke alarm goes off, all the smart lights in the house come on.

I’ve been purposefully vague about how I set all this up. Partly its because its in SmartThings and my goal is to move to Home Assistant. Partly its because you can do this stuff with most smart home systems.

I’m happy to answer questions in the comments if anyone wants to know how I did something. I’d also love to hear other automation rules that you love.

What’s the stupidest/weirdest project you used a RPi for?

This thread on reddit has some really fun ideas for a Raspberry Pi. Some of my favorites:

The NoIR module is a camera for the Raspberry Pi with no infrared filter, which means you can use IR LEDs to light up a room without anyone seeing.

Photo credit: Multicherry (CC) BY-SA

Smart Home Advice At The End of 2016

 

My friend, a recent dad, asked me for some advice on what smart home stuff he should get. I figured I’d share my response with everyone. This is just an overview of the stuff I recommend for him, a savvy dev-turned-leader. He’ll be reading this, so if you have suggestions or alternatives, leave them in the comments.

To start with, the whole smart home thing is still in the hobbyist phase. I define “hobby” as something you throw time and money at in order to fix problems you created for yourself. Smart homes are a great way to turn time and money into problems!

When things work, however, it’s great to have the house anticipate your routines.

Hub: SmartThings

It’s possible to roll things together without a hub but I like having a central place for everything. By centralizing all your smart home gizmos with a hub, they can talk to each other.  Metcalf’s Law means that the more you add to your hub, the better it gets.

SmartThings is The Wirecutter’s pick. SmartThings is also reasonably open and easy to get started with;  I like the SmartRules app for simple conditional programming. It works with most stuff, has a healthy ecosystem and can be hacked through their dev portal.

You can set up “routines” which are basically saying “turn this stuff on/off”. The routines can be tied to triggers like time of day, sunrise/sunset,or leaving/coming home.

There are a few drawbacks. The SmartThings-branded hardware is slightly cheaper but locks you into their ecosystem thanks to the looseness of the Zigbee protocol. If you stick to more open protocols like Z-Wave (I like stuff from Aeon Labs and Jasco/GE;  Monoprice has some cheaper stuff too), you’ll be fine if you decide to switch systems later on. SmartThings is also cloud-based, but their availability has been pretty solid lately.

It doesn’t support HomeKit natively. You’d need to install the Node.js app Homebridge on a computer in your house. HomeKit is what allows Siri to control things, and also give you a nice swipe-up control panel for lights in iOS 10.

While I use currently SmartThings, I’m really looking forward to moving to Home Assistant as my hub. It’s open source and supports a ton of platforms. Home Assistant is a whole other time suck and so you may not want to start off with it. The biggest thing that’s stopping me (aside from the time thing) is the iOS app. We use the Widgets in Notification Center to trigger routines, and the iOS app detects whether we’re home or not. When it’s solid I plan on migrating all my SmartThings stuff to Home Assistant.

Lights: Not Smart Bulbs

If at all possible, use Z-Wave in-wall switches and plug-in outlets (Wirecutter’s recommendations). One of my goals with home automation is that you should never have to use a phone to do anything. Guests will appreciate not needing an instruction manual to turn on the light.

In SmartThings you can set plugs and switches to turn on/turn off/dim together, so you can have multiple lights in a room all controlled by a single switch. Another nice thing about smart lighting is turn everything off from bed. The plug-in outlets are great at Christmas time too.

In-wall switches require a neutral wire. Open up your switches and look before you buy anything. My house has neutral wires for the overhead lights but not for the switches that control outlets, which makes things much more difficult.

Thermostat: Ecobee 3

I don’t have this thermostat (I have a super-dumb Z-Wave thermostat controlled by rules from SmartThings). The Wirecutter recommends the Nest. That said, the Ecobee has a big following and has impressed me by supporting occupancy sensors (that work with Home Assistant) to make sure that the temperature is right where people are. I’ve hacked some stuff together a poor facsimile with a Z-Wave temperature sensor, but this is a much more straight forward way to go.

I am a fan of smart thermostats in general. Being able to reduce energy usage when you’re out of the house is a no-brainer in terms of efficiency. Being able to turn up the heat from bed is pretty great too.

You will want to check if your thermostat has a C-wire – if not you’ll need to plug the thermostat into the wall. The reasons I went with my thermostat is partly because I don’t have a C-wire and partly because Z-Wave doesn’t rely on the cloud.

Cameras: I dunno, maybe a Foscam?

You’ll probably be happy with one of the Wirecutter’s choices.

Checking whether a kid is up without opening the door is fantastic. That’s all I really use my cameras for.

I have these Insteon-branded Foscams and the video quality is pretty bad but they were cheap and they work. They don’t require any cloud anything – they host their own webserver right on board. They work great at night and if the kids mess with them I can steer them back into position. Here’s a cheap HD Foscam.

Everything else:

Smart locks can be neat. There are some security concerns, but there are also security concerns with consumer-grade dumb locks and first floor windows so you’ll probably be fine if you get one. Never getting locked out of your house is pretty nice too.

Motion sensors can be handy too, for triggering scenes or turning on lights. I like my Amazon Echo but the Google Home looks like it’ll be really good in the near future.

Did you happen to notice my continuous digs at the cloud? I’m a big fan of keeping control of my home in my home and having the lights keep working even if the internet is out. I don’t want to have to dig my switches out of the wall when a cloud company goes out of business. Personal preference.

That’s it for the stuff. Next up will be actual automation rules that to tie the stuff together.

How to put Amazon Echo shopping list items in Wunderlist

First off, if you use iOS and don’t have an Echo, use Kitchen Sync for your shopping list. It organizes everything by shopping aisle and works with iCloud so it’s super easy to share a list with your family. Plus Adam is a good guy.

We use Wunderlist for our shopping list, so I set up an IFTTT recipe to put our Echo’s shopping list into Wunderlist.

Here’s how you can too:

  1. Go to Mail to Wunderlist Settings and set your Gmail address to go to your shopping list.
  2. Add this recipe (be sure to put me@wunderlist.com as the email address):IFTTT Recipe: Add Alexa shopping list items to Wunderlist connects amazon-alexa to gmail

Some caveats: IFTTT checks the shopping list roughly every 15 minutes, so if something is time sensitive you’re better off using the Wunderlist app. It also doesn’t update the Alexa shopping list when you check it off in Wunderlist, but who looks at the Alexa shopping list anyway?

My Life With SmartThings (so far)

I’ve been using SmartThings for home automation for about 6 months now and figured it’s worth getting some of my thoughts down.

I’ll start in this post with what I’ve got set up:

5 GE Link LED bulbs in my family room. I actually needed to get an updated firmware for these to work, so I put in a support ticket on a Saturday after noon and got a response saying the firmware was updated in less than 10 minutes. I was impressed enough with their support to remember all that.

When I started going down the home automation path I was thinking about what I had done with X-10 many years ago and expected outlet switches to be the way to go. It turns out that a $15 LED bulb is cheaper than a $40 outlet switch.

I originally had them set to come on at sunset, but that became kind of annoying because it was still light out, so now we just turn them on with the app. Still easier than turning on 5 lights individually, and I can turn them off from my bed.

My bedroom lamps on some Z-Wave outlet switches. It’s been extremely nice to come upstairs to a lit room; the placement of outlets and switches in our bedroom made it annoying to turn on lights when we got into the bedroom. But I also have to open the app to turn off the lights, which can be annoying. (I’m hoping the iOS 8 widget will smooth this process)

A water sensor in my basement. I’m paranoid about water down there and this gives me peace of mind. I also moved it to my bathroom after doing some plumbing so that I knew I wouldn’t walk into a flood zone some morning.

A smoke/carbon monoxide sensor, also for peace of mind and if my family is out and there were an emergency I could get the fire department over ASAP (assuming that the internet didn’t go out first).

A window sensor in my daughter’s room so that my wife and I can figure out if we left it open without having to wake her.

2 super cheap IP cameras – again, great for checking on a toddler without waking her. The second one is deployed to watch the front door, mostly so I can see what the dogs are barking at while I’m in the basement. When baby #2 comes in October that one will get moved to childcare duties as well

Finally, SmartThings can host applications, so I’ve installed SmartTiles (née ActiON Desktop) as a simple way for house guests like my mother-in-law to turn stuff off and on:

The thing I like about this hobby (and it’s totally a hobby) is that it can be iterative and cumulative. When I want to play around with it, I can start adding new things and integrating them. Then, when I don’t have the energy to mess around with it, I can let it coast in its current configuration for a while until I’m game to playing with it again.

What I want to focus on next is providing more physical access (switches and buttons) so that I don’t have to use the app (and so that house guests don’t need a web interface).