Seperis (seperis) wrote,

  • Location:
  • Mood:

Home Assistant - An Introduction

I'd been back and forth about trying Home Assistant for my home automation needs, mostly due to a.) inertia and b.) SmartThings pretty much covered what I needed.

Then: SmartThings has been transitioning to a new platform and app for two years, and they managed to break a lot of my custom code and other people's--basically, half of why I loved it. Worse, you could not longer choose what devices to expose to Alexa through it.

This is probably where I should go into a little more detail before I start.

Home Automation: The Wars

The Home Automation Wars are neither won nor lost by anyone yet, but they do have stronger and weak contenders. There are two major standards outside direct wi-fi connections: z-wave and zigbee. For the purposes of this discussion, the differences are unimportant; they're just connections standards linking a device (lightbulb) to a hub (central point) so you can control them. When you buy Hue Lightbulbs, for example, you generally first buy the starter with the Hub included. Your lightbulbs connect to the hub and the hub connects to the internet so you can control them.

Z-Wave and Zigbee exist for many reasons--I won't go into the pros and cons and whys--but one big pro for going with as many zigbee/z-wave devices as possible and eschewing many individual wifi devices is to prevent the possibility-and by that I mean will definitely happen--of way too many devices on home wifi and bandwidth loss by connecting the device to the hub and the hub alone connecting to wifi or the router. No consumer router on teh market--and yes, I do mean even the newest--can handle that amount of traffic, much less that many devices. And your streaming will slow to a goddamn crawl.

My Example Home

Example for my home below, excluding my main router. As my main router is the gateway to the internet, consider it the thing everything else connects to.

