Learn Python with Talk Python's 270 hours of courses

#122: Home Assistant: Pythonic Home Automation Transcript

Recorded on Tuesday, Jul 25, 2017.

00:00 The past few years have seen an explosion of IoT devices. Many of these are for the so-called

00:04 smart home. Their true potential lies in the ability to coordinate and automate them as a

00:09 group. How can your garage, Wi-Fi, Chromecast, and window shades work together automatically?

00:15 Chances are these are all from different manufacturers with different protocols and

00:20 apps. That's why you need something like Home Assistant. This Python-based app brings over

00:25 740 devices together and allows you to observe, control, and automate them as a whole. This week,

00:32 you'll meet Paulus Shouston, who created Home Assistant. This is Talk by Thinomy, episode 122,

00:38 recorded July 25th, 2017.

00:50 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the

01:12 ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on Twitter,

01:16 where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm,

01:21 and follow the show on Twitter via at Talk Python. This episode is brought to you by Rollbar and us

01:27 at Talk Python Training. Be sure to check out what we're offering during our segments. It really helps

01:31 support the show. Hey, everyone. Before we get to the interview with Paulus, let me just share a quick

01:36 news item with you. So last week, I was interviewed on one of the other major Python podcasts, Podcast

01:43 Init, and the topic was the migration to MongoDB. So I met with Tobias Macy, and we had an hour-long

01:51 conversation about why and how and so on. I migrated all the podcasts and training sites and things like

01:58 that from SQLAlchemy and a relational database over to MongoDB. What went well, what didn't, lessons I

02:05 learned, things like that. If this is interesting to you, just check it out at podcastinit.com, or if you

02:10 subscribe to the podcast, you can find it there. Now, let's talk with Paulus about home automation.

02:15 Paulus, welcome to Talk Python.

02:17 Yeah, welcome. Hey.

02:19 Hey, great to meet you and talk with you. I'm really excited about this project that you've created.

02:24 One of the biggest, booming, growing, exciting areas is not really smartphones and devices anymore. It's

02:32 internet of things and smart homes and little things that used to just be dumb widgets that we can now

02:38 bring together. And really, what you built is not about the widgets, but about the bringing together,

02:43 right?

02:43 Yes. Yeah. The main goal of Home Assistant is to, you know, we have like, well, we call it the three

02:50 pillars. We have observe, control, and automate. And the observe part is first bringing together,

02:56 just knowing what's going on in the house. Control is being able to control the devices that are in

03:02 your house. And then automate is based on observations, issue control commands.

03:08 Yeah, that's awesome. And I'm so looking forward to chatting about it. But before we get into all

03:12 the details there, tell us about your story. How do you get into programming in Python?

03:15 During college, I studied, I initially studied computer science, but I actually dropped out.

03:21 I was more interested in data. And so I started doing a business intelligence major. And there,

03:27 I mean, you're always doing stuff with data. And I was always like using, like you're doing small

03:32 projects in college all the time. And that's where I kind of like Python started to like sneak in.

03:37 In the beginning, just based on what I know, how I used to learn programming, there's still a lot of PHP,

03:42 but I slowly switched over to Python. And actually, when I was doing my master thesis is where I

03:49 started doing a lot more Python. And that's also when home assistance started.

03:54 That's cool. What was your thesis on?

03:56 My thesis was on Medicaid fraud detection for the federal government here in the United States.

04:01 Wow, that's really cool. That's I think there's really an untapped area in all of this

04:06 medical information. It's pretty locked up, but it's starting to open up for machine learning and

04:12 things like that.

04:12 Yeah, I think there will be a huge potential just like even anonymized data can give us so much insight in

04:17 all these things that are going on.

04:19 Yeah, it's going to be cool as we get enough of this data out to actually do analysis.

04:24 Okay, fraud is also good. Make sure that people who paid for the care or are paying for the care get it.

04:31 That's great.

04:32 Just for having this obviously unrelated to the topic of the podcast, but the fraud was actually

04:37 not the people paying for the insurance. It were the doctors and the hospitals.

04:41 Wow, that's kind of creepy.

04:43 Medicaid is a free insurance. So those people actually didn't care how much got billed for

04:48 them a lot of times.

04:49 Right. They maybe didn't even know. Okay, I can see that. That's that's a little more disturbing. But yeah,

04:54 good that someone's on keeping them on us. That's cool. So what do you do day to day these days?

04:58 I'm a senior software engineer for Appfolio, which is a software as a service company. We provide a product

05:05 for property managers to run their business in the cloud and a product for lawyers to run practice

05:11 management in the cloud. And I work on the lawyer side of things. It's called my case.

05:14 Okay, that's really cool. I feel like there's an untapped market. Well, not entirely untapped because

05:19 you guys are doing it. But there's a big market for these super niche tool sets for just you pick

05:25 your vertical and there's there's probably a not great solution for most most people, right?

05:31 Yeah, definitely. And I think every so many verticals are still in like, you know,

05:37 doing things with pen and paper or Excel spreadsheets for everything and being as a software as a service

05:42 being able to build like an integrated solution that you know integrates everything from like,

05:46 intake of clients to like billing clients to keeping track of your work sharing things with

05:52 clients. There's a big opportunity.

05:54 Yeah, that sounds really cool. We could definitely talk more about that. But let's let's talk about home

05:59 automation. So you've been working on home assistant for about four years. And before we get into home

06:05 assistant, I'd kind of like to get your your vision of the perfect home automation because you've written

06:10 kind of a blog post manifesto type thing of like, here's where we should aim for this. What's your

06:15 vision?

06:16 Yeah, so my my vision for home automation is that a lot of people that kind of like, it's kind of like

06:21 the early adopter phase where we're in right now where all these devices are entering the houses and

06:28 people are realizing that with their smartphone, they can control their lights, they can control like

06:33 the thermostat. But they tend to forget that it's usually not faster to, you know, actually use your

06:41 smartphone like they tend to, you know, put in all these smart lights and all of a sudden your switches

06:45 don't work anymore because your smart lights always need energy to be communicating with the network and to be part of the end of things.

06:52 And so all of a sudden people like end up not having any light switches, which means that all of a sudden when they enter a room,

06:59 they have to get their phone out of their phone, make sure it's connected to the network.

07:02 And actually, they actually are instead of improving their life, they are decreasing their life experience kind of.

07:10 Yeah, I totally think you're right with that. I mean, these things need to be kind of seamless like they are but better.

07:17 They need to get better, not not just different, which makes it really it's a big, a big challenge, but a big opportunity.

07:24 You know, like a quick, quick story. I was out biking the other day and I got this smart bike lock, this super tough smart bike lock, Bluetooth, you can control it, do all sorts of stuff.

07:33 It works kind of okay. But you unlock it with your phone. And the phone wouldn't connect to it. And it was locked up. I'm like, what do I do? There's no key.

07:43 I might be just stuck here. Because that stupid Bluetooth won't pair. What am I going to do? And this is like, this is the problem, right? Like, it's fine until it doesn't work sometimes, right?

07:55 Yeah. And I think that's also another important part of like, you know, your Internet of Things devices is when you want to like, when your phone doesn't work, or you can't connect to it, you should still be able to like, be able to use your device.

