I have this motion sensor switch in my office: when I walk in,
the lights turn on. And after I leave, they turn out after a few minutes.
But here's the problem: if I'm in the office, but not moving around, the lights just turn off.
I feel kinda dumb waving my arms around to turn on the lights all day long.
And what about times I wanna keep the lights on even when I'm not in my office?
Now, a sane person would see this problem and pop in one of these—a one dollar light switch.
You switch it on, the lights stay on.
You switch it off, they stay off.
But I'm not gonna do that. Instead, I'm gonna install
this smart switch. And then I'm gonna install a separate motion sensor,
and program my lights to do exactly what I want, with a Raspberry Pi running Home Assistant.
What's Home Assistant? And how can a Raspberry Pi turn on my office lights?
Well, I'll get to that. The kind folks at Nabu Casa sent me this,
their new Home Assistant Yellow. It's a Raspberry Pi-powered smart home hub with built in Zigbee,
and a bunch of other features that make it easy to manage your smart devices.
And the best thing? All of it is under my control. And I can make sure that my so-called
"smart" devices don't get too smart, and open up security holes to my house through the Internet!
But first let's talk about the Yellow.
The Yellow was originally called 'Amber',
and it was crowdfunded in October last year and starts shipping soon. It's sold by Nabu Casa,
the open source company that manages the Home Assisant and ESPHome projects.
Home Assistant is the most popular home automation software that lets you manage
all kinds of smart devices, and integrates with everything from smart outlets and
lightbulbs to garage door openers, solar panels, and even weather vanes!
But the best thing about it? It gives you control of your own home.
A lotta vendors require you to install a device that connects to their Cloud over the Internet.
I don't know about you, but I don't like relying on random Internet of
Things companies to manage the security and safety of my house.
I'd rather not wake up as a popsicle this winter because my thermostat got hacked!
But Home Assistant manages everything locally, inside your house. I'm not gonna lie and say
it's easier to set up than any other home automation system, but it is pretty easy.
The Yellow comes in this frosted case, though the one I have here is an early review sample,
so it doesn't have a nice finish like the production units'll have.
Taking the board out, you can see how it's built:
the model I have includes built in Power over Ethernet, so I could either plug it into the
wall with an AC adapter or power it through my PoE switch. Under this large heatsink,
there's a Raspberry Pi Compute Module 4, the brains of the smart hub.
One really cool feature of this hub is you can actually
upgrade the Raspberry Pi inside and get more RAM or add on WiFi and Bluetooth,
but you'll need to transfer your Home Assistant install to the new Pi if you do that.
The board has a built-in real time clock and battery, and over here
is a little built-in Zigbee radio, which lets you connect to all your smart devices
wirelessly. And you could add on a Z-Wave radio like the Z-Pi 7 using these pins.
For the purposes of this video, Zigbee and Z-Wave are basically the same thing,
just two separate wireless standards used for smart devices.
But the important thing to remember is Zigbee and Z-Wave devices aren't interchangable.
It's best to stick to one or the other, if you can. I'll be using Zigbee in my house.
Over on the side, there are three LEDs, a red power LED, a green activity LED, and a yellow LED
that lights up with different patterns to indicate the status of the Home Assistant hub itself.
The last major feature on this board is this M.2 expansion slot.
You can pop an NVMe SSD in it for more and faster storage, and you could even configure
the Yellow to boot from the NVMe drive if you use a Lite version of the Raspberry Pi.
All right, so the first step on my automation journey is replacing this light switch.
I'm gonna put in this Leviton single pole Zigbee switch.
And because I'm gonna turn out the lights in my office,
I need a worklight so I can see what I'm doing.
It should be obvious, but even if you're a bit insane like Red Shirt Jeff, make sure you
switch off the branch circuit that powers your lights before you go replacing a light switch.
And to be extra safe, verify the power's off at the switch with a little power tester.
Something I did years ago when I moved into my house was label
every outlet and light switch cover with the circuit breaker number so I don't have
to sit in my basement turning off half my house just to figure out the right breaker.
This switch requires a neutral wire connection—basic light switches only
switch the hot leg, so if you have an older wiring setup where the neutral wire isn't in your switch
box, you might have to change out the wires to your lights if you wanna use a smart switch.
Luckily that's not the case here... and there we go.
Now I just have to switch power back on at the panel,
then I should be able to use this switch as a dumb switch right away.
Good. Now that that's working, I'll set up this motion sensor.
The great thing about having a separate motion sensor is,
I can put it wherever it makes the most sense, which for me is in the middle of the office,
since that should pick up movement when I'm at my desk, behind the monitor.
All right, that's done. So far these things are all just 'dumb' devices,
we need to integrate them into Home Assistant so I can add some automation and intelligence.
Otherwise I'd feel pretty silly wasting a hundred bucks making a fancy one-dollar light switch!
I already plugged in Yellow, waited for it to boot, went to homeassistant.local,
and ran through the setup wizard. I created an account and set up my location,
and at the end of the setup process Yellow found a bunch of devices it could manage.
But for now, I'm gonna ignore all those devices,
and focus on setting up the smart switch and motion sensor.
TODO: Live stuff goes here
All right, so, I’m going to open up my browser and here is Home Assistant’s UI. Now, I have not
used home assistant before, so this is all kind of new to me,
and it looks like integrations, or devices…let’s see, devices? There’s no way to add one here.
So I’m not going to do that, I’ll go to integrations, and this looks more like it.
So here’s the things it detected, but it’s not seeing the thing. So I’m going to look for—what
is the company—I’m going to look for Leviton first and see if there’s anything for that.
No. I guess I might need to add Zigbee or something first, because
I notice there’s nothing for Zigbee anywhere in here that I could find.
So I’ll try that. Zigbee…nothing. I’m going to click this and see what happens,
let’s see. Zigbee—ah, there it is! Zigbee. I’ll try one. Area…uh,
this hub I guess will be in the basement, so I’ll add a new area and call it basement.
All right, so I have Zigbee, it’s called ttyAMA1. Maybe I can rename this?
I don’t know what this is all doing but let’s see…devices! Zigbee coordinator, add device? Let’s
see if we can do this. Oh! Devices need to be in pairing mode. So it’s actually been a few minutes,
if you don’t know about video editing the magic here is that I will have cut out a
lot of parts between when I was moving cameras and things. So I need to put these devices in
pairing mode so they will show up here. I’m going to do that right now. [snaps fingers]
I just pressed the button on the light switch—you hold down the top of the paddle for seven seconds
and then click it once—and it started flashing amber, and now it’s flashing green. I don’t know
what “starting interview” means, but I hope that’s a good thing. Here we go! Device is ready to use!
Device name, I’ll call it “Office Light Switch”, and the area
is in my office, I’m going to call it “Office”.
I guess that’s it, there’s no save button or anything. I’m hoping that means it’s saved.
The other thing is this motion sensor, I just grabbed it off the ceiling over there.
It says in its manual there’s a magic recessed connect button somewhere?
This device is too smart for me. It says “open” here so let’s see if that does something.
Oh…there’s a teeny tiny hole in here. You can’t actually stick something in there,
so let me go grab a tool to press that. I’m going to press the button.
So this is blinking, I don’t know if you can see that.
It says “connected”! Okay, configuring, this is good.
While it’s configuring I’m gonna go hang this back up on the ceiling.
I don’t know which way is up but I don’t think it matters too much on here.
All right. Samjin motion. I’m going to call this “Office Motion Detector”, put it into my “Office”,
and…I hope that’s done. It looks like those things are set up.
Now, the next step I need to do is set it up so that the motion detector is connected
to the light switch. I’m going to try to figure that out, bear with me! I’m going to
configure…automations, maybe? I think it might be automations.
Let’s see. I think I might need this.
“Turn on lights when I enter office.” No. I’m gonna skip that and just try to do this.
“Office Lights - Motion Detect”, something like that. Don’t know
what that is but maybe later I’ll figure that out. Triggers! Trigger ID,
oh boy. So here’s where things start getting a little bit more complicated. I don’t know what
a Trigger ID is, but hopefully the device will help me with this maybe? Let’s see.
“Office Motion Detector”. Okay, Trigger…”started detecting motion” I think is what I want here.
I don’t know why it’s giving me a duration, maybe it’s like how long it detects motion. Trigger ID…I
don’t know what that means. I’m just gonna call it motion_detect. If it’s an ID I don’t
want to put in a space or anything because as a programmer I know that can throw things off.
But I don’t know! So far things have worked pretty well in here, I haven’t broken anything.
I don’t need a condition. Actually I should add a condition. That the light Device, Office
Light Switch, is…off. So if the switch is off, and motion is detected, the light switch—turn
ON light switch. I think that’s what I need to do. I’ll click “Save” here,
I don’t know if that saved or not. I hope it did!
I guess I’ll go back here. So this is there.
I’m gonna go ahead and turn off my office lights and then walk into my
office and see if they turn on. We’ll see what happens. Who knows if this is going to work!
All right, I’m moving around and I’m well within range of this motion sensor
and it’s not doing anything, so I’m not too sure if I did something wrong
or what’s going on. I’m going to hit “Run Actions” and see what it does.
That turned on the light?! [laughs]
Let’s see. History…ooh, this doesn’t look right, whatever this is, this looks kinda broken here.
I’m going to take a quick pause and figure out what’s going on,
and then I’ll tell you what’s going on once I’ve figured it out.
Wait a second! I just moved and the light turned on.
[sighs] So…aybe it’s just a matter of not waiting long enough? Another thing that’s
interesting is with my old switch, you could turn off the lights and about five seconds
later it would start detecting you. So maybe it’s just a time out condition.
So it’s working. That’s a good thing! Why it’s working, I’m not 100% sure yet.
I’m going to create a new one. Add automation…motion—oh. Look at this, there’s
a blueprint for this! Of course, after I spend ten minutes working on my own custom automation.
I’ll call this “Office Lights - Turn off when office unoccupied”, something like that.
So “Motion-activated light”, motion sensor, that one, I don’t know why it doesn’t use
the name that I put in for it, I didn’t call it samjin_motion. Light: pick area…I’ll just do
“Office” for the area. “Wait time to leave on”, oh, so this is interesting!
This blueprint is actually really useful, it
does the extra step for me of—it’ll turn on the light and leave it on for a set amount of time.
So I could set this to—[laughs] love how it’s just in seconds, as if everybody knows that
86,400 seconds is a day, so 20*60 would be 1,200. We’ll do 1,200 seconds,
and I’ll say “Office Lights - Motion Detect. Yeah. Save that. Okay.
I saved it, that’s an interesting thing, it doesn’t show me that it saved it. I’m
just assuming that it saved because that “Save” button went away. It’s an interesting convention.
I’m gonna delete this one, how do I delete…edit?
No. How do I delete an automaton? “Delete Automation”, there we go. Take that one out.
Okay, so we have “Motion Detect”, and actually for now I’m going to change this,
just so I can see if it’s working. I’m going to change it to…let’s do 30 seconds. Now I’m going to
leave the office, and we’ll see if the lights turn off.
I’m going to cut the video here, because you don’t need to wait 60 seconds for me!
Ah! Great! Seems to have worked perfectly, and this time it just motion-detected right away, so
I’m happy with that. It looks like this action is working really well. And if I
click in here I should probably also be able to see—yeah, “Edit in YAML”.
So this is the actual stuff that’s happening, and it looks like it’s using a blueprint called
motion_light. It’d be interesting to see what it is, I don’t know how to get to that right now—oh,
“Blueprints” maybe? “Motion-Activated Light”, is there a way to see what it says?
No? Oh, maybe it’s here.
All right, so here’s the “Motion-Activated Light”, this is the blueprint for it.
What I think is cool about this that you don’t get with a lot of other systems
is you CAN see all of the magic behind the scenes, and edit it that way, and as a programmer myself I
kind of like this. But I think it’s nice that on the surface it’s kind of covered up for you. So
I think it’s kind of weird, I mean like chat bots and things like that—when I go here and I
see this, again as a programmer, I’m like “URGH” because I know how hard these are to get right,
and so 90% of what people will type in is not what you expect.
Apparently I haven’t been moving enough.
There we go. I gotta switch that back from 60 seconds to something more.
But these are just so hard to do. I think what they should do—y’know, and what I could help them
do at some point too, if I wanted to contribute back to this—is maybe put “use a blueprint” first,
because probably a lot of people that are just setting up this first time are probably gonna do
a motion activated light, because that’s, I don’t know, like Home Automation 101?
I don’t know, this kind of feature just doesn’t—unless it’s almost perfect,
it doesn’t feel like something you’d want to give to a new, first-time user, because when you do
this it’s a little weird, and it says “We couldn’t create an automation for that”, so then you get in
here and you’re like okay, "skip”, or “create”, you know, there’s just a lot of steps here.
Anyways, so it looks like that works. I’m going to switch this automation,
and set it to do for 20 minutes—1,200 seconds, save. All right. So that’s set to 20 minutes now.
I think the overall thing that I found is Home Assistant’s UI does have a learning curve.
It’s not too crazy, there’s a lot of software that I’ve used that are a lot worse than this, but it
isn’t something that’s quite as simple as some of the Home Kit things I’ve used on my iPhone, where
you just kind of open an app and tap on something and it works. There are a few more steps here.
But, the power and the flexibility that gives me is huge. Like the fact that I can
go in and change every single detail, I could put this to minutes or hours,
probably even days, to leave the lights on after motion’s detected, that’s huge for me.
Right after recording that bit, I realized that I can just on this dashboard turn on
and off my office light like this, and I don’t know why but that’s just really fun.
I also just added this little button, which lets me turn off the office lights and disable
motion detection from my desk, so I can start getting more creative with video lighting.
Also, I forgot to show how I moved Home Assistant's datadisk to the NVMe drive.
The process takes a few minutes, but it worked fine. So far there isn't a way to migrate back
to the Pi's built-in storage, so if you choose to use an NVMe drive but change your mind,
right now the only way to do that is to back up and reset Yellow, then restore from your backup.
The yellow costs $115 without a Pi, and that version should be available by the end of May.
A full kit including a Pi will cost $175 and optimistically could start shipping in November.
But in terms of Pi Compute Module 4 availability,
right now at least, Seeed Studios has some in stock, and if you want one for Yellow,
you might want to get one now. They've been hard to get, but at least it's not impossible!
Now, is Yellow the only way to run Home Assistant? No, not at all! It can run on most any modern
computer, or even other specialized hardware, like this DIN-rail Pi from the MegaD-2561
team in Russia—which I'll test soon! I'll also be integrating a lot more into Home Assistant.
Subscribe so you don't miss any of it, and until next time, I'm Jeff Geerling.