Ep.119 Designing IOT For The Hot Tub

By Published On: April 6, 2021Categories: Blog, Podcasts, The CTO Studio

Are you a technology professional looking to connect with like minded people?

We have a thriving community of CTOs discussing these episodes and more.

Click HERE to set up a call and learn more about becoming a member.

About The Speaker:

Jonathan LaCour, CTO of Mission. Mission is an AWS partner providing DevOps services and my go to friends for infrastructure questions.

Episode Resources:

Check out https://7ctos.com/

Episode Transcription:

Nickolai Walker: [00:00:11] Hello, hello and welcome back to the studio, I, of course, am your host, Nikolai Walker, on the mic and in your ear, my favorite place to be. We are back again today with another interview with Jonathan Lacour, who we just love. Jonathan is the CTO at Mission Cloud and they are in AWS premier consulting partner. Now, what I want to do is toss this ball over to Etienne because they’re going to get a little bit weird and it’s going to be fun. So I’ll let him just kind of take this whole segment away about building a more intelligent hot tub.


Etienne de Bruin: [00:00:51] I’ve had some thoughts about you in my hot tub.


Jonathan Lacour: [00:00:53] It’s when most people think of me, in their hot tubs.


Etienne de Bruin: [00:00:56] Actually, it’s annoying because almost every time I go into my hot tub now, I inevitably have a thought about you.


Jonathan Lacour: [00:01:04] Yeah, we’re getting into a real weird zone here, but I’m all for it, man. Let’s make it happen.


Etienne de Bruin: [00:01:09] Ok, cool. Cool. Thanks for riding with me. So every time I get into my hot tub, I think to myself all the buttons I need to push just to get the thing to turn on and turn it off and turn on the jets and turn off the jets and increase the temperature and decrease the temperature. The solution to that, progressively, has been manually flipping valves and dials to having a wonderful app built by someone who I think was who was still stuck in the 70s, wonderful, amazing mobile device. But the UI to get into those levels involved is almost the same. I almost just want to go and pull levers versus even using this app that drives me absolutely nuts. And then the other thing about a home kit or about using automation in your house is you still have to go to this damn device that you’re trying to free yourself from.  Half the time I’m on my phone and my kids think I’m doing emails and it’s only because I’m trying to change the music on. So I’m trying to update this and its just like I’m trying to remote an Apple TV. It makes me so sad and it just exhausts me. But that’s in my hot tub and that’s what I think about you, Jonathan.


Jonathan Lacour: [00:02:45] All right.


Etienne de Bruin: [00:02:48] And so a while back when we spoke, you just gave me this incredible overview of how you built this little I think it was a Seri based app that says “I’m busy stay out” or something that you did for your kids and you just quickly gave me a description of how you did it. And I was just thinking to myself, what I need to have in my hot tub is a Jonathan.com that I can just say, hey, computer, turn off the hot tub or computer maybe five degrees warmer. So if I was to do that, if I say to you, Jonathan, I know you’re a aficionado in many aspects, how would we design that? Because we would need a voice box that could hear me say computer. Then I would need to reroute the request, plug in probably to the pint air API some way. Hopefully there is an API output of this machine, even has an API, but I would probably have to link up a voice recognition thing to probably mounted on my umbrella over the hot tub. So it’ll always be listening and then execute a lambda to execute the API to turn that up or down.


Jonathan Lacour: [00:04:23] It actually turns out home automation now is pretty amazing. Even the platforms that people kind of look down on, it’s like homekit is what I use in my house. And it’s funny because I work as an AWS partner and you think I’d be a big, you know, Amazon fan in this regard. And I’m not it just doesn’t agree with my personal preference for the technology in my home. And I’ve got a bunch of Apple stuff, so it just makes more sense, that ecosystem. But all of these things have APIs and toolkits. So the thing you’re talking about is a thing that I affectionately call the daddy board and that’s what my kids call it. Now we’re all working from home now.


Etienne de Bruin: [00:05:04] Well, does it still exist? The daddy board does it still exist or did it used to exist?


Jonathan Lacour: [00:05:11] It exists. It’s on my door right now and it’s set to do not disturb right now. So, yeah, it’s real. You want me to show you, please?


Etienne de Bruin: [00:05:21] Would I be able to or can I execute any commands to it?  Do it. Let’s do it.


Nickolai Walker: [00:05:27] Ok, so gentle listener, I need to butt in here really quick. What you obviously cannot see is that Jonathan is holding up an Amazon fire tablet, which makes this all the more fascinating for me, but I’ll let him pick it up from where we were. Let’s continue.