08:08 So in case of your lock, that's a very bad, like, you know, experience where like, oh, the Bluetooth doesn't work. Well, you're screwed.

08:16 Yeah, yeah. There is a little panel, but it wasn't working as well. So like, it was, it was bad.

08:22 Yeah. For example, the Philips light bulbs, when you turn them off with the electricity, like just the electricity off, and then you turn them back on, they will reset and turn on and like a white light you would expect from a normal light bulb.

08:33 And so that's a nice experience. And even if you have a light switch, you can at least turn your light switch off and on to get the light to turn on.

08:41 Right. So the failure mode is kind of like the dumb home, or whatever, the dumb device, in a sense.

08:47 Yeah, exactly.

08:47 Yeah, and these are the lights that you can dim, you can like change the color.

08:52 And so they just go back to full power light, or something like this, huh?

08:55 Okay, that makes sense.

08:56 Yeah.

08:56 Other parts of the home automation part is that like, a lot of people will build automations that are optimized for their own life, like as a one person in the household, but most of the times you're not one person in the household.

09:11 So it's very annoying if an automation triggers, and it's not like somebody is like annoyed by it.

09:18 So for example, if you're, you know, if you have this automation to turn off the lights or dim the lights when you are going to watch a TV series, if somebody is like reading a book on the side, then their light is gone.

09:29 That's right.

09:30 And so it's very difficult.

09:32 You want to write automations that have like very, very high success rate.

09:37 And the problem to writing automations with a very high success rate is that you either need to have a very scheduled life, you know, you need to be constantly like every day has to be almost be the same.

09:47 And like have patterns for everything.

09:49 But I mean, for a lot of us, that's just not the case.

09:52 So we need to make like small automations that improve our life, but do not like work against you in the case of like you're going off the pattern.

10:03 Yeah, exactly.

10:04 Like, for example, you come home and normally you unlock the door with your phone, but your phone is dead.

10:08 Now what?

10:09 Yeah, exactly.

10:10 So one of the automations I have, which has been very stable, is that like when we open the door, my phone is connected to the Wi-Fi.

10:20 So home assistant knows I'm home and it will turn on the light, but only when the sun is down.

10:24 And so the worst case is that the light is not being turned on for me and I have to hit the switch.

10:29 Right.

10:29 So the failure case is like what you had before.

10:32 Yeah, exactly.

10:33 Okay.

10:34 Yeah, that's really cool.

10:35 So another thing that you said in your vision was the perfect app is no app.

10:40 What do you mean by that?

10:42 It's kind of what I was talking before about like how the switch is faster than like opening your phone.

10:46 And for most of these applications that you're having in your house, it is just as convenient or sometimes even more convenient to just go to the device and control it.

10:56 The only thing that actually is coming up now that's going to be faster and more convenient is the voice assistants.

11:02 So there's like the Google Home, the Amazon Ego, because those devices, even if your hands are dirty, for example, you're cooking or something, you can still control it.

11:12 And it's very convenient.

11:13 Yeah, I think this is that example really highlights some of the huge possibility and benefits, but also some of the challenges, maybe even apprehension for some people that we have this possibility of having this thing listening all the time.

11:28 You can just speak to it like like like on Star Trek, like computer, dim the lights, please.

11:32 It's amazing, right?

11:33 It's just so incredible.

11:34 But, you know, a lot of people are concerned about having a thing that is like constantly listening to them in their house all the time.

11:41 Right.

11:41 Yeah, no, that's definitely a valid concern.

11:43 So there's actually been a couple of startups that are focusing on local speech to text.

11:50 So they are doing local listening.

11:52 And one that's recently come up and we've integrated and they actually contributed an integration to Home Assistant to integrate a system that looks very promising.

12:01 It's called Snips, Snips.ai.

12:03 They are a French startup and they're going to be their system is fully they're working on making it fully open source and it's already free to use on a Raspberry Pi.

12:12 But the idea is that they pretty much build like an Amazon Ego with like the way you configure it with like these are the sentences that I want to support.

12:20 But then they will run it completely locally on your device.

12:24 So there's no cloud connection.

12:26 And it also means that it's way faster.

12:28 Yeah, that's one of the drawbacks of a lot of these cloud things.

12:32 I mean, it's ridiculous.

12:34 Like I can ask my phone like, hey, Siri, what time is it?

12:38 And it will wait like five or 10 seconds and go, it's 2.30.

12:43 Why did it take you 10 seconds to know that it's 2.30?

12:46 Like this is not a huge challenge, man.

12:50 Do you think that's a transient situation that we're in or do you think this is a permanent thing?

12:55 Like is that just because the cloud is where the power is and it's moving to the devices?

13:00 Or is that like places like Google would rather have the data to learn from and to massively scale on rather than make it work at home?

13:09 I think there's multiple things in place.

13:10 One is definitely Google and Apple, et cetera.

13:13 They want to have your voice because they can see if they're training data, right?

13:19 And so the more voices they have, the better they can learn from.

13:22 But I think the biggest difference is actually is the way how these voice assistants work.

13:27 So the Amazon Ego has a very basic approach as in if you want to write a skill, a voice part for Amazon Ego to know to support like add something to my shopping list.

13:41 You have to register with Amazon every single sentence that the user can ever say.

13:47 So you have to say, you know, you can have like slots that will like be filled in with the actual word.

13:52 So you can have add item to my shopping list.

13:55 But then you have to add another sentence, add item to my shopping list instead of the shopping list.

14:00 And so you end up with like thousands of variations of your sentences.

14:04 But the way Amazon Ego, this allows them that once the speech to text has been done, they can very quickly map it to a sentence that you can say because there's only like, you know, 10,000 possibilities of all the different skills that are active on your device.

14:19 Right.

14:19 It's not wide open machine learning.

14:21 What did that person mean?

14:23 Sentiment analysis type of thing.

14:24 Right.

14:25 And so that's where Google is the Google home.

14:29 At least the way I think it works.

14:32 They do more speech to text and then like get the intent of the text, which is a different approach, which is way more difficult to actually push into the devices.

14:41 They're going to try, obviously, like, I mean, not per se Google, but like Apple's talking about like adding an AI chip.

14:48 And, you know, getting all these things to run locally just because of, you know, privacy is important.

14:52 Yeah.

14:52 Like you said, don't discount latency.

14:54 That's super annoying that it takes that long to get simple responses.

14:58 Okay.

14:59 So, yeah, these, I think you're right.

15:00 This is a really great way to interact with.

15:03 If you can interact with your home, there's some challenges like discovery, like what can you say to your home?

15:09 It's sometimes hard to know, right?

15:10 Yeah.

15:11 No, that's, I mean, the problem with a voice assistant is that because we're still in the beginning phase where we actually don't really understand.

15:18 what you're saying.

15:18 We have just hard coded every sentence that we expect.

15:21 So, you know, a lot of people call it artificial intelligence, but it's not really artificial intelligence yet.

15:28 And I think the whole idea of having a normal conversation is not there yet.

15:34 Once we haven't, we can like, kind of like, you know, as if you're talking to a person like, hey, what can you do?

15:40 And like, you know, it's easier to interrupt them, et cetera.

15:44 Then we can probably discover commands easier.

15:47 Right now it's, you know, we'll, Google Home has like an Alexa, both of like newsletters.

15:53 They email you like, did you know you can ask this?

15:55 Kind of things.

15:57 That's how we have to learn.

15:59 Right, right.

15:59 It's just a home, a smart speaker lesson every week.

16:03 Interesting.

16:04 Okay.

16:05 So let's get specific about home assistance.

16:07 So there's a number of, what would you think of this, like as a hub for a smart home?

16:13 Or how would you describe it?

16:14 Yeah, I would say it's a hub because the way I see a hub is that a hub is a device or a piece of software that speaks multiple languages and combines all these devices together and provides the user an interface or ways to control them.

16:32 Yeah, well, you spoke about the challenge of having to open your phone and open an app to do a thing rather than just hit the switch.

16:37 Well, there's an app for your plug.

16:40 There's an app for your lights.

16:41 There's an app for your garage door.

16:43 Like if you have got to like go to the 10 different apps because you want to do a thing, like then it gets super crazy.

16:48 So a home assistant will like speak the language of all these devices and give you one place to go, right?

16:54 Yeah.

16:54 And besides giving the user one place to go, it also means that it is one place for automations to run.

17:01 Because if you have two different vendors, two different products of vendors that don't speak together, that don't work together, they have their own apps, their own clouds,

17:09 then you will not be able to automate them without having like an intermediary that knows about both of them.

17:15 Right, for sure.

17:16 And so the motion sensor in a nest cannot be used to trigger a light being turned on or something like this.

17:23 Well, a home assistant knows about your light, knows about the nest and can combine these things.

17:28 Okay.

17:28 So it basically, it can receive, it does a couple of things.

17:32 It observes and monitors the state of many things.

17:35 And it also receives events or at least state changes, right?

17:39 Yeah.

17:40 So the way it works is that we have a state machine.

17:42 So home assistant, the architecture is that the core of home assistant is a event bus in which events related to your house are being fired.

17:51 And these are, for example, a button is pressed or motion is detected.

17:57 However, actually motion detect is a bad example because we represent that as a binary sensor because we can say motion is being detected.

18:08 Yeah.

18:08 And so the difference about something that happens right now and something that is happening is we want to, we have to capture it differently.

18:14 We cannot just have an event.

18:15 And so on top of the event bus, we have like a state machine and the state machine captures representations of devices in your house or other things.

18:25 So for example, in the state machine, you have a light and the light is the main state is on or off for a light.

18:32 And they have attributes that describe the state.

18:35 So for example, for light, this could be the color, the brightness, maybe the color temperature.

18:41 But for a media player, the state is, for example, passed or playing.

18:46 And the attributes could be what type of media is the TV show?

18:50 Is it a music album?

18:52 If it's a music album, what's the artist?

18:55 What's the song title?

18:56 What's the track number?

18:57 Et cetera.

18:57 Yeah.

18:58 And then whenever we change the state in the state machine, we will fire an event saying, hey, a state changed.

19:04 And so it actually changed from this to this.

19:07 And this allows other automations, for example, that can listen to either events or to state changes through the state changed event to kind of respond to whenever device representation changes in home assistance.

19:22 And we can start like automating things.

19:24 Yeah.

19:24 That sounds really, really, really useful.

19:26 So you start out with observing them and then you layer on state tracking.

19:30 And then at the home assistant level, you fire the event that, hey, the state has changed.

19:35 Anybody care about this thing?

19:36 Maybe they do.

19:37 Maybe they don't.

19:38 Things like that.

19:41 This portion of Talk Python to Me has been brought to you by Rollbar.

19:44 One of the frustrating things about being a developer is dealing with errors.

19:47 Relying on users to report errors, digging through log files, trying to debug issues, or getting millions of alerts just flooding your inbox and ruining your day.

19:56 With Rollbar's full stack error monitoring, you get the context, insight, and control you need to find and fix bugs faster.

20:03 Adding Rollbar to your Python app is as easy as pip install Rollbar.

20:07 You can start tracking production errors and deployments in eight minutes or less.

20:11 Are you considering self-hosting tools for security or compliance reasons?

20:16 Then you should really check out Rollbar's compliant SaaS option.

20:19 Get advanced security features and meet compliance without the hassle of self-hosting, including HIPAA, ISO 27001, Privacy Shield, and more.

20:28 They'd love to give you a demo.

20:30 Give Rollbar a try today.

20:32 Go to talkpython.fm/Rollbar and check them out.

20:36 So let's talk a little bit about how you built it, what technology is behind it.

20:40 It's Python-based, right?

20:41 Yes.

20:42 So it's Python-based.

20:43 It's Python 3.

20:44 It actually started out with Python 2.

20:47 I was still learning Python back then, and I just kept reading up on it.

20:51 And I was like, wait, there's also a Python 3.

20:53 And then I was looking more into it, and I was like, wait, Python 3 is the successor.

20:57 And, you know, everybody is moving to Python 3.

21:00 Even though four years ago, there was a lot more Python 3.

21:03 It was still up for debate at that point, yeah.

21:05 Yeah.

21:06 But, yeah, it's starting to look out like a good choice for you at this point, right?

21:09 Yeah.

21:09 But I was looking at, like, different things, and I was reading about, like, well, there's

21:14 no new features going to be added to Python 2, and Python 3 is being actively developed.

21:18 And I was like, I got to make the switch.

21:20 So I used, like, 2 to 3 tool, and I wrote it to Python 3.

21:24 I didn't really have any users anyway back then.

21:27 So I could do whatever I wanted.

21:29 Yeah, breaking changes were allowed.

21:30 It's fine, right?

21:31 Yeah.

21:31 And initially, it was actually all using threads.

21:34 So I used the thread pool, and we had, like, whenever you would register for listening to an event,

21:41 you would just register a function, and we would just pass that function and the event object to a thread pool.

21:46 It would execute in a thread and be done.

21:49 And this was actually caused sometimes, like, crazy deadlocks because, you know, there would

21:55 not be enough threads.

21:56 Some threads would be waiting for some work to be done, but that work would not be done because

22:00 there were too many threads waiting for work to be done.

22:02 It's a classic example.

22:04 Those are hard.

22:05 Yeah, those problems are hard to solve.

22:06 Yeah.

22:07 You know kind of what the problem is, but, like, tracing down the details can be painful.

22:12 Yeah.

22:12 Well, actually, the solution came by switching to AsyncIO.

22:17 So nowadays, and I think, yeah, last year, we spent, like, over a year converting to AsyncIO.

22:24 So I didn't know any AsyncIO, but there was this engineer from Mozilla, Ben Bangert, who was using AsyncIO at work.

22:32 And he stopped by, and he was using Home Assistant, and he was like, our minimum requirement at that point in time was already Python 3.4.

22:38 And he was like, if you're using Python 3.4, then AsyncIO is available.

22:43 And with AsyncIO, it will be faster.

22:46 There will be – we can avoid deadlocks, and it will be predictable.

22:51 Because of all the logs and the threads, it was actually at a very unpredictable execution order.

22:55 Sure.

22:56 And at this point, it's waiting right at the network level, right when it's talking to the device or waiting for a response or something like this, right?

23:02 Yeah.

23:03 Yeah.

23:04 With AsyncIO, you can just – you know, you pause within the work until you get, like, the next piece of information, and it can immediately execute.

23:11 Yeah, it's really a nice way to add concurrency, the concurrency you were looking for in the Python 3 world or just the Python world, because you kind of don't have to deal with the GIL very much at that point.

23:23 You don't have this thread overhead.

23:24 You don't have the deadlocks that come with it for the most part.

23:27 It's really nice.

23:27 Yeah, I think that once – when AsyncIO was introduced to me, you know, initially when Ben stopped by and he said, you should use AsyncIO, I was like, yeah, okay, great, but I don't know how.

23:40 And so, you know, you either come up with a PR or it's done, right?

23:44 Yeah.

23:45 And he actually delivered.

23:46 He came up with a pull request.

23:48 It was not fully done yet, but it was very exciting because I was actually learning something new in the Python world instead of, like, you know, every time I do a pull request against Home Assistant or code reviewing this, it was always, like, kind of the same kind of technologies.

24:00 And so this was something new.

24:01 And so we jumped on it and we managed to get the core converted to AsyncIO.

24:07 And then over, like, the course of, like, eight months, we've been converting more and more core pieces of Home Assistant to AsyncIO, to which point now we're fully AsyncIO.

24:17 Yeah, that's truly great.

24:19 Did that lower, like, the types of devices that could run on?

24:25 So before maybe it required, like, a PC, now it could run on, like, a small device or smaller devices than before?

24:32 So we always ran well on a Raspberry Pi.

24:35 So even though we had, like, tons of threads that did not, and the Raspberry Pi 3, at least, it was, like, running okay.

24:43 But right now with AsyncIO, we run, like, blazing fast.

24:48 So I think it allows us to even, like, allow for lower power devices to use those for Home Assistant.

24:56 Yeah, I'm sure it really does make that more accessible.

24:58 That's awesome.

24:59 So that's the AsyncIO stuff is obviously, like, how you talk to all the devices instead of threads.

25:06 What web framework are you using?

25:07 Let me just say what we used before, and then I'll, like...

25:11 So initially we started out with something I built myself on top of the standard library HTTP server, which is not a good idea, by the way.

25:19 But for me it was kind of, you know, I never built a web framework, and I was like, we actually only have one route, which is the serving up the single-page application.

25:27 So, you know, I'll just write something quickly myself, and then, of course, we needed more than one route, and then we needed SSL, and it became very messy.

25:37 You're like, oh, what have I done?

25:37 Yeah.

25:39 Well, for a long time, Home Assistant was my place where I was practicing, like, you know, writing sort of new technologies and et cetera.

25:45 And so this was kind of like, yeah, why not?

25:48 But then we actually migrated, or somebody actually submitted a PR to migrate us to WorkZook, which is a whiskey framework.

25:58 Yeah, part of Flask and all that, yeah?

26:00 Yeah, it powers Flask indeed.

26:02 And that was great.

26:03 And so we were using it on top of threads.

26:06 So we used the CherryPie whiskey server to power all of this.

26:11 And then we were migrating to AsyncIO, and so when we migrated to AsyncIO, I was like, well, we need a new web framework.

26:18 Yeah, because none of those do it.

26:20 Yeah.

26:20 No, so whiskey is not AsyncIO compatible.

26:23 The way it's set up is it's all threading.

26:26 And so people have explored seeing if they can make it Async compatible, and that's not possible.

26:32 But then I stumbled upon AOHTP, and it's very difficult not to stumble upon it because they pretty much wrote the request for AsyncIO.

26:42 So you cannot use requests either.

26:44 So you have to use AOHTP.

26:46 But it's a great, great library.

26:48 It's super fast.

26:50 It's actually powered by CITAN under the hood.

26:52 So a lot of them are executed in C.

26:54 And they did a great job.

26:56 They wrote both the client and the server, and they have a framework on top of that.

27:00 And so we were able to port our HTTP stack over to using AOHTP.

27:08 And because we use AsyncIO, it was actually very trivial for us to add WebSocket support, for example.

27:13 WebSocket support is an HTTP standard that starts as a normal request to your HTTP server,

27:20 but gets upgraded to become like a long-living connection that you can send messages back and forth.

27:25 Right.

27:26 Normally, it's message to the web server, response from the web server, done.

27:30 Yeah.

27:30 Yeah, this is very difficult in a threaded environment.

27:33 Because in a threaded environment, if you have like a worker per request,

27:37 then all of a sudden that one worker is going to be occupied forever.

27:40 And with AsyncIO, there's no such thing as the concept of a worker.

27:45 There's just like tasks that have pending work to be done.

27:49 So you can scale up way higher.

27:51 Yeah, absolutely.

27:52 I mean, that's kind of how Node.js got its, how it took off, like that type of programming model.

27:59 It's really cool to see it here in Python.

28:01 Yeah, and it's working very, very well for us.

28:04 I think that like because of AsyncIO and you know that there is no concurrency,

28:08 we actually managed to get rid of a lot of locks in our code.

28:12 And, you know, when you read from a dictionary and then like two commands later you write to a dictionary,

28:17 you know that no one else can mess with it.

28:20 Which is, you know, so also we're having less weird bugs because these things can just no longer happen.

28:28 Fewer Heisen bugs.

28:29 Yeah, so between the awaits, like you have control over it.

28:35 Very cool.

28:35 All right, so that sounds like such a fun project to be working on.

28:39 Are you looking for contributors and stuff like that?

28:42 We have a lot of contributors right now.

28:44 I think we do a release every two weeks.

28:46 And we have between 50 and 60 people contributing code every two weeks.

28:51 Wow.

28:52 That's really awesome.

28:53 Yeah.

28:53 So right now it's just like, you know, keeping up with the pull request is the biggest challenge.

28:58 Well, maybe you could have some contributors who just try to review the pull requests and just try to like mediate the bugs and feedback and things like that.

29:06 Yeah.

29:06 We have a few of those, but they are, you know, when you look at like open source contributors,

29:11 the people that will help and like the code review and these kind of things, they're rare compared to like the people that will just submit a pull request and get their feature in.

29:21 Yeah, of course.

29:22 Of course.

29:23 There's a lot of people who ask me like, hey, I want to get started in open source.

29:26 Like what's a project I could just do something simple in?

29:29 And so things like that, maybe if people are listening, they could come volunteer to review some pull requests or something.

29:33 Well, I mean, I think if you get into open source, like coming in as like doing some code review definitely helps.

29:39 But I think the best first step into open source is usually just making some contributions to the documentation.

29:46 Getting like, because that way you also learn the workflow of a project, seeing like who works there and like even who works on it.

29:54 And like even like if you hang out in the chat, you can like talk to them.

29:58 And once you know the project better, then like start submitting some features, which makes it a lot easier.

30:03 Just because in the end, like it's very difficult to, you know, get a pull request of somebody you've never spoken to who has like clearly put a lot of effort into a feature.

30:14 And then having to tell that person like this feature is, we're not going to merge this because it's not going to work for like these use cases that you did not think of.

30:23 Which if we would have spoken before for just like a minute or two, you know, I could have told you about this.

30:29 Yeah, that's a really interesting point.

30:31 It would be great if the whole GitFlow PR forking story had like a preliminary step before the work was done, before the PR was submitted.

30:42 Like, I'm thinking of this.

30:44 Prove my general idea, huh?

30:46 Well, yes and no.

30:48 Oh, because like sometimes you just, you're also doing it not per se for the project, but just for yourself to learn.

30:53 And then at the end, you're like, oh, maybe, maybe this is valuable for someone else.

30:59 Sure.

30:59 But as a, you know, for me as a maintainer, it's, it's important that like, you know, when I accept a pull request, I also accept responsibility.

31:08 Right?

31:09 Because like when home assistant breaks, they don't come knocking on the door of that one person who submitted a pull request that contained a bug.

31:16 No, they complain like in our chat room and in our forums on Twitter.

31:20 So, and then we have to put out a hot fix.

31:23 Which is, I'm sure, not fun.

31:25 No, it's not.

31:26 It's like, it's always hectic because you're like, okay, there's a lot of people angry.

31:30 Well, we have a fix.

31:31 Okay, good enough.

31:32 And then we have to like have all the tests run and then push it to PyPy, update the forums, update the release notes.

31:39 And it takes more work than, we've automated a lot, but still, it takes a lot of work.

31:45 Yeah, even if maybe like rolling back documentation or something, right?

31:48 Yeah, even reverse, it's like, becomes like a mess because you have like all these like, people that later want to like, revert the revert.

31:56 It's a mess.

31:57 I hear you.

31:58 Okay, so let's talk about some of the devices you support.

32:00 Let's go from the beginning.

32:02 In the beginning, you kind of created this for yourself and you supported the devices you had, right?

32:07 So where did it start?

32:08 So it started with the Philips Hue light bulbs.

32:10 So when they got released in the United States in, I guess, 2013.

32:15 And that's when I, maybe, no, I think somewhere in 2012, end of 2012, they got introduced and I bought them.

32:24 And I've been, since then I was playing with it.

32:26 But I was just writing simple scripts to like turn them on, turn them off.

32:29 Later, and it's slowly, that script, just for turning on and off, later, slowly has grown into Home Assistant.

32:38 Because then I wanted them to turn on when I came home, but then I didn't want them to turn on when I came home and the sun was up.

32:45 And so I have to keep track of more and more pieces of information.

32:48 But yeah, the second thing I integrated was the Chromecast.

32:52 So that's actually one of the best things I could have ever done because the Chromecast is really taken off.

32:58 And it's actually the Google Home.

33:01 It's also a Chromecast audio.

33:04 So when you start Home Assistant, it automatically detects your TV if you have a Chromecast there.

33:09 It will detect your Google Home, any other cast audio devices you have.

33:13 And then when you start playing music on your Google Home, it will actually immediately show like the album art inside Home Assistant.

33:20 You can pause and play it.

33:22 And they have a great protocol where they push every state update to us.

33:26 So the moment something happens on the Chromecast, we know about it in Home Assistant.

33:30 Right.

33:30 So there's not a latency of you pulling the thing or whatever.

33:33 Yeah.

33:34 Okay.

33:34 So that's really cool.

33:35 Those are some of the first two.

33:37 Now you have more than a handful, right?

33:39 Yeah.

33:39 So right now we have over like 740 or something devices.

33:44 And it just keeps growing.

33:45 There's a lot of devices.

33:46 Either very old ones like X10 support.

33:49 But there are also things of like there was a South African contributor who had some South African startup IoT device in his house.

33:57 And he wanted to integrate it.

33:59 And so, you know, he submitted a pull request.

34:02 And these are the kind of cases.

34:04 And this has been like since the beginning.

34:06 And this has been like since the beginning.

34:06 Getting pull requests for devices that I cannot verify.

34:10 It's always kind of like in the beginning I was like super scared.

34:13 It's like, what am I doing?

34:14 Like, how can I release to people code that like I haven't tested?

34:19 Like I have to trust this random person on the internet.

34:22 Not only have you not tested, you might be having to even really run it.

34:25 Yeah.

34:25 I mean, it's crazy, right?

34:27 Yeah.

34:27 Well, the way home assistant works, you know, I can verify in the code the way things get called to make sure that they don't do anything that goes against the design of the system.

34:37 We've actually also put a lot of like warnings in place.

34:40 And if certain fetching of certain things take too long, we'll print a warning.

34:44 But the reasoning why I decided to actually accept these kind of pull requests is that for a lot of people, it's way easier to fix a bug than to add support for something new.

34:55 So this one person might stop by and contribute support for like one version of a router, for example.

35:03 And then, you know, we have support for this one version and someone else stops by and actually sees a bug.

35:09 And that other person is super easy to just come in and fix one bug.

35:13 And then someone else stops by and is like, oh, if you support this version of the router, well, with very little work, we can add this version of the router.

35:19 And then, you know, it starts growing and growing.

35:22 And we've seen this with like various of our supported protocols and devices where it just keeps growing.

35:29 You almost get like many communities inside home assistant of like a few people who are rallying about the Sonos component or the Z-Wave component.

35:39 Right.

35:39 If their main passion is around the thing that they're integrating to home assistant, like they can form little sub communities around it, right?

35:47 Yeah.

35:47 Okay.

35:47 Yeah.

35:48 And I think this is the nice thing about home assistant is that there's a lot of open source software out there that you can't really use at home.

35:56 Right.

35:56 Because like there's some cool things like Kubernetes or like, I don't know, certain like web frameworks.

36:02 But who writes a website for their house?

36:05 Not too many people.

36:06 Right.

36:06 But if you want to at home and you want to play with things, the nice thing with home assistant is that it controls your house.

36:11 So there's immediate results.

36:13 And so there's immediate like, you know, satisfaction of your work.

36:17 This portion of Talk Pythonry is brought to you by us.

36:21 As many of you know, I have a growing set of courses to help you go from Python beginner to novice to Python expert.

36:27 And there are many more courses in the works.

36:29 So please consider Talk Python training for you and your team's training needs.

36:33 If you're just getting started, I've built a course to teach you Python the way professional developers learn by building applications.

36:40 Check out my Python jumpstart by building 10 apps at talkpython.fm/course.

36:45 Are you looking to start adding services to your app?

36:48 Try my brand new consuming HTTP services in Python.

36:51 You'll learn to work with RESTful HTTP services as well as SOAP, JSON, and XML data formats.

36:56 Do you want to launch an online business?

36:58 Well, Matt McKay and I built an entrepreneur's playbook with Python for Entrepreneurs.

37:02 This 16-hour course will teach you everything you need to launch your web-based business with Python.

37:08 And finally, there's a couple of new course announcements coming really soon.

37:11 So if you don't already have an account, be sure to create one at training.talkpython.fm to get notified.

37:17 And for all of you who have bought my courses, thank you so much.

37:21 It really, really helps support the show.

37:23 Yeah, and it's pretty low risk, right?

37:27 Because you can keep it behind your firewall on your router if you want.

37:30 And it's really sort of just for you.

37:33 Unlike a lot of the Internet of Things, they maybe have their own security issues.

37:39 I mean, yeah, there's a lot of Internet of Things companies starting up all the time.

37:44 And they put products out there.

37:46 And they have a limited amount of time, a limited amount of money.

37:49 So they will try to get to market super fast.

37:52 And security is sometimes like an afterthought.

37:54 Or after a couple of years, the company goes bankrupt.

37:58 And either the cloud shuts down, your device doesn't work anymore.

38:02 Or if the device works locally, it doesn't receive any security updates anymore.

38:07 Right, which is just a ticking time bomb.

38:09 But it's hard to know.

38:10 Like my router at home, it has its little light.

38:15 And it's green usually.

38:16 But if there's an update for it, it'll start blinking yellow.

38:19 Like, oh, maybe I should go look.

38:21 But I don't know that it's not receiving updates if it weren't anymore.

38:25 I just know when there is an update.

38:28 I don't know that it didn't check anymore.

38:30 You know what I mean?

38:31 And so it's really hard to kind of understand that.

38:35 But Home Assistant itself can run internally in your house.

38:40 In one of these Raspberry Pis, if you want, right?

38:42 Are there devices that you can get that's like a Home Assistant device?

38:47 Or do I have to get a Raspberry Pi and set it up?

38:50 Do I have to 3D print a thing?

38:51 Or what's the story about that?

38:53 Right now, we're just an open source project.

38:56 And so we don't have any devices.

38:59 We kind of focus on the Raspberry Pi.

39:02 From the statistics that we get, we see actually 70% of our users on Raspberry Pi.

39:07 But to make it easy, we're trying to slowly get to where we can either have Home Assistant devices or have a better experience.

39:16 So we're working on, we just released today actually, has.io, which is our new operating system for Raspberry Pis.

39:24 Yeah, that's a huge announcement.

39:25 This is like a brand new thing.

39:27 It's not just like, oh, here's some feature.

39:28 There's a whole new operating system for it.

39:30 Yeah, yeah.

39:30 So it's not a 100% operating system.

39:34 Like we built from the ground up.

39:35 We based it on a Raisin OS, which is an open source operating system to run Docker containers on embedded devices.

39:43 And so we use Docker and Raisin OS with SIO to allow a user to flash this to their Raspberry Pi and no longer have to worry about system updates or updating Home Assistant.

39:55 All these kind of things can be done from the user interface.

39:58 Yeah, that's awesome.

39:59 Yeah.

39:59 And so this is going to be our approach to kind of get the next so many users because right now our user base is very much, you know, do it with yourself, people, people that know programming, people that were comfortable enough to get a Raspberry Pi, open a terminal SSH into the Raspberry Pi, these kind of things.

40:18 Previously, like the setup story was SSH in there, create a virtual environment, pip install some requirements.

40:25 Like it was like that level, right?

40:28 And now with this announcement, Haas.io, like it's like a web interface that controls and configures and extends Home Assistant, right?

40:35 Yeah.

40:36 So right now you, once you download Haas.io, you flash it to an SD image and you write, you'll have to edit one text file on the SD image to have it connect to your Wi-Fi if you want.

40:46 But you can, of course, also plug in an Ethernet cable into your Raspberry Pi.

40:50 But the moment you start up your Raspberry Pi, it will download the latest version of Home Assistant.

40:54 It will update the operating system to the latest version.

40:57 And you're good to go.

40:59 Like after 20 minutes, more or less, it will start up Home Assistant.

41:04 Home Assistant will start automatically discovering which devices on your network that it knows how to set up automatically for you.

41:11 And you can start automating things.

41:13 Yeah, that's, that sounds really cool.

41:15 So that's, I'm sure that's going to increase adoption.

41:18 And you had said in the early days you wanted to kind of keep it to this techie crowd.

41:22 And it feels like this is a major step to like make it general consumer type stuff.

41:26 Yeah, it was.

41:27 So we used to like very much keep it focused on just the techie crowd because, you know, when something breaks, they can also contribute back.

41:35 But we were, we've grown so big now.

41:37 We have so much momentum that like, you know, it's a pity if we keep this away from other people as well.

41:43 So we want to have more people like exposed to it and more people using it.

41:47 And I think, you know, if you look at like the amount of integrations, we support so many things that, you know, we want to get more people on board and like even get more integrations and, you know, become like the ultimate home automation hub that you can run locally.

42:02 Yeah, that's awesome.

42:03 You have a lot more integrations than many of the, even the commercial ones, right?

42:08 Yes.

42:08 Yeah.

42:09 But that's actually, it kind of makes sense.

42:11 As in from the commercial ones, they probably have partnerships with those other companies.

42:17 They have, you know, they will test it every time there's one of those companies will update a new product.

42:22 They'll have to make sure it's integrated and those APIs have to stay stable.

42:25 And we have just like an unlimited size army because we're open source.

42:30 And so people will consume any API that's out there and integrate it into a home assistant.

42:36 And people are, you know, it's running in their house and they depend on it.

42:39 And so they see it's breaking or an update coming up, they will submit a patch to home assistant so that we are also, you know, we're always on the latest.

42:46 Always on the latest APIs and always getting better.

42:50 Yeah.

42:50 It's really a testament to the power of open source.

42:53 Like all these people, they have one device.

42:55 They have some technical skills.

42:57 They really want that one device to go in with the rest of their devices.

43:00 And so you can't do that at a commercial one.

43:03 You can just send them like a support request.

43:04 Please support this device sometime soon.

43:07 Yeah.

43:08 I like it to, you know.

43:09 Yeah, exactly.

43:09 And, you know, one other strategy that we've had since the beginning is that we've always made sure that whenever anyone contributed support for a device, that the support itself was actually contained in a standalone Python library that was published to PyPy.

43:24 That way, if you don't want to use home assistant but you still want to use that one device, you could still use that library and even end up maybe making improvements to that library or fixing bugs that we then also can consume inside home assistant.

43:37 Right.

43:38 And that's the way it's still set up now?

43:39 Like all these integrations are separate?

43:40 Yes.

43:40 Every, yeah.

43:41 Because if you look at other home automation, even open source ones, they have all this protocol logic inside their own code base.

43:49 And it's all coupled with their own way how they are doing things.

43:52 And so it makes it difficult to use that code for our project, for example.

43:58 Sure.

43:58 So what's the story of if I want to, suppose I get a device that's not supported, I want to add support through it.

44:05 Take me through the steps of like how do I add a new device to this?

44:08 Well, first you start reading the documentation.

44:10 For home assistant, right?

44:12 For home assistant, yeah.

44:13 No, I think the first step is to see if this device has an API.

44:18 Okay.

44:18 And this might either be a public API or if they have a mobile phone app, some people will use something like Wireshark or something to check out the protocol.

44:28 For most things out there, there will be someone who has already done this.

44:31 You can find like maybe there's a package for Node, maybe there's a package for Python already.

44:36 So actually for most things that you want to integrate, you'll find a library ready to go.

44:40 If you have to write one yourself, you'll have to like use those API dumps or their public API to talk to the device.

