Saturday, November 11, 2023

WiFi and the smart home.

 Hello again everybody. If you've ever used any smart home products then you know how much these products can enhance your life, if not, then I'll include here a quick primer on some of the home automations I have used and how it has enhanced my life.  After that I want to discuss how these things impact my network and the decisions I've made and some of the struggles along the way.

For the uninitiated, smart home products can range from a simple smart speaker, such as an amazon alexa, or google home device. These are great for quickly checking the weather or asking quick questions to while you're otherwise busy, or have your hands full; as an example, I usually ask my google home about the weather while I'm getting ready in the morning, so I know if I need to reach for a sweater, or not, or if I need to get something warmer than a sweater, or grab and umbrella or anything.  I've also asked about the closing times of local businesses, or travel times to destinations before I depart.  Smart home gadgets don't stop there, and one of the most popular smart home things is smart lights.  Depending on what smart lights you buy and how you have them set up, you may even be able to ask your smart speaker to turn on the lights and it will do so.  In addition to this there's a wide variety of sensors available such as motion, presence, temperature and humidity, as well as others.  These can help you get a better understanding of your environment and what may be happening with it.  In some cases these can also trigger other smart gadgets, such as lights, so the lights come on when you enter a room.

These all communicate over a variety of protocols, you may have heard buzzwords like matter, or thread, as well as other keywords like zigbee or zwave; if you're looking at getting started on smart home stuff, then all of this can be a bit overwhelming.  I'll do my best to briefly demystify some of this.  Matter and Thread are both universal protocols designed to standardize how smart things communicate.  To my understanding of both, they regulate what messages each device uses, not how it communicates them, eg, they use the same words to convey standard commands and reports, but otherwise they can be speaking in whatever "language" to get that message to it's intended recipient.  The "language" analogy here is more about how it gets those commands and reports to it's intended destination, such as a smart hub or target device.  The language it uses is usually either WiFi, bluetooth, Zigbee, or Z-Wave.  These are physical communication protocols.  Thread and Matter communicate on top of WiFi/bluetooth/zigbee/zwave to get the message across.

The next thing to understand is that in the majority of cases, these are hub/spoke type networks, where everything is relayed through a central controller.  Unless you're using association groups (which is a topic unto itself), all communication must be processed by a hub.  You've probably heard the term "mesh" used in conjunction with zigbee/zwave, and while zigbee/zwave can operate as a communications mesh, it does not use the mesh for control - again, unless in association groups as previously mentioned.  This means that when you press a smarthome button, it relays that the button has been pressed to the controller over the wifi/bluetooth or the zwave/zigbee mesh, and the controller then has a programmed action that should be taken when that action is received; such as turning on a light, or playing some music.

Briefly, association groups can allow some devices, such as switches and buttons, to send commands directly to their associated lights or other smart devices, this is uncommon, so I won't touch on it too much as there's a bit more nuance and complexity with getting something like that configured and working; it's also not relevant to my point.

The key take-away from all of this is that some physical protocol (zigbee/zwave/wifi/bluetooth) communicates over some logical protocol (zigbee/zwave/IP/thread/matter) to do things.  You can almost always also control this over an app or website for your smarthome.  In the case of something like LIFX smart bulbs, the bulbs themselves connect over wifi to the cloud, and can be controlled with an app or website to toggle the lights on and off.  In this context, the hub is the cloud server that LIFX has provided for you to use with their products.  This is using the IP protocol to communicate commands.  The benefit here is that something cloud controlled like this ties in nicely to other cloud-based smart home devices, such as google home, which can accept a command like "turn on the living room lights" send it off to the LIFX cloud, which relays it to the lights to execute the "lights on" command.

There's plenty of clever engineering and technology that exists behind the scenes to make this work, and it's all very easy, but for many, this is a problem.

Many smart home enthusiasts want local control.  What this means is that the controller, and all associated components are located locally in your home.  There are some products that do this, however, none more widespread as home assistant.  Home Assistant is essentially a server software that you run on a system inside your home, that allows communication between it and all of your smart home hubs and devices.  It, in and of itself, is not a hub, but can communicate to hubs via USB/direct connection, or over IP. By directly connecting the hub either over your local IP network or via a USB device to home assistant, you can gain local control over all of your devices; some devices can also be added directly over IP (WiFi/Ethernet connection). This comes with it's own caveats. Most notably, you need a fast, reliable way to enable that communication and often that comes with a more expensive home network.  In the case of zigbee/zwave, you need additional devices to enable the home assistant server to communicate with them.

Ideally, you would want to pick a physical communication protocol and stick with it for the most part, since otherwise you need a flurry of dongles and adapters or hubs to communicate to all of your smarthome things.  So, as we lead into the point of this post, let's review each of those physical communication methods and go over some very brief pros and cons of each.

1. WiFi.  This is easy.  Everyone has wifi, so it's extremely simple to plug in wifi smart home gadgets and get them working.  This is why most common smart speakers are wifi.  WiFi will work for everyone.  The issue is that when you start to add a large number of WiFi devices, for example, when you start replacing your lightbulbs en masse with wifi smart bulbs, this can quickly and easily overwhelm your $100 best-buy wifi router; leading to inconsistent behavior, and sometimes loss of connectivity.  Unless you like rebooting your router multiple times a week, you'll probably need to upgrade your wifi to get enough coverage and reliability that you can proceed with replacing all of your non-smart home devices with smart ones.  The upside here is that it's readily available, and doesn't generally require anything additional to what you already have.  The downside is that when you get to the point of having dozens of devices, you may need to upgrade.  Additionally, if your WiFi goes out, then you're pretty stuck, and cannot control your smart home things (and can't really use the internet as well, so I hope you're good enough at networking to fix it without help from google).

2. zigbee.  I'll be listing zwave separately, since, while similar in function, how zigbee and zwave perform their functions is quite different.  The plus side here is that zigbee is an open standard; this can also be considered a downside, but I'll get into that in a minute.  Being an open standard, it is still a standard, and all zigbee devices need to be validated before they can be labelled as zigbee.  The open part of this standard is that anyone can make zigbee compatible microchips or devices with little to no oversight, apart from certification for the official zigbee logo at the end of the process.  This translates to a massive number of zigbee devices, rivalled only by the number of WiFi devices out there.  however, zigbee operates primarily on the 2.4Ghz ISM band, which is the same as WiFi and your microwave oven; this means there's a high probability of interference.  Interference can come in many forms, and there's no good way to determine that it's happening or that it was responsible for any problems you may have experienced... at least not without rather expensive equipment and specialized understanding of how to use that equipment. This can affect other protocols like with WiFi and bluetooth devices.  The plethora of devices here makes it a compelling option, and since it doesn't rely on WiFi to work, it won't overload your wifi router, and generally maintains its own mesh.

3. zwave.  This is very similar in most aspects to zigbee, however, it uses a 900mhz spectrum frequency instead, this keeps it away from WiFi, bluetooth, and zigbee.  This is however a closed standard.  Only one company, Silicon Labs, if I have my information correct, is allowed to produce z-wave standard chips.  It's important to note that z-wave can operate on 2.4Ghz, but it most often is running on the 900mhz band.  Due to regulatory differences, the actual operating frequency of zwave devices varies around the world, so devices are generally programmed for your local region, most notably, EU, US, etc. many of the regional areas involve more than one country, for example, the US region includes Canada and I believe mexico. EU is fairly self-explanatory, etc. however, devices are usually not region-locked, so buying a zwave device from an EU seller for use in the US usually only requires a device update file for the US, and the device will operate on the correct frequency.  Since z-wave is a more closed standard than zigbee, the range of devices is a bit more limited.  Very common/standard devices such as smart switches and smart lightbulbs have a good number of options, but other things like bulb-free smart light fixtures or some sensor arrangements are a bit more difficult to come by.  So there's a fairly large up-side when it comes to frequency use, since 900mhz is mostly not used in consumer electronics now (unlike 2.4Ghz) but due to the single-supplier chip source, it's usually a bit more rare to come by a zwave option of a smart home device that you like.

4. bluetooth.  Last but not least is bluetooth.  The uses for bluetooth in the smart home are usually fairly limited.  Usually these devices are WiFi, with bluetooth as an option, though some bluetooth only devices exist.  Usually getting these connected to a smart home hub such as home assistant is a bit more involved.  Anyone who has paired their cellphone to the stereo in their car will understand the issue; while sometimes this can be downright painless, other times it can be a nightmare of issues that you don't fully understand.  The connection can be unreliable at times and generally is very limited in range.  Due to this, most smart home device makers avoid bluetooth in general, but it is an option in some cases.  If you're unaware, bluetooth operates on the same 2.4Ghz spectrum, same as zigbee and WiFi; with all the caveats previously mentioned about that band.  It uses a clever frequency hopping technique that generally avoids ongoing connectivity problems, but as you may have experienced, it's not perfect... at times it's not even what I would consider to be good.  It's also relatively low power compared to other protocols, so range is more of an issue than with other options.

So that's the protocols.  "What's the point", you may be asking.  I've certainly taken a long enough time to get around to it.  As readers of my blog will already know, I'm a network technician/engineer with a strong understanding of WiFi and wireless stuff.  So the primary point here is to choose carefully. Almost everything "smarthome" is wireless.  There's very few options to have an ethernet or wired connection to a smart device.  It's far more rare than even bluetooth.  I've heard of ethernet connected lighting for businesses (sort of like smart lights, but over a wire, and getting power over ethernet), but no such device has been made available for consumers as of the time of writing; at least, none that I'm aware of - and if anyone is aware of such a device, please let me know.  Almost all smart home devices are some variant of WiFi, zigbee, zwave or bluetooth (in descending order of popularity).

Choosing WiFi sounds good on the surface before you start to install them, but you may find that as you install them, your WiFi isn't good enough to handle that many devices connected all at once, all the time; this may lead to very expensive upgrades to your WiFi system to try to support them.  Choosing Zigbee may sound great as an alternative, with all the options of devices that are available, and keeping them off the WiFi, but you may find that the 2.4Ghz spectrum in your area simply has too much interference for them to work reliably.  So then what? zwave? is that the right answer?  Well, maybe, it solves a lot of the interference problems of bluetooth, WiFi and zigbee, but adds another, you may not be able to get the devices you really want with a zwave option, so you may be limited in what sensors and other devices you're able to locate and buy to use with your zwave smarthome.

So if all the options are varying levels of bad, what's the solution?  We've reached my critical point. All options are varying levels of bad.  Having a smarthome is wonderful, you can turn off the lights after you've gotten comfortable in bed, you can check the outside temperature from anywhere.  You can do all sorts of interesting and amazing things with home automation, but it's important to pick the right devices and set your own expectations of how well they're going to operate.  Sometimes, they will fail, and that should be expected. Sometimes they'll go offline or stop functioning, and that should be expected.  Sometimes they'll get so frustrating that you'll want to throw them out of your window, and yeah, sometimes that too.

By no means am I trying to convince anyone not to buy into smart home stuff, all the benefits of the smart home devices I've tried, and used, have far outweighed the problems with it.  The day to day benefits of it are immense.  I'm not here to tell you what to buy, or which protocol to use.  Do what you like, but know, dear reader, that there are tradeoffs that the smart home makers are not going to tell you, and you should be prepared for that.  Right now, the smart home is a minefield of problematic things that operate on problematic frequencies that are already overcrowded as-is; and if it's not, the choices are so limited you may regret the decisions you make along the way.  No matter what, plan ahead.  Plan for when the smart home stuff stops working; have a backup to turn off the lights if they're stuck on, a way to reset the lights so they turn on when they won't otherwise illuminate.  Have options.

At the end of the day, I hope you're all healthy and happy and you can achieve all the goals you want in life.  Take care now.