Regular Non-Home Automation Use of Internet (LAN and Wifi):
Laptops: 3 (1 mine, 1 Child's, one for work), 3 Wifi Internet Connections
PCs: 1 (Child's gaming PC), 1 LAN Connection
Home Server: 1, 1 LAN Connection
Tablets: 1, 1 Wifi Connection
Phones: 2, 2 Wifi Connections
Kindles: 2, 2 Wifi Connections
TV: 2, 2 Wifi Connections
FireTV: 1, 1 Wifi Connection
NVIDIA Shield TV: 1, 1 Wifi Connection
Gaming: 3 (Playstation, X-Box, Switch), 2 LAN, 1 Wifi Connections
Printer: 2 (regular, 3D), 2 LAN Connections
Speakers: 4 (Sonos Beam, Sub, and two satellite speakers), 4 LAN Connections
SubTotal: 23

So I can keep as much as possible off the Wifi and on the LAN, I also have:
Network Switches: 4, 4 LAN Connections

To extend internet in an apartment of concrete:
Routers: 3 (in AP mode so they basically extend the network from my primary router), 3 LAN Connections

Total: 30 devices
LAN: 16
Wifi: 14

That's thirty-one separate devices that must be connected to my main router either by cable or wifi and receive an IP address. The general limit I use is fifty-five devices--LAN and wifi--at one time can connect to a single router, though it can be more or less than that. Seriously, no matter what you read, always assume a max of fifty-five devices and expect much lower. I tested this a lot; I can confirm my ridic expensive Wifi 6 router I bought in December is gangbusters for devices and can handle over 55 but before, I needed two routers minimum to avoid dropping if I went over about thirty. Yeah.

(Note: for work, because of VPN being insanely slow, I had to move a router into my bedroom and run ethernet cable from the living room to my room, then again from the living room to Child's room for his school work. Yes, I have great coverage but also had to nail up thirty to fifty feet of ethernet cable where the ceiling meets the wall because rabbits and reptiles and Child and I are clumsy.)

Now, lets get to my home automation needs.

Home Automation:
Alexa devices: 8 devices
Google Mini: 1 device
Thermostat: 1
Ring Doorbell: 1
Ring Chime: 1
August Lock: 1
Arlo Cameras: 3
Kasa Smart Plugs: 6 (using: 2)
Hausbell Smart Plug: 1
LED Strip: 1
VPRAWLS Smart Power Strip: 1
Ceiling Fan Switch: 1
Porch Light Switch: 1
Lightbulbs: 38
Door/Window Contact Sensors: 6
Motion Sensors: 3
Moisture Sensor: 2
Total: 72

Non-Home Automation: 30
Home Automation: 72
Master Total: 102 devices

If all the stuff under Home Automation needed to be directly connected to the internet by wifi or LAN--meaning each would need their own IP address and be directly connected to the router--I'd need four routers to handle it at least (no way am I spending $300~ for a non-primary router) and my home traffic would be insane and fuck streaming ever.

That's where zigbee/z-wave and hubs come in. Here's my actual home automation setup.

Actual Home Automation

Lights/Switches/Sensors with a z-wave/zigbee hub
Phillips Hue Hub: 14 lightbulbs, 1 LAN internet connection
Sengled Hub: 9 lightbulbs, 1 LAN internet connection
SmartThings Hub: 2 light switches, 6 contact sensors, 3 motion sensors, 2 moisture sensors, 1 LAN internet connection
Arlo Hub: 2 cameras, 1 LAN internet connection
Total Devices: 38
Total Internet Connections: 5

Lights/Switches/Sensors without a z-wave/zigbee hub
LIFX lightbulbs: 7 lightbulbs, 7 Wifi internet connections
Kasa Switches: 2 lights, 2 Wifi internet connections
Power Switch: 1 light, 1 Wifi internet connection
Total Connections: 10
Total Internet Connections: 10

Alexa devices: 8 devices, 8 Wifi internet connections
Google Mini: 1 device, 1 Wifi internet connection
Thermostat: 1, 1 Wifi internet connection
Ring Doorbell: 1, 1 Wifi internet connection
Ring Chime: 1, 1 Wifi internet connection
August Lock: 1, 1 Wifi internet connection
Arlo Camera: 1, 1 Wifi internet connection
Total Connections: 14
Total Internet Connections: 14

Non-Home Automation: 30
Home Automation: 29
New Master Total: 59 devices
LAN: 21
Wifi: 38

Short version: less direct connection of each devices and more hub is the way to go. Z-wave and zigbee don't interfere with wifi and you don't have to worry about splitting your bandwidth. And device response speed over z-wave/zigbee is faster, much faster, than devices over wifi; I tested that, too.

The Home Automation Wars: Complications

Home Automation has a few big players now but more are coming out all the time, but too many are concentrating on wifi--which seriously, read straight through above and think BANDWIDTH--or trying to subvert the zigbee and z-wave standards so you have to use only their hub. Because--surprise--using the standard means your zigbee or z-wave bulb can--at least in theory--be connected to any zigbee or z-wave hub, not just the hub built for those bulbs/devices.

SmartThings, as among the pioneers, made that as easy as possible to do even for stuff that directly competed with their own z-wave/zigbee devices, then made the goddamn brilliant choice to give users an IDE, access to some of the backend, and go to town. As no one is as impatient as a user with tech knowledge, the community of SmartThings users jumped ahead (way ahead) to make compatibility happen no matter what. They'd write their own device handlers in the ID where they could also test, upload them into github, and share with others. Fairly quickly, if it was zigbee or z-wave enabled, you could make it work with SmartThings (wifi is trickier, which is why a lot of standards moved over to it. Trickier, yes: impossible, no). Users created the custom device handlers for half my stuff before SmartThings ever got around to it officially, and I still use several user-created ones now, altered more than one to use on my devices, and they're still being made.

(Alexa, though a competitor, is only really up against Google for voice control; while some Alexa devices can connect to zigbee devices and act as hub, they're still primarily All About Connecting to Other Home Automation Ecosystems, which is a smart move.)

Back to Now

With that perspective, the changes to SmartThings--the loss of a lot of functionality--have been disappointing and frustrtaing. Until now, I used it as a central Hub of Everything with Alexa for voice; now, I couldn't, especially when it became impossible to selectively decide what devices in SmartThings were exposed to Alexa.

Example: my Philips Hue lightbulbs were already compatible with Alexa, so they were directly connected to Alexa. To use them in SmartThings, though, I had to direct connect them there as well. So when I connected SmartThings to Alexa, my Hue lightbulbs would connect again to Alexa through SmartThings and I'd have two of everything.

(In some horrific cases, I had three copies of everything in Alexa, all with the same name, the only difference if I opened properties and could see where the device came from. Worse, some had slightly different names, and Alexa would get confused.

Can't lie, it also bothered me on an anal retentive level; everything was messy.)

My two choices were to
a.) remove everything from Alexa, add it to SmartThings, then let everything go through SmartThings to Alexa. That wasn't feasible; some of the wifi stuff wasn't compatible with SmartThings, and I'd never bothered to test the wifi workarounds available because I'd never needed to.
b.) remove everything from SmartThings that was already in Alexa. As it turned out, that was everything but my z-wave and zigbee devices.

I depressingly chose number two, which was only marginally better than one. This, as a result, mae Alexa my central smart home hub, not just my central Voice Stuff.

Alexa is a terrible central hub; there's limited access when not on a mobile device (the web interface is--horrific). Worse, all connections to Alexa were in, not out. With SmartThings, I could connect them into Alexa, see them and use them in Alexa, but anything connected to Alexa did not connect back to SmartThings. Worse, the automations (routines) you can create in alexa are functional but integration with devices isn't perfect. Alexa's routines simply didn't connect well with zigbee and z-wave devices even when they said they worked. There was delay, a pause, or most likely, not work at all.

In other words, my bathroom lights stopped coming on when I came in the room and that meant war.

(I seriously don't remember how to turn on and off bathroom lights when I enter a room; this is not going to change. I live Star Trek; I'm not going back.)

When I got the NVIDIA Shield TV to take over Plex, I had a Pi with nothing to do with it. So last weekend, I sat down and started the process of learning about Home Assistant.

Home Assistant is a program that makes your Raspberry Pi into a home automation hub. It can connect to any almost existing hub you have with their integrations, bringing them all together. Much like SmartThings but even more so, Home Assistant depends on community integrations, so there's even more made by the community, mostly for devices/ecosystems that don't have an open API.

Basically, it's what SmartThings was doing for me before: I connected all my devices to it and it controlled them, I can create automations for lights or whatever. Better, it allows me to connect to Alexa only things that I want to, so I can connect my Hue Lights to Home Assistant and they won't travel over to Alexa and show up twice or five times or whatever.

There are a billion awesome differences between Home Automation Pi and SmartThings (and other home automation hubs) but there's one big one: the Raspberry Pi does not come with z-wave and zigbee functionality. You either have to buy the parts--a z-wave stick and zigbee board--and make the connections yourself (not hard), or use an existing z-wave/zigbee hub that can be connected to Home Assistant.

In my case, I had my SmartThings Hub, so that is my z-wave/zigbee device. And while SmartThings has made itself more annoying, it does still possess the ability to connect to almost any z-wave or zigbee device in existence one way or another, and much to some ecosystem's despair, even when the break the zigbee or z-wave standard so you can't

(Apparently it took about a day? for users to work out how to connect Aqara devices to SmartThings, even though they deliberately tried to use non-standard zigbee so you'd have to buy their overpriced hub. Good try, Aqara.)

Home Assistant - Introduction and Pics

Here's the link to begin your Home Assistant journey: Home Assistant: Getting Started

Installation is easy; you get a recommended SD card, download Home Assistant to your computer along with an installation program, then flash the SD card. Place SD Card in Pi, and let it update/download. The login to Home Assistant on your computer.

Home Assistant is web and mobile enabled, but all configuration is best done on the web. The interface for everything is http:your-ip:port.

Left side is links to a variety of things (and you can add things later), but the most important is the default page: your dashboard aka all your home.

Each dashboard is made of views, each on their own tab. When you first login, you have a default Dashboard and default View. Everything you add to Home Assistant (your integrations) is automatically added to this default Dashboard/default view. It's annoying but gets you familiar with the ins and outs.

Each view is made up of cards; these cards are how you create what you want to see. There are cards for a single device; cards for multiple devices; cards for home layouts. Most if not all of this can be handled in the visual UI with no coding, just create a new card and pick from a list.

Here is the anatomy of a Dashboard/View/Card;

There are many, many types of cards; all you can configure visually or in YAML. Let's look at the simple examples of cards you'd use on your View and how to create them.

Once you find everything and are comfortable, you create a new dashboard, multiple dashboards, code it yourself or use the UI, whatever you want.

Here's a few from mine now. It is forever in progress because this is fun. I named my apartment Idlewilde.

Home View:

Idlewilde View:

Idlewilde Details View:

I'll do a second post about configuring Home Assistant as time permits, but hopefully, this made you curious. As I want friends in my journey and will get them any way I can. Posted at Dreamwidth: | You can reply here or there. | comment count unavailable comments
Tags: coding, home assistant, my relationship with electronics
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded