Teaching an Old House New Tricks
Presented by: Tom Lianza, Larry Archer
Originally aired on July 13, 2020 @ 3:00 PM - 3:30 PM EDT
Two Cloudflare engineers discuss smart home gadgets and home automation -- from lights that turn themselves on when you walk into a room, to a garage door that tells if you if it's left open too long (and can even close itself), and more. Bonus: how to use Cloudflare Access and ArgoTunnel to protect your home's web-based control panel.
English
Cloudflare Access
Argo
Transcript (Beta)
Hi, I'm Tom Lianza and I'm here with Larry Archer and we are going to talk about home automation and I'll start with just my background.
I'm an engineering director at Cloudflare.
This has been something that's interested me for quite some time, but I've never gone quite as deep down the rabbit hole as Larry has.
So it's mostly me learning from him and us all learning from him.
And also I can fill in around the edges with what mere mortals might do with home automation.
Hi, I'm Larry Archer.
I'm an engineering manager at Cloudflare. I've been an engineer gosh, probably my whole life.
So that's part of the reason I'm into this kind of thing, I think.
So, yeah, this will be fun. Where should we start?
Maybe I guess we should talk about what what we mean by home automation or smart home stuff.
I kind of think of it as anything that can make your home a little easier to use or these days, it's like anything that you can connect to the Internet, connect to the Wi Fi in the house, but Yeah, I think we both got started at this kind of stuff way before the term Internet of things came about.
Yeah, my interest has definitely been about using computers to help help me with my life more in the physical world, not just while I'm sitting on a computer.
Now, when I started tinkering I even with with computers.
Generally, I was pretty all in, you know, build your own computer.
I remember building a myth TV set up back in the day. I don't know the state of that project.
Everything I did was Gen Two because I felt the need to build everything.
And then over time, it's just like the the products I wound up with the things I ended up building that and pieces of hardware and software I use just They needed a lot of care and feeding and it was on me to care for them and feed them.
And I just started to sort of pull out and now a lot of my what I do what I think you're with this is more off the shelf.
And then a little bit more limited. Yeah.
Yeah, I remember I'd forgotten about myth TV, but I had a box like that too and Getting your own tuner card working man.
That's a whole other Right, but Then they once HDTV came out, it was a little different and everything else online.
Now it's so much easier.
But, um, yeah, I think my Thinking X 10 was probably the first time I like purchased hardware to do anything with home automation.
So you could like It was basically remote controls, which was pretty cool.
At the time, you just press a button and your living room lights.
Come on, or you walk around with something on your key chain and And turn the lights on and off going even farther back.
I remember as a kid, my dad had timers those little timers you plug in turn the lights on to make it look like you're home or something, but Yeah, when I first got the extent thing.
I came with a little serial port dongle. That you just plug in and would send the same radio signals that the that the little remote had but And it was kind of neat that somebody had written a Linux command line tool for it.
So you could I think it was called bottle rocket or maybe that was the name of the dongle, but it was just a command line tool, you could send it the same signals and And from there you could you could script things like set up a cron job to turn on your lights and stuff or to control it remotely over a web page or something like that, but Yeah, I never had a great deal of satisfaction with my X 10 experience.
contributed to turning me off of At least do it myself. Yeah, I had. Yeah, I probably Spent longer than maybe was wise with that type of hardware, even like when as far as installing switches and replacing switches in the walls with at one place that lived and I remember taking it apart.
One day after taking the switch apart after it stopped working.
One day I was like, oh, that's That explains a lot. Just the quality of the components in there.
Maybe it wasn't. Maybe an off brand switch even but And then after a while I got back into it and it's like, what's, what else is out there.
What's the Standards and actual More commercial grade or Or industrial strength hardware out there and Somehow I settled on Z wave switches and lights and things and installed a few switches like that and I guess to To be able to control the wave stuff you need a controller.
So I had a hardware, a little box that plugged in connected to an ethernet port and then you give you this web interface.
That you could You know, again, schedule things set up little basic rules like if this happens, then do this other thing.
And that was kind of neat for a while, but the web interface was a little, little clunky.
At that point, were you using the Internet for stuff or is it all local It was mostly local like I've never Been a huge fan of Connecting something up to the Wi Fi and then letting it connect to the cloud and then trusting some other company to or some external entity to Have control over that even if Like, oh, you need to log into it to get to this or or they say it's locked down or something, but I don't know.
Maybe I'm paranoid. Maybe in a good way. So yeah, the stuff I've had It's been local like you plug this in, you get to it from your Wi Fi.
They tell you how to expose it to the Internet or something.
And I was like, yeah, I'll just do it locally.
That's fine. Or maybe set up a VPN to my home network or something, but There are better ways than that now.
So that's after that one. This was a thing called Vera I went looking like what other software is out there and I found this thing called Home Assistant, which is a open source project.
It's written in Python and it's Actually, I should have checked.
I don't know how long it's been around, but it's been around a while.
It's got lots of contributors. I think there's even a commercial product or two based around it, but it's Very broad it You can connect Z wave stuff to you can connect X 10 stuff to it.
You can Connect other more Easier to use consumer facing things like the Wi Fi light bulbs like Phillips here.
Now you're speaking my language.
So If Google Home lists it as compatible that it's on my dropping list beyond that.
So, but it sounds like what you're with the open source community and the project you're you're talking about the sky's the limit.
Yeah. And if you've got the time and the the expertise, you could you could even write up your own component for this.
So it can talk to some other some other thing.
And obviously, lots of people have I guess the other backing up a bit back to the hardware.
Some of the other stuff I've done besides just like lights. Motion sensors and door sensors.
So like things that send a signal when the door opens or closes.
And then a thermostat. A while ago, the city of Austin started giving rebates for smart thermostats, whether or not they're connected to the Internet and I Got one not a nest, but another brand and I'm not even sure they're around anymore, but it's a it's it's got its own rest API that you can hit over the local network again keeping the all the control local And there's even a home assistant plugins for that.
So it's all you can can tie it all together.
From a hardware perspective, one of the things So much of its wireless except of course power.
And so there's there's always to me.
Or unless you want my I feel like if I put a battery and something and mounted to the wall.
It's just inevitably a chore. Done by me. So when it comes to Windows switches and stuff like that.
Do you adore, you know, do you do end up having to wire them in or how do you The ones I have are all battery powered and things have gotten a lot better.
Like the old X 10 ones were like, okay, put to double a batteries in this and then you end up changing it.
Yeah, like every month or two.
Depending on conditions and things, but the door sensors. I have now are Z wave and they they're powered by a small lithium battery, which I think they claim last about a year.
That's sounds about right to me. I haven't.
I don't remember the last time I changed any of those. So maybe I haven't had that long.
So maybe a year or two. We also have a deadbolt on our door that's the way, but that takes for double a batteries, which that's probably the most annoying one.
You have to change it every Every few months or so. But it's nice. You might go into this, but that's the deadbolt is one of my worst fears to I assume when the battery dies, there is still a way to open your door.
Yeah, so the one I have it's the key is still there.
The, the lock is still there. So it's got a keypad on the outside and punch in the number and it unlocks it for you or you can send a signal over Z wave and have it have it unlock But it's still got a key in there.
So as long as you you're not completely relying on it. Bring, bring keys with you.
You can you can get back in and it it's a I think it's conservative in how much battery it thinks it has left so it will beep and not let you lock it again if the batteries are too low.
So you it tries to not let you lock yourself out but Yeah, that might be a good time to talk about some of the other stuff I've done with it and then We'll do some show and tell stuff.
But so one thing I did with the Z wave deadbolt, which I don't have turned on right now is So you've got motion sensors.
You've got other things you can tell the system lets you tell If a certain person is in the house or not based on something like, oh, your phone is on the Wi Fi or your you sent a Bluetooth signal from some Keychain dongle or something.
It says, okay, you're home. So for a while I had it set up. So when my phone got on the Wi Fi and then the motion sensor at the front door.
Triggered within a minute or two, it would say, oh, Larry's home and it would unlock the front door for me as I was walking up the sidewalk, which Really amazing and neat, but also a little bit scary because like if that doesn't work perfectly and it opens the door in the middle of the night for somebody else.
And that's, that's not great.
So that one's Not turned on anymore. But it's like one of the examples of like you can chain all these little conditions together and stuff like that.
So Yeah, makes sense.
The, the, the First scenario. I've never owned a home until just recently.
And the first scenario. I was kind of excited about was, was that sort of proximity unlock, but then a million scary situations.
Yeah, actually, a lot of the stuff I do is voice is voice enabled with the Alexa speaker or the or the Google.
Now, I shouldn't have said that word probably other people's devices just And You know, telling a speaker to unlock your door sounds like a recipe for someone to walk by your window and and ask, just ask to come in doors.
All that stuff.
You know, it seems like you got to be with great power comes great responsibility.
Yeah. Yeah, again, I don't want Didn't intend for this to be like a home assistant commercial, but it's got plugins for for that to For different smart speakers and stuff so you can Not sure if like the actual state of it now.
But at first it was pretending to be another bridge.
So you could tell like, hey, It would pretend to be like light switches and you could give it different names and say, hey, smart speaker.
Do this, turn on this light set the thermostat to whatever So I guess let me share my screen here and we'll Take a look at what my dashboard.
That's another Kind of wild, but a neat thing about a tool like this is a It gives you a dashboard of your house or of all the stuff in your house.
So, and this one is home assistance really great.
You can go in here and configure everything through the UI.
When I first started using it. Most of the stuff was like, okay, if you want This panel and that panel and these different tabs to show up go edit this yaml file.
I mean, everything is yaml right And and configure all this stuff through the yaml and it's it's really evolved and grown.
It's, it's kind of amazing all the stuff you can just click and configure now but So this is just a few of the things I've got in here.
So if I Yeah, if I go click this my light over there is is there should be turning on.
I can lock the front door from there and hooks into like dark sky for weather.
And yeah, it's it's Texas here. So it's it's hot outside.
What else The another really neat thing about it is it records all this data.
So right here.
This is the thermostat. You can see when it's green, the air conditioning was on and you can see what the temperature was what it was set to all kinds of stuff like that.
So, to what extent for these things I see freezer air conditioning, to what extent are you Choosing sort of products that's that integrate with this versus bolting the this on to products that may or may not have any awareness that they're smart or it's smart in our house.
It's definitely a mixture of the two.
So, Thermostat is a I think the company's called radio thermostat and there's a home assistant plugin for that.
And that's It works great.
You just tell it. Here's the The IP address of your thermostat. It talks to it and collects the data, the freezer and the refrigerator temperatures.
That's something I cooked up on my own.
So that's the other reason I I'm into this stuff. It's like a good Way to focus projects and little do little programming and hardware projects.
So I for that I took a Raspberry Pi and some USB temperature sensors. So it's sitting on top of the fridge and the wires go into the fridge in the freezer.
And then there's a Little Python script that pulls the temperature sensors and then Publishes those those sensor values on to MQTT Bus.
So I think it used to be built in, but now it's not. But I have, there's a MQTT thing.
Remember what MQTT stands for It's, yeah, it's a, it's a thing that's used a lot in Internet of Things applications.
It's just a it's got topics and values and you publish a value onto a certain topic and that's it.
And other things can subscribe to that. And there's just, you just get the latest, the last one published on there.
So it says We can even look at the MQT telemetry transport Telemetry.
Yeah, so If you go in here and edit.
You can see what this one is. Okay, so it's a little bit deeper than that. But so there's a sensor object in the in Home Assistant, which is wired into a MQTT topic which is like house slash kitchen slash freezer or something like that.
I forgot what I made, but so it just publishes that and then Home Assistant listens to the MQTT bus and and records the temperature.
Yeah, so that was Is there Have you experienced value from having a recorded history of your refrigerator's temperatures over time.
When I did this, I was like, oh, this will be cool.
I'll get these neat graphs and like, but what's the point, really.
But then I think it was last year, sometime our freezer stopped like would was starting to do weird things.
It was like, this is not freezing all the time.
I was like, what's, what's going on with this. So I think that's when I I had this idea like okay I could wire up a temperature sensor to the freezer, but I hadn't done it.
And that's, so I set this up and finally got it working. And you could actually see This is a screenshot from the logs, the data from sometime last year and Most of this is like normal defrost cycle so that the freezers.
It heats up every once in a while to make sure that frost doesn't build up right like a unless you've got a deep freeze.
That's, that's what freezers do, but then Every once in a while, I had this spike up to 40 That's 42 degrees Fahrenheit or something like that.
So like that's that's weird. Why is it doing that so It didn't Immediately tip me off to the problem, but it was like, okay, something's for some reason it's it's defrosting too hard or too much at certain intervals.
So like, okay.
It really is broken. It's not just the ice cream seems a little soft. It's something's weird.
So this was was actually really useful to have this this data and say, okay.
Yep. Something's going on. And I can see the patterns. This is a more recent one.
And that's like normal it gets up to 25 or so and then then freezes back down to negative two or something like that.
So It's interesting. It also seems like Now seeing the data, you could you could know if someone left the fridge door open or something almost alert on it, even if Yeah fridge is Exactly.
And I so the fridge.
We got as a replacement for that one that stopped freezing actually has a beeper on it.
If you leave the door open too long, but Yeah, we could do that. And you can actually see So the Those graphs.
I showed you earlier come from Home Assistants own little grafana instance.
So, Let me back up a little bit. How much time do we have 10 minutes more.
Okay. Home Assistant is this. It's not just a platform to talk to us all this all these different components and stuff.
It's got This specifically is a thing called Home Assistant.
They changed the name recently used to be Haseo HHS IO.
But it's like this Home Assistant OS.
I think is what it's called now and it's Like an image you can install on a Raspberry Pi or a virtual machine or anything.
And it's got a Docker and containerized everything.
And so as in addition to this core the dashboard and all the controls and stuff.
You can Install all these add ons and one of the add ons is and these run is like Docker containers alongside the Home Assistant core.
So you've got I've got influx DB and and grafana for like long term metrics of all this stuff.
What else in there. Want to make sure to talk about this one too, which is kind of neat, but we'll come back to that the Argo tunnel plugin.
So yeah, it's got grafana in there and you can you can look around and see, let's go see if we could see somebody leaving the door open on the on the fridge.
Probably something like that, but I don't know if you've been opening it registers or if it's so quick.
If it's just like open and close. It's fine. But if it's like like yesterday.
Oh, the drawer came loose and I had to leave it open for a few minutes and you could see it.
I think that's probably know that's a regular defrost and you can see how the like it's only one cooling unit in the fridge.
It's So the fridge and the freezer are tied together when they move in lockstep.
It means it's probably. Yeah, the device.
You've only got one one compressor in there or something, but Anyway, So yeah, all kinds of new stuff.
I get the other problem. I think I actually, this is not data, but the thing that was actually useful.
From this was one of the reasons I started to get into it was I'd leave the garage door open like go home, park the car, leave the door open and then wake up in the morning and the garage door was open all night.
It's like, oh, geez, that's not good. Or leave the house and forget to press the button and it would stay up and or at one point it would close and then open because the sensor was broken.
So I set up an alert that said The garage doors open and you're not home.
Maybe send me a message and then even had a relay hooked into it so I could close the door remotely.
Which again, Maybe questionable safety, but there's a sensor in there that stops it from closing.
If somebody's in the way so Should be okay.
Yeah, seems practical to me that seems It was really good.
I should talk about how the alerts are Are are getting out of there.
I can show you like So these are like some of the different automations that have configured in here.
Most of these I did write as the animal, but you can go edit them as as a In here, they've got two different types of ways to edit it.
But this one says If one of these sensors is open for a minute and 15 seconds, then send this message.
To this target, which is a discord bot. So it shows up as something like this.
Hey, you left the back door open for for too long. Maybe you want to close that you're letting all the cold air out or something like that, or, and this is the the fridge alert.
It got over 50 degrees or something which maybe need some tuning, but Yeah, stuff like that.
So it's kind of a handy, handy way to get notifications. You can do SMS or other kinds of push notifications to but What else.
Oh, so we talked about being able to reach it from inside the house on the Wi Fi.
I always thought it would be really nice to like keep an eye on the house when you're not there or know when somebody rings the doorbell, you can Check on the package or something like that.
And there's other there's products out there for that too, which again who came to home assistant.
But to be able to to access it. Outside the house.
Safely, so that only I can get to it as something that Cloudflare product actually helped me out with.
So, And if you don't know if you can see the URL, but so this is accessible anywhere right now, except It's protected by Cloudflare access.
So if I go there. It asked me to log in with a Google login. And so I can get in there.
My wife can get in there if I want. Other family members could could log in or something like that and and access this dashboard from from your phone down the street or in another city or anything like that.
It's, it's pretty neat.
And then so the access is protecting it the way I Put it on the Internet is with Argo tunnel.
So I mentioned earlier, it's got all these add ons that you can write as Docker plugins and this one is If I can see this is a just a Docker container running Argo tunnel and oops, there's my third.
Don't look at that and don't copy that And it just connects to the local Home Assistant and then reaches out to Cloudflare's edge and makes it so that you can get to this anywhere without having to open any holes on your, your router or anything like that.
You build this Yeah, it's, um, I need to to clean it up and publish it somewhere, but it's a Building add ons for Home Assistant is I think not much more than a Docker file and some some config files.
So it it runs Runs Cloudflare D and Docker and takes in the config options from this from this file and and sets it up that way and It'll even I guess it builds the the Docker container right there.
So, do you. So then in the end, you have a computer running Home Assistant and all these things somewhere and Yep, I used to run it on a Raspberry Pi, but lately was running into issues with SD cards getting corrupted.
So now it's running in a VM on a computer In the house here.
Yeah, so that way it's there's one address. I can use to access it in the house and this other one I can use.
From my phone, wherever Very cool. It's, it's handy stuff.
I think what else. So, who, who I can definitely see myself doing this and nerding out about it and loving it.
I'm not so sure that the rest of the world is going to be able to do that.
But I think that the rest of my family members would Find it as interesting.
Are you So one of the one of the first automation rules I set up was a Put some motion sensors in the kitchen, you walk in the kitchen, the lights come on, you leave the kitchen for five minutes, the lights go out, which is great.
Almost all the time. Because you're not leaving the lights on in the kitchen or you can see in the dark, and it does things like oh dimmer lights in the evening.
So you don't get blinded in the middle of the night, a few times when the motion sensors don't quite work and the lights turn off on you while you're sitting there.
And that's not not great.
So that's most of the interaction that the rest of the family has with it. It's just the the automations.
I have Like shown my wife, the dashboard and stuff like here it is.
If you want to turn the lights on here. Let me install this app, but I don't know that it's if it's not user friendly enough or if it's just not interested, but It's there.
I try to make it easy enough. Like, here's the you can press this button.
It'll turn the lights on, but I guess one thing that makes it easier is we've got a touch screen in the kitchen that you can pull this up on and you don't have to have the app or remember where it is and and stuff like that, but What would you do, what would you like to do next or what haven't you done or didn't work that you can see being your next project.
I'd like it to be And this may be a pretty challenging, but make.
I'd like it to be smarter without having to come up with what the rule is like okay if the Maybe there's some machine learning aspect of it like Look for patterns that are out of the ordinary and and tell me about them like Something like automatically figure out.
I'm not home and this door open and close three times and that probably means Something weird is going on.
So To do that, but that's a Yeah, that sounds, that sounds really interesting.
But so much of our lives are pattern sense of finding anomalous things could could reveal some interesting stuff.
I think we're running out of time. Thanks. Like really, really interesting stuff and I hope you open source or reveal that plugin.
Yeah, I'll put it out there.
Thanks, Tom. This was fun.