44:47 So once you have a library that can talk to the device, it will be very easy to integrate into home assistant.

44:54 So anything that you want to integrate into home assistant is actually based on classes.

44:58 So we have, for example, a switch class.

45:01 And so you would just extend the switch class.

45:03 And then we use the Python properties, class properties.

45:07 So you have a property name where you return the name of your device.

45:11 You have a property is on that will return a Boolean if the switch is on or off.

45:15 And then you have two functions, turn on and turn off.

45:18 And if you implement those to fire the correct commands to your device, they're already in.

45:24 That's it.

45:24 Yeah.

45:25 Yeah.

45:25 That's awesome.

45:26 And all the, to integrate a device, you only have to integrate this class and all the things under the hood,

45:32 how like the state machine has the representation and the event bus, all those things you don't have to worry about.

45:38 Those things are abstracted away.

45:39 They work with your, yeah, they work with your abstract base classes and you don't care.

45:43 Yeah.

45:44 Nice.

45:44 Do you have like multiple inheritance, like something is a switch and it's color adjustable or something like this?

45:49 No.

45:50 So we, the abstract base class of a switch will have, well, color adjustable would mean that like it's actually a light.

45:58 So the switch will have features that are not supported by every device that implements an abstract base class of the switch.

46:05 And so we have this property called supported features, which is using like integer bit flags to say which features are supported or not.

46:13 And that's actually not being used inside home assistant Python, the core, because if you call turn on and you can pass in the color, it's up to the implementation.

46:24 You know, they can just decide not to use the color.

46:25 Right.

46:26 But the front end will, you know, we have a web interface to control everything.

46:30 And the front end, for example, for light that does not support colors will not show a color picker.

46:35 Right.

46:35 Okay.

46:36 Cool.

46:36 Yeah.

46:37 That makes a lot of sense.

46:38 So that sounds pretty easy.

46:39 If you can talk to the API, you can implement a couple of methods on an abstract base class.

46:44 Like it doesn't get a whole lot easier, right?

46:46 I think for like a sensor, if you want to add like a sensor, which is a read only piece of information that you want to pull into home assistant, you can do that in like 20 lines.

46:56 Sure.

46:56 Wow.

46:57 Yeah.

46:58 So that's hopefully that's encouraging people to go and integrate something maybe that isn't in that 740 devices.

47:05 Yeah.

47:06 If people are interested in like adding things to home assistant, I gave a talk at PyCon in Portland last year, 2016, about like, first it describes how home assistant works.

47:17 And then the last 20 minutes is how I'm writing a sensor and a switch from scratch that actually interact with the file system as a demo.

47:25 Okay.

47:25 Yeah.

47:25 So check that out if you want to get started.

47:27 That's really cool.

47:28 So I saw that you have kiosk mode.

47:31 What is that?

47:32 Yeah.

47:33 So actually recently, well, it's not recently.

47:35 It's been for a while now.

47:37 People, because they invest so heavily in home assistant, so they have home assistant like controlling everything in their house.

47:43 And they ended up installing home assistant on tablets and having those tablets being mounted to walls at the entrance of their house or like somewhere else in the house.

47:52 And so people were like, you know, the normal home assistant user interface is not optimized for being on a tablet on a wall, which is where you expect like big buttons.

48:01 We are, our user interface is optimized for mobile phones.

48:05 And so you have, you know, it looks like material design.

48:07 You have like the small toggles that you need like a finger and like you need to be close to like, you know, you need some form of precision.

48:15 And so for the wall mounts, people are like, well, we need a better approach.

48:20 And so we have support for custom panels in home assistant.

48:23 So people were writing pages that would already show like bigger buttons or show like a whole floor plan of the house and show like where in the house, which lights are on and which doors are open.

48:34 But the kiosk mode now will actually take it one step further.

48:37 We'll make sure that the bar on the top is hidden and that the menu is no longer can be opened.

48:43 And that way you really have just like a terminal that like controls parts of your house and people cannot like go to the settings and start changing things.

48:52 Yeah, that sounds really cool, actually.

48:55 So like that's your public one.

48:57 And if you really want to change it, you pull it up on your laptop or something.

49:00 Yeah.

49:00 Yeah.

49:01 Okay.

49:01 Well, that makes a ton of sense.

49:03 So I was thinking of the things that I could automate in my house when I was getting ready to talk to you.

49:11 And to be honest, I don't really have many smart things other than like my phone and my laptop and my kids phones and whatnot.

49:18 We do have on our doors, we have a keypad entry for all the doors.

49:21 So we don't use keys, but they're not they don't have Bluetooth or anything.

49:24 They're just literally like a keypad.

49:26 But one thing that I am getting is I'm getting an electric car and it has one of those 240 volt charging units.

49:35 And that thing has like an app and it has wireless connectivity.

49:41 Like, do you integrate with those types of things?

49:44 Do you know?

49:44 Or is that a PR I should be adding?

49:47 That's probably a PR.

49:49 I mean, we have well, we have support for Volvo.

49:51 So Volvo has like an app for their cars where you can see where the car is.

49:55 And I think you can see the mileage and how much gas you have left.

49:58 And we actually integrate home.

50:00 The home system has support for Volvo.

50:02 So you can like see everything in Volvo.

50:04 So depending on the make and model of your car, there might be already.

50:07 Yeah.

50:08 So I'm thinking of getting a Bolt.

50:09 I mean, I would love to get a Tesla, but you know, I'd also love a Ferrari.

50:13 Like I can wear things.

50:14 No, of course.

50:14 I don't think we have support for a Volt yet.

50:17 But if they have an API that is either accessible or even public accessible, then it should be very straightforward to add support for it.

50:25 Awesome.

50:25 Well, maybe I'll do some kind of PR for you.

50:28 Because, yeah, it's supposed to have like I don't have it yet.

50:30 So I don't know, but it's supposed to like go on the Wi-Fi and talk to your app and like warm it up before you go outside.

50:35 Like things like that.

50:36 Wow.

50:36 Well, I think there's this, you know, there will be also like nice things to do.

50:40 Like, for example, reminders to charge it, for example.

50:43 Like, hey, you were running low when you came home, but you didn't plug it in.

50:47 Yeah.

50:47 Yeah, for sure.

50:48 It's I know it's on the Wi-Fi and it's low.

50:50 So you better go pay it at some attention or something like that.

50:53 Right.

50:53 Yeah.

50:53 Awesome.

50:54 All right.

50:54 Well, that sounds really, really cool.

50:55 So let's talk about just a few other things.

50:57 We're getting short on time here.

51:00 You have just recently started a full on home assistant podcast.

51:04 Why don't you tell people what that is, what it's about, how they can like subscribe to you?

51:09 Yeah.

51:09 So this is three of our community members started this project.

51:13 And they it's all about home assistant and things around home assistant that are happening in the IoT space.

51:20 We are at episode four or five now.

51:22 I think episode four was just launched.

51:23 Yeah, I think so.

51:24 Yeah.

51:24 Yeah.

51:24 And it's all about each episode.

51:26 They try to invite other members of the community that are either doing very cool stuff with home assistant.

51:33 So I think the last episode there was Carlo who has automated his whole house with Alexa and home assistant to control everything.