Jonathan Lacour: [00:05:42] This is the daddy board. So you see how it says do not disturb on it. And it has the emoji of a lady crossing her arms. OK, now I have on my desk a thing called a stream deck? Have you ever heard of a stream deck before? It’s like a little OLED keyboard. So each button has like an oled key and you can push it to change it. So this is hooked into my home automation so I can do it through Siri and in fact I’ll do that so that you’ll understand. So here’s here’s my phone. I’m going to hold down the button so I’m not going to trigger everybody else’s when they’re listening, saying the magic word. So I’m going to say hold down the button, say, let’s see, daddy is available. OK, and now it just turned green, it’s as available and I can say, don’t bother Daddy. Back to do not disturb, I can say daddy needs quiet. Is going to work. There goes quiet, please, right? So don’t bother Daddy. So this is a Amazon fire tablet. It is the cheapest one that exists. And I think it’s like five years old. We got it for my son way back when because we didn’t want to spend the money on an iPad because he was too little and he’d probably break it.


Jonathan Lacour: [00:07:08] So we got this thing, but eventually we got an iPad and we just had this thing sitting around. So I built this and I don’t know, half a day. It’s pretty easy to do. So there is this thing called Home Bridge, which is a open source project that allows you to write your own custom accessories and plug ins for home kit, which is Apple’s home automation thing. There are similar APIs and services available for the Amazon one and everything else in between. Right. There’s one called home assistant. There’s a bunch of them, but effectively it’s a little node thing. And I defined a switch on off switches and actually I define it a three state switch. Right. And so one switch when it turns on can turn off other switches. So when I say do not don’t bother, daddy, it turns on the do not disturb switch and turns off the quiet please switch and the daddy’s available switch. And if I turn on this switch, it turns off those switches. All of that is handled internally through the state management and home kit.


Jonathan Lacour: [00:08:09] Super easy. All you have to do is say this is linked to that, you know, turn off and on. I have a blog post about this and you can link out to this afterwards so people can do it if they want to. But at the end of the day, it’s super easy. I have a tiny little Web service that runs on. I have a Synology NAS in my house. It’s just running all the time. And I have this like, you know, 40 lines of code, little Web service written in Python that sits there. It I can send it in HTP request to tell it to, you know, change the state of the dashboard. And then the dashboard itself is literally a full screen web browser pointed at that same Web service that just shows the current state in a pretty HTML view. Right. And so it’s automatically refreshing every five seconds or something like that. And so when I change the state, it changes that home kit I can talk about on my phone. I could tell it with my voice. I could tell that on my computer anywhere I have the home interface and then just the interface on the dashboard changes. It’s pretty cool.


Etienne de Bruin: [00:09:25] So I understand the refresh from the tablet to the Web service. How does it get from your voice to the Web service is still unclear to me. So you say there’s a home?


Jonathan Lacour: [00:09:40] There are effectively On-Off switches. And I actually don’t think I ended up having to write any of the node code. I used a pre-existing plug in for home bridge that lets you define switches and you say check this and point this endpoint point for the state of the switch and check it every six seconds. And so I literally just configured that home kit and said, look over here at home bridge. I should say there is a switch. It’s called Don’t bother, daddy hit this endpoint to determine if you’re on or off. That’s all it does. Right. And then Home Bridge internally manages the requests and responses and all that stuff. I just created the little teeny tiny Web service that manages the state. Right. And then because it is a native home kit accessory and I’ve added it into my quote unquote home, it just shows up on my phone, my iPad, my Mac, you know, everywhere. And I have, like, Apple’s smart speaker. And so when I shout at it, turn this thing on or turn this thing off, it just does that.


Etienne de Bruin: [00:10:39] Ok, so the home kit, so the home bridge is the service that shows up as an end point in home kit. Is that correct?


Jonathan Lacour: [00:10:51] That you can define new home accessories. So things like light switches and light bulbs and TVs and stuff.


Etienne de Bruin: [00:10:59] Ok, and so and that shows up. That then shows up in the home kit or in in the home. So so I’m still struggling with how. So the voice is handled in directly between Siri and the and the home kit app, whatever that triggers the accessory that you find with home bridge. That is that is that running on yours? Is that the thing that’s running on your Synology system


Jonathan Lacour: [00:11:26] For the purposes of dashboard, I have three switches defined and they’re using a plug in called HDB Switch and I give it a name. One of the names is Daddy is available. And I tell it that the switch is a stateful switch, meaning it has an on state and then off state and you provide it with three endpoints. So I give it an on URL and off you orl and a status you URL and then I tell it check every five seconds. And so what it does is when I go into the home kit or the the home app on my iPad or my iPhone and I toggle the switch on home bridge is