Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
homeautomation:zigbee [2025/02/02 08:26] – [Debugging] willy | homeautomation:zigbee [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== ZigBee ====== | ||
- | |||
- | [[https:// | ||
- | |||
- | In other words, **ZigBee** is a wireless protocol, low power, low consumption and highly reliable which proves very efficient for our needs. It's cheap, which means that ZigBee devices aren't expensive. It's low-power, wihich means you can have battery powered devices using it, and it's very widely used, which means you can find lots of devices using ZigBee. | ||
- | |||
- | === Mesh === | ||
- | |||
- | A **wireless mesh** is an approach where the wireless signal is extended by devices that pick up the signal on one side, and creates additional signal on the other side. Excuse my poor explanation, | ||
- | |||
- | On a wireless mesh, a much wider range is achieved by extending the original signal by devices at the edge of the original propagation area. This is not good for bandwitdh, because the same bandwidth get shared along the entire area covered by the mesh, but allows weak signals to cover extended areas without requiring any wired calbing. | ||
- | |||
- | ZigBee creates a wireless mesh using repeaters / routers. | ||
- | |||
- | === Hub / Coordinator (ZC) === | ||
- | |||
- | It's the starting point of your ZigBee network. It can be a USB dongle connected to your Home Assistant or something more complex like a ZigBee to WiFi proprietary hub. | ||
- | It should be located as far as possible from any 2.4Ghz interference, | ||
- | |||
- | It's a good idea to plug your USB ZC dongle to an USB extension cable to keep it a few decimeters from the computer itself. | ||
- | |||
- | The official name is __coordinator__, | ||
- | |||
- | === Repeater / Router device (ZR) === | ||
- | |||
- | Usually a non-battery powered device is always alzo a ZR. This kind of device acts as a mesh router (but it's almost always called __repeater__), | ||
- | |||
- | === End device (ZED) === | ||
- | |||
- | Usually a battery powered device that cannot act as a router / repeater. | ||
- | |||
- | ===== Planning ===== | ||
- | |||
- | ZigBee is a low-power network mesh, so a little bit of planning is required unless your entire house is an open space without walls or furniture, no wiring in the walls and no metal whatsoever (or rocks) either... | ||
- | |||
- | You ZigBee network, again, will **not** be easy to debug when messages starts to get lost, i will give you some pointers later on on this. Better plan properly from the start. | ||
- | |||
- | From my personal experience ZigBee signal will: | ||
- | * **not** cross walls (unless, maybe, pure betongas walls) | ||
- | * **not** cross floors (unless pure wooden floors) | ||
- | * **not** cross stone walls | ||
- | * be shielded by metal rebars (including drywalls structures and concrete with rebars) | ||
- | * be distorted by running current or magnetic fields (including your electrical wirings) | ||
- | |||
- | First of all you //must// ensure that your ZigBee channel does not overlap/get disrupted by your WiFi (2.4Ghz) network, but this will be discussed shortly. The following will assume you have taken care of that. | ||
- | |||
- | The basic rules with ZigBee planning are: | ||
- | * Buy a good number of pure ZRs and place them properly scattered. I have one ZR for each floor of my house. | ||
- | * Place your other kind of ZRs (like smart plugs) so that they are __not__ covered by the appliance they power. For example, the smart plug behind the fridge will __not__ manage to get a good signal, due to the fridge itself. | ||
- | * Do not assume your smart switches will act as good ZRs. Since they are buried inside the wall and mixed with electric wires, they will __not__ work reliably as routers | ||
- | * While a good suggestion can be //only buy good brands, and good quality//, i went the chapo chinese way and adding a few, cheap as well, dedicated routers solved all my problems and saved lots of money too. | ||
- | |||
- | So, to elaborate on the above, your ZigBee mesh will start acting up with no reason at all and spit out various errors in Home Assistant and your automations will start to fail at random? It's time to add some dedicated ZR devices. By dedicated i mean that they are **only** routers, not smart plugs, smart bulbs, smart switches at all, they only have one function: to be a router. They usually are small USB devices that you plug into your wall plugs with a USB charger (<1A is plenty enough). You need them, even if your home is small, and that is **the only reliable solution to ALL ZigBee issues acting up**. | ||
- | |||
- | With some more details, ensure you have at least one ZR in each room, and two ZR always are in line of sight, if possible. Ideally, add one dedicated ZR every crucial point in your home, and at very least one or two for every floor. Don't forget that the signal irradiates like a sphere, so the shortest best could be trough a floor or a wall. | ||
- | |||
- | |||
- | |||
- | ==== Interference ==== | ||
- | |||
- | ZigBee is a very delicate protocol, which unfortunately shares the same 2.4Ghz spectrum as WiFi 2.4Ghz and **will** be heavily disturbed by it. [[https:// | ||
- | |||
- | The basic idea is to choose WiFi channels that do not overlap your ZigBee channel. Since changing a ZigBee channel after it's been in use is complicated and will need repair for a few devices each time, i suggest to plan it in advance **or** move your WiFi channels and not your ZigBee one. | ||
- | |||
- | There are three //non overlapping// | ||
- | |||
- | So, pick two WiFi channels (ex 1 and 6, or 6 and 11, or 1 and 11) and choose your ZigBee channel do overlap with the channel you **do not** use. | ||
- | |||
- | Please take into consideration your neighbors as well, as they might have an overlapping WiFi. | ||
- | |||
- | There is no golden solution, i am afraid, try to play around. | ||
- | |||
- | If possible, choose ZigBee channel 11(the first one) or 24 (channels 25 and 26 might not be supported by all devices). | ||
- | |||
- | See the following overlapping map. Blue is the WiFi channel 1, green is the WiFi channel 6 and yellow is the WiFi channel 11, the smaller ones are all the ZigBee channels: | ||
- | |||
- | |||
- | {{: | ||
- | |||
- | Last, but not least important, pay attention to the interference (EMI) from your Home Assistant itself to the ZC! You want to plug it with an USB extension cable and definitely trough an USB-2 and **not** an USB-3 port. If you only have USB-3 ports (like i do), get a cheap USB-2 hub (not powered should be good in my experience) and plug it between your USB-3 port and the ZC itself. To have the maximum flexibility, | ||
- | |||
- | ===== Debugging ===== | ||
- | |||
- | It's not easy. All you will see are errors in your Home Assistant logs stating that something failed with some obscure error code (es 3074) and some internet searches would yield tons of //useless// pages of people with the same issue and no real solution. | ||
- | |||
- | The issue is always only one: interference and poor mesh quality. What i told you so far should let you fix the issues, all of them, if you go back and recheck everything. But sometimes, debugging the issue is the only real way to find out where is better to act to fix it. | ||
- | |||
- | Open Home Assistant and go to the ZHA integration configuration page, open the graphical view of your mesh:i suggest you disable the two checkboxes as both auto zoom and physics will get in the way for the following. Not try to //unravel// the mesh by moving the boxes around trying to put better links (green and yellow) together. You want to understand how the mesh is configured. You will see that it creates //islands// of devices with better links, and those islands are separated by weaker links (red). You want to act to change those weaker links into stronger links. | ||
- | Doing so, please keep in mind that: | ||
- | * Red and gray links **cannot be totally avoided**, it's perfectly normal to have __lots__ of them. Don't worry. | ||
- | * You only want to **connect the islands**, nothing more. Don't overdo it. | ||
- | * It's a mesh: it will take care of itself, but you must provide opportunities for good links to become available, and this is on you. | ||
- | * Green means **perfect**. Yellow means **more than good enough**. Red means **shitty** and gray means **i know you exist, i don't care**. | ||
- | * Ignore ZED, the fix is only at ZR level | ||
- | |||
- | So, go ahead and link the islands, which means provide better links with placing dedicated ZR devices in strategic places. Think wide, as that might imply to move some stuff around. By purchasing a small multi-plug and moving a smart-plug (a ZR device) 30cm to the side of the fridge i fixed three ZED reception and the smart plug itself, no need to a dedicated ZR there. Where no other actions can be taken, for example if you only have in-wall smart switches and ZED in the area, a dedicated ZR device will works wonders. | ||
- | |||
- | Last **important** note: **be patient**. IT takes hours for the mesh to re-calibrate, | ||
- | |||
- | This is actually the last note: online resources are wildly useless. **The only true solution is detect your islands and ensure they are properly connected.** | ||
- | ==== Home Assistant ==== | ||
- | |||
- | Home Assistant provides at least two different implementations for ZigBee. The main one, which i am using, is called [[https:// | ||
- | |||
- | You need to install it from the add-ons page in your Home Assistent installation, | ||
- | |||
- | === Pairing === | ||
- | |||
- | Each ZigBee device usually has a way to start pairing, you should refer to each device manual. Usually either you power it up, or you long-press a button to start pairing mode. | ||
- | |||
- | When pairing mode is active, head to Home Assistant ZHA device page (under settings) and tap the **add device** floating button in the corner. | ||
- | |||
- | At this point, each new ZigBee device should popup and you can assign a name and a zone to it. I strongly recomend you start pairing one a time and not more than one device simoutaneously or things can get messy. | ||
- | |||
- | === Grouping === | ||
- | |||
- | ZHA let's you group devices together, which can be nice to issue common commands and even reduce your ZigBee network load. | ||
- | |||
- | === Graphical view === | ||
- | |||
- | ZHA provides a nice graph view to visualize your ZigBee Mesh network. From this view, you can appreciate how your ZRs are partecipating in the mesh and you can use it to understand where and how to add ZRs or move devices around for a more logical mesh distribution. | ||
- | |||
- | |||
- | === Usage === | ||
- | |||
- | After the device is paired, it will appear as a new Home Assistant device and it will expose one or more entities that you can start using immediately. Each devie type and brand will expose different entities and behaviours. Most of them, if battery powered, will also report the battery level, which is very handy to replace them before they dies. | ||
- | |||