51:42 Where even like if he lives in Florida, so if he left his door open for too long, text to speech, the house would say to everybody inside, oh, there's a door open.

51:51 So I'm going to turn off the air conditioning now.

51:52 Good luck.

51:53 I was there on episode three.

51:56 And so they keep talking to other members that are like developing the latest, greatest features for home assistant and kind of like thinks how to use it.

52:06 And it's getting quite some popularity.

52:09 I think the first episode had like 2,500 listeners or something.

52:14 That's amazing for the first episode.

52:16 Yeah, that's awesome.

52:16 So it's really great.

52:18 If people are interested, the URL has podcast.io.

52:22 But every episode is also promoted on our blog and Twitter.

52:26 Right.

52:26 Yeah.

52:26 And I subscribe to it.

52:27 I just went to Overcast and I typed home assistant and boom, home assistant podcast came straight up.

52:33 So yeah, that always works as well.

52:35 I'm sure it's on Google Play in addition to that.

52:38 Cool.

52:38 All right.

52:39 So that's really awesome.

52:40 And you guys have t-shirts.

52:41 Is that right?

52:42 Yes.

52:42 If I want to automate my home and then like get people to ask me questions about it.

52:46 Yeah.

52:46 So we've been selling t-shirts since I guess somewhere in the beginning of the year.

52:52 Maybe a bit around the time, I think.

52:55 Yeah.

52:56 And the t-shirts we have right now, 100% of the profits are being donated to the Electronic Frontier Foundation.

53:02 That makes it easier for us to not have any, to do anything with like income and taxes and all that stuff.

53:07 You know, we also support the Electronic Frontier Foundation, which they're doing awesome work.

53:12 Among others, they provide, they started the Let's Encrypt service so that everybody can have an SSL certificate, which a lot of home assistant users are using.

53:20 Yeah.

53:21 With your house.io, that's like a checkbox or something, right?

53:23 Yeah.

53:24 Yeah.

53:24 We make it super easy to get an SSL certificate to secure your connection to your house.

53:29 That's cool.

53:30 Yeah.

53:30 Yeah.

53:30 Very, very cool.

53:31 All right.

53:32 Well, it's super exciting.

53:35 I need a smart thing so I can start playing with home assistant.

53:40 Maybe more than one.

53:42 I would start with just a Chromecast for television.

53:44 Okay.

53:45 Because the nice thing about the Chromecast is that it doesn't have a dedicated app that you need to control.

53:52 The Chromecast is built into the Netflix app, the Spotify app.

53:56 Let's say your browser, you open YouTube and all of a sudden it has a button, play on my TV.

54:01 Yeah.

54:01 In your phone, it will be like, show my screen on the TV.

54:04 Show my photos on the TV.

54:06 It's a very powerful little device.

54:10 And it's like very cheap.

54:12 I think it's like 35 bucks.

54:13 Yeah.

54:13 It's incredibly cheap for what it is.

54:15 Yeah.

54:15 Sounds very cool.

54:16 All right.

54:16 That's a great place for people to get started.

54:19 All right, Paulus.

54:20 Before I let you out here, let me ask you the two questions we always ask at the end of the show.

54:24 One, if you're going to write some Python code, what editor do you open up?

54:27 I use Sublime Text.

54:28 Okay.

54:29 Sublime.

54:29 Definitely a good choice.

54:30 It's very fast.

54:32 And it doesn't do too much, but it does enough.

54:35 Sure.

54:35 Yeah, absolutely.

54:37 That's cool.

54:38 And you've got quite a few lists to pick from, like maybe 741 at least.

54:43 But how about a notable PyPI package?

54:46 Well, actually, I mean, I was thinking about this question before the show started, like what's one that I really like?

54:52 And actually, it's one that's now part of the – I really like AsyncIO.

54:56 And I know it's now part of the standard library, but I think that asynchronous programming sounds so magical.

55:02 But if you actually start looking at the source code, it's super, super straightforward.

55:06 It's just like it has a list of tasks.

55:09 It has every task.

55:09 Do you have something to do?

55:10 Okay, do it.

55:11 And then it just keeps – it's pretty much like a while through.

55:15 And it just keeps going through this list of work.

55:17 And the fact that it gets to the basic – it's so basic from the core.

55:21 And it, like, makes such a powerful paradigm possible is just amazing.

55:26 Yeah, that's a really interesting point about how that simple paradigm really opens things up.

55:31 And, you know, even like you said, simplifies, removes a whole class of bugs for you guys.

55:36 Awesome.

55:37 All right, so final call to action.

55:39 People are interested in this.

55:41 What do they do?

55:42 Get a Raspberry Pi, get a hash.io, and just get up and running.

55:47 And then there's some great documentation.

55:49 We've got some great videos how to get started.

55:51 And if you run into any trouble, make sure to stop by our Discord.

55:55 It's our chat community.

55:57 And it's where a lot of people hang out.

56:00 They're helping out other people to get started and discuss home automation.

56:04 All right.

56:04 Sounds great.

56:05 I'm looking forward to playing around with it.

56:07 Paul, thanks for being on the show.

56:09 It was great to chat with you and share your story.

56:11 Yeah, it was awesome being here.

56:12 Thank you.

56:14 This has been another episode of Talk Python to Me.

56:17 Today's guest was Paulus Shralson.

56:20 And this episode has been brought to you by Rollbar and Talk Python Training.

56:24 Rollbar takes the pain out of errors.

56:27 They give you the context and insight you need to quickly locate and fix errors that might have

56:32 gone unnoticed until your users complain, of course.

56:36 As Talk Python to Me listeners, track a ridiculous number of errors for free at rollbar.com slash

56:41 Talk Python to Me.

56:42 Are you or a colleague trying to learn Python?

56:45 Have you tried books and videos that just left you bored by covering topics point by point?

56:49 Well, check out my online course, Python Jumpstart, by building 10 apps at talkpython.fm slash

56:55 course to experience a more engaging way to learn Python.

56:58 And if you're looking for something a little more advanced, try my Write Pythonic code course

57:03 at talkpython.fm/pythonic.

57:05 Be sure to subscribe to the show.

57:08 Open your favorite podcatcher and search for Python.

57:10 We should be right at the top.

57:11 You can also find the iTunes feed at /itunes, Google Play feed at /play, and

57:17 direct RSS feed at /rss on talkpython.fm.

57:21 Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.

57:26 Corey just recently started selling his tracks on iTunes, so I recommend you check it out at

57:30 talkpython.fm/music.

57:32 You can browse his tracks he has for sale on iTunes and listen to the full-length version

57:37 of the theme song.

57:38 This is your host, Michael Kennedy.

57:40 Thanks so much for listening.

57:41 I really appreciate it.

57:42 Smix, let's get out of here.

57:45 Smix, let's get out of here.

57:45 Stay tuned.

57:47 Stay tuned.

57:47 Bye.

57:48 Bye.

57:50 Bye.

57:51 Bye.

57:52 Bye.

57:53 Bye.

57:54 Rock the best.

57:54 First developers.

57:56 First developers.

58:03 Developers, developers, developers, developers.

58:07 you you Thank you.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon