{"id":323,"date":"2024-01-30T18:55:25","date_gmt":"2024-01-30T17:55:25","guid":{"rendered":"https:\/\/sii.ua\/blog\/?p=323"},"modified":"2024-02-16T18:15:49","modified_gmt":"2024-02-16T17:15:49","slug":"smart-home-in-the-open-source-version-how-i-built-a-smart-home","status":"publish","type":"post","link":"https:\/\/sii.ua\/blog\/en\/smart-home-in-the-open-source-version-how-i-built-a-smart-home\/","title":{"rendered":"Smart Home in the open-source version \u2013 how I built a smart home"},"content":{"rendered":"\n<p>Smart Home and IoT. Two phrases that have always been buzzwords to me. Overused, surrounded by mystery, and in most cases, they are all about simple communication between devices. Everything boils down to easier or more difficult configuration (I\u2019m not writing about the cost of equipment and knowledge \ud83d\ude09 ).<\/p>\n\n\n\n<p>Since the topic is surrounded by mystery and is a niche, I thought I\u2019d try to do it by myself. I wanted to see if I, <strong>as a tester, QA Architect with the knowledge of programming and DevOps, would be able to build my own Smart Home using open-source tools<\/strong> \ud83d\ude42 How did it work out? Why did I choose X and not Y? What would I have done differently this time? Let\u2019s find out.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Where did the idea to create a Smart House come from?<\/strong><\/h2>\n\n\n\n<p>Let\u2019s start with the fact that I\u2019m lazy. Productively, but still lazy. In the evenings, when I come out of the shower, I don\u2019t turn off the fan in the bathroom. And then either the fan is running until the morning or I get out of bed sleepy with great difficulty to click the switch. Pointless. Likewise, when going from the living room to the bedroom, I\u2019d like to turn off all the lights in the living room with just one click and turn on the lights in the hallway for a moment (let\u2019s say, for 3 seconds) so that I can go to the bathroom\/bedroom. Do you know how much effort it is to click all the switches? \ud83d\ude42<\/p>\n\n\n\n<p>And this is when laziness comes in handy! I heard about ready-made solutions related to light control, sockets, etc. But I thought, \u2018Meh! That\u2019s not for me.\u2019 Not only is this expensive, but also all the information will be made available to the outside world (that is, someone can easily connect to my network). I protect my privacy and I don\u2019t want my data to be shared unnecessarily, so I prefer a private cloud over a public one.<\/p>\n\n\n\n<p>So, if I don\u2019t want to spend a lot of money, and I want to keep my data secure, then the cost must be different, and it\u2019s my time. After all, I\u2019m technical so I\u2019ll easily manage because what isn\u2019t done in the name of development. And I\u2019ll gain additional experience! Probably painful, frustrating, but at the end I will be satisfied \ud83d\ude42<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Communication between devices<\/strong><\/h2>\n\n\n\n<p>Before describing my adventures with configuration and choosing the right tools, I\u2019d like to mention how the devices communicate in the Smart Home.<\/p>\n\n\n\n<p>In communication, we have a sender and a receiver. In my case, the sender can be an application on the phone with programmed automation or a physical button. The receiver is the corresponding behavior (e.g., turn on the light in the kitchen. But how do they know that these roles are assigned to them?<\/p>\n\n\n\n<p>Well, with the help of a gateway. A gateway is a device that is a switchboard that manages all communication. And this is where I could have ended my article, if not for the fact that I wanted more freedom. I didn\u2019t feel the need to be limited by some company. Read-made solutions usually result in more difficult integration between various manufacturers, inability to modify them, or transmitting data I don\u2019t want to show to the world. Often, it also comes with a higher one-time cost or subscription.<\/p>\n\n\n\n<p>So I decided to <strong>configure my own switchboard<\/strong>! I already had the basis: Raspberry Pi4, on which one system \u2013 <strong>OctoPrint<\/strong> \u2013 was installed. All I was missing was a device which would serve as a starting node (that is, something to which you will connect the other IEEE802-compatible devices).<\/p>\n\n\n\n<p>The advantage of such a solution is the freedom to configure and modify the behavior. Something the ready-made gateways won\u2019t provide me. Spoiler alert: <strong>now I\u2019d use docker images<\/strong> to configure the devices, but I chose a different path. As it turned out later\u2026 for the advanced.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What goal did I want to achieve with IoT?<\/strong><\/h2>\n\n\n\n<p>Definitely lightning control! Yes \u2013 in my mind\u2019s eye I could already see myself lying on the couch and turning off the lights or checking the humidity in a room from my phone. I also considered the possibility of automatically turning on the fan when the humidity exceeds 60%.<\/p>\n\n\n\n<p>So, I started, as befits a true amateur-future expert, to educate myself! I read what could be done and how. And then came the revelation. And frustration too \ud83d\ude42 What would an IT architect do in a situation when they start a new project? Of course, they\u2019d drew out diagrams with stages. What, where and to what. This approach resulted in the diagram you can see below (already in the target tool \u2013 Node-Red, which I\u2019ll write about later), which is a transfer of my ideas to paper about how I\u2019d like to make my life easier. Thanks to that I already knew how many devices I needed and, more or less, what type of switches to look for.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-2-768x532-1.png\"><img decoding=\"async\" width=\"768\" height=\"532\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-2-768x532-1.png\" alt=\"\" class=\"wp-image-326\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-2-768x532-1.png 768w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-2-768x532-1-300x208.png 300w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 1 Stages of designing a Smart Home<\/figcaption><\/figure>\n\n\n\n<p>I already had the goal, place and a scheme of action. All that was missing were plans how to do the project and what tools to use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Choice of tools &#8211; hardware<\/strong><\/h2>\n\n\n\n<p>After browsing Allegro, AliExpress and reading a few articles, the choice of the equipment was easy. Looking at the successes and failures of others, I decided on devices that support the <strong>Zigbee wireless protocol<\/strong>.<\/p>\n\n\n\n<p>Advantages of the protocol:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>easy to increase coverage by installing transmitters (role: router),<\/li>\n\n\n\n<li>low unreliability,<\/li>\n\n\n\n<li>transmission is authenticated,<\/li>\n\n\n\n<li>two-way communication,<\/li>\n\n\n\n<li>immediate access (protocol also used in motion detectors),<\/li>\n\n\n\n<li>ease of creating and expanding systems,<\/li>\n\n\n\n<li>no use of Wi-Fi.<\/li>\n<\/ul>\n\n\n\n<p><strong>An alternative<\/strong> for the chosen protocol can be <strong>Z-WAVE<\/strong>, which is certified. After comparing the two, I assumed that Zigbee would be efficient enough, cheaper and it has very strong community support (although it\u2019s chaotic). Additionally, there is no limit on connections and data transfer in the mesh network (Z-WAVE has a limit up to 4 devices, and the network can have a total of 232 connected devices). I doubt I\u2019d ever need that many, but why limit yourself).<\/p>\n\n\n\n<p>The downside may be the frequency at which Zigbee operates. It\u2019s similar to Wi-Fi, <strong>which could have been a drawback, but I haven\u2019t noticed it so far<\/strong>.<\/p>\n\n\n\n<p>In Zigbee, there are three roles:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>coordinator<\/li>\n\n\n\n<li>router,<\/li>\n\n\n\n<li>target device (sockets, switches).<\/li>\n<\/ul>\n\n\n\n<p>There is only one physical coordinator in this, and the target device can also be a router. For the second time, I chose a Sonoff hardware key as a coordinator. My first choice was CC2531 from AliExpress.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-2-675x1024-1.jpg\"><img decoding=\"async\" width=\"675\" height=\"1024\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-2-675x1024-1.jpg\" alt=\"\" class=\"wp-image-328\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-2-675x1024-1.jpg 675w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-2-675x1024-1-198x300.jpg 198w\" sizes=\"(max-width: 675px) 100vw, 675px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 2 Choice of tools &#8211; hardware<\/figcaption><\/figure>\n\n\n\n<p>It was a good, one-time choice. The device turned out to be highly unstable, but for testing whether it\u2019s worth following the path of automation, as worth its price (PLN 40). After a few months, I can write that <strong>Sonoff, however, is less unreliable<\/strong>. I hardly had any problems with it at all.<\/p>\n\n\n\n<p><strong>And that\u2019s how the devices were carefully selected not to use Wi-Fi. In addition, I chose Tuya and Sonoff switches for a couple of reasons:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>the only quadruple switch that doesn\u2019t have to be installed on the box (no changes to the electrical system and preserving a consistent design) \u2013 from Tuya,<\/li>\n\n\n\n<li>battery-powered,<\/li>\n\n\n\n<li>can be installed anywhere,<\/li>\n\n\n\n<li>price (I\u2019ll describe the entire cost at the end).<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-3-2.png\"><img decoding=\"async\" width=\"512\" height=\"300\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-3-2.png\" alt=\"\" class=\"wp-image-330\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-3-2.png 512w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-3-2-300x176.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 3 Choice of tools \u2013 switches and transmitters<\/figcaption><\/figure>\n\n\n\n<p>Post factum: only later, being in IKEA, I noticed that this network has also its own switches and switchboard called IKEA Tradfri. So does Lidl\u2026 But what fun it would\u2019ve been, if I chose the easy way \ud83d\ude42<\/p>\n\n\n\n<p>Due to the practicality (data available at once) and design, I <strong>chose Xiaomi humidity and temperature monitors<\/strong>. They use Bluetooth Low Energy.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-4.png\"><img decoding=\"async\" width=\"580\" height=\"580\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-4.png\" alt=\"\" class=\"wp-image-332\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-4.png 580w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-4-300x300.png 300w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-4-150x150.png 150w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 4&nbsp;<a href=\"https:\/\/mi-home.pl\/mi-temperature-humidity-monitor-2\" rel=\"nofollow\" >Humidity and temperature monitor<\/a><\/figcaption><\/figure>\n\n\n\n<p>The computer on which everything was configured was a <strong>Raspberry Pi4<\/strong>. Due to the purely \u2018nerd\u2019 vibe in my house, I found it next to the soldering iron. Previously, it was used, among other things, to operate a 3D printer and expose my training applications related to performance testing and API to the world.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-5-659x1024-1.jpg\"><img decoding=\"async\" width=\"659\" height=\"1024\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-5-659x1024-1.jpg\" alt=\"\" class=\"wp-image-334\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-5-659x1024-1.jpg 659w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-5-659x1024-1-193x300.jpg 193w\" sizes=\"(max-width: 659px) 100vw, 659px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 5 Choice of tools \u2013 Raspberry Pi4 microcomputer<\/figcaption><\/figure>\n\n\n\n<p>Since I already had the system (OctoPrint) installed on the raspberry, I didn\u2019t want to use docker images and modify the current state. I assumed that the configuration of the new software would be a piece of cake! Ough, how wrong I was\u2026<\/p>\n\n\n\n<p>To sum up: I had a scheme of how my Smart Home was going to work and I chose the devices. It was time to deal with the software!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Choice of tools &#8211; software<\/strong><\/h2>\n\n\n\n<p>Let me state right away: I chose <strong>HomeAssistant, Zigbee2MQTT, Mosquitto and Node-Red<\/strong>. You\u2019ll find the explanation below.<\/p>\n\n\n\n<p>Firstly, I\u2019ll describe what I was looking for in the software:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>a nice UI that would provide me with user-friendly device controls,<\/li>\n\n\n\n<li>easy behavior automation (i.e., an algorithm for how a particular device should behave after a given sequence),<\/li>\n\n\n\n<li>integration between the coordinator and the target device,&nbsp;<\/li>\n\n\n\n<li>software to manage queues,<\/li>\n\n\n\n<li>devices configured on a local network,<\/li>\n\n\n\n<li>access to devices from anywhere I have the Internet connection, connecting directly to my home network rather than via the cloud.<\/li>\n<\/ul>\n\n\n\n<p>As I already mentioned, I wanted to work in open-source. The existing solutions didn\u2019t meet all the aforementioned conditions. So, all that was left was the integration of a few software packages.<\/p>\n\n\n\n<p>I achieved my goal, among other things, with the help of HomeAssistant. When using it and being away from home, I connect directly to my home network rather than a public cloud. Proper configuration of HomeAssistant, which consumed a couple of evenings and cups of coffee, granted me apparent peace of mind, handling behavior and security. Did I mention that I didn\u2019t go the easiest way using docker images? \ud83d\ude42<\/p>\n\n\n\n<p>Today I know that I would\u2019ve made changes to the Raspberry configuration. Raspberry would be set up to run docker containers, e.g., from HomeAssistant, Node-Red, OctoPrint.<strong> I believe this would facilitate later modifications, updates, and provide separation of applications.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>HomeAssistant<\/strong><\/h2>\n\n\n\n<p>HomeAssistant is an application that can officially treated as a central system for controlling everything in the house. In my case, it\u2019s a high-level control because I treat the program rather as a UI to hook up everything underneath. In theory, you can find a lot of user guides and documentation in the Internet, but as often happens \u2013 I couldn\u2019t find what I needed.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-6.png\"><img decoding=\"async\" width=\"555\" height=\"204\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-6.png\" alt=\"\" class=\"wp-image-336\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-6.png 555w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-6-300x110.png 300w\" sizes=\"(max-width: 555px) 100vw, 555px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 6&nbsp;<a href=\"https:\/\/www.home-assistant.io\/\" rel=\"nofollow\" >A snippet of device configuration from HomeAssistant<\/a><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-3-1.png\"><img decoding=\"async\" width=\"459\" height=\"402\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-3-1.png\" alt=\"\" class=\"wp-image-338\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-3-1.png 459w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-3-1-300x263.png 300w\" sizes=\"(max-width: 459px) 100vw, 459px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 7&nbsp;<a href=\"https:\/\/www.home-assistant.io\/\" rel=\"nofollow\" >A snippet of kitchen controlling device in HomeAssistant<\/a><\/figcaption><\/figure>\n\n\n\n<p>I also created a nice panel which looks on the phone as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-1-473x1024-1.jpg\"><img decoding=\"async\" width=\"473\" height=\"1024\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-1-473x1024-1.jpg\" alt=\"\" class=\"wp-image-340\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-1-473x1024-1.jpg 473w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-1-473x1024-1-139x300.jpg 139w\" sizes=\"(max-width: 473px) 100vw, 473px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig 8 Smart Home management panel<\/figcaption><\/figure>\n\n\n\n<p>I could\u2019ve used HomeAssistant to automate behavior, but in this case \u2013 Nod-Red won. In my opinion, it\u2019s more intuitive (the diagram shown above), easy to use, and after a problematic configuration of HomeAssistant I said: enough! Of course, the configuration problems were at my own request, but please \u2013 enough is enough!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Node-Red<\/strong><\/h3>\n\n\n\n<p><a href=\"https:\/\/nodered.org\/\" rel=\"nofollow\" >The Node-Red<\/a> tool&nbsp;allows you to easily manage behavior and the entire flow of events that are nothing more than, a click on a button, for example. Physical buttons give the ability to control. You can do, e.g., double-click, single-click and long-click. And this allows you to create an interesting configuration. In the diagram below, I presented one of the behaviors for a button in the dining room.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1.png\"><img decoding=\"async\" width=\"582\" height=\"123\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1.png\" alt=\"\" class=\"wp-image-342\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1.png 582w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-300x63.png 300w\" sizes=\"(max-width: 582px) 100vw, 582px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 9 Diagram of behaviors in the dining room<\/figcaption><\/figure>\n\n\n\n<p>For the double-click, I assigned the following actions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>turn on the lights in the dining room (unless they\u2019re already on),<\/li>\n\n\n\n<li>after 3 seconds, turn off the lights in the kitchen (unless they\u2019re already off).<\/li>\n<\/ul>\n\n\n\n<p>At this stage I knew what I wanted to achieve, so it was time to show the tool in action!<\/p>\n\n\n\n<p>In the application, it looks like as follows. After adding a button to the diagram, I specified what types of physical clicks on the target device can be made and what triggers them (payload.action).<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-10.png\"><img decoding=\"async\" width=\"533\" height=\"445\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-10.png\" alt=\"\" class=\"wp-image-344\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-10.png 533w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-10-300x250.png 300w\" sizes=\"(max-width: 533px) 100vw, 533px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 10 Specification of actions in the application<\/figcaption><\/figure>\n\n\n\n<p>Then, I configured the delays and set the kitchen lights to turn off.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-11.png\"><img decoding=\"async\" width=\"498\" height=\"324\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-11.png\" alt=\"\" class=\"wp-image-346\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-11.png 498w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-11-300x195.png 300w\" sizes=\"(max-width: 498px) 100vw, 498px\" \/><\/a><figcaption class=\"wp-element-caption\">Pic. 11 Configuration of delays<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-4.png\"><img decoding=\"async\" width=\"338\" height=\"322\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-4.png\" alt=\"\" class=\"wp-image-350\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-4.png 338w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/EN-1-4-300x286.png 300w\" sizes=\"(max-width: 338px) 100vw, 338px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 12 Turning off the lights in the kitchen<\/figcaption><\/figure>\n\n\n\n<p>I will add that I can also turn off the lights in the entire house from my bedroom \ud83d\ude42<\/p>\n\n\n\n<p>As a <strong>downside of being able to configure so many different behaviors<\/strong> and the number of physical switches plugged into the network, I must admit that, at first, I didn\u2019t always remember what each click did. Things are better now.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Zigbee2MQTT and Mosquitto<\/strong><\/h3>\n\n\n\n<p>We\u2019ve got UI for the smart home, we have the automation done for the buttons, but these two worlds need to be connected somehow. And this is where <a href=\"https:\/\/www.zigbee2mqtt.io\/\" rel=\"nofollow\" >Zigbee2MQTT<\/a> comes to the rescue, which is a bridge or software that allows integration.<\/p>\n\n\n\n<p>My hardware key already had the firmware installed by the vendor to enable using Zigbee2MQTT, so the choice of software here was simple. Connecting the physical device to Zigbee2MQTT is easy \u2013 you simply search for the device in the app and pair them. Something I liked \u2013 <strong>clear logs, in a user-friendly visual format<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-13-1024x169-1.png\"><img decoding=\"async\" width=\"1024\" height=\"169\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-13-1024x169-1.png\" alt=\"\" class=\"wp-image-348\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-13-1024x169-1.png 1024w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-13-1024x169-1-300x50.png 300w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Ryc.-13-1024x169-1-768x127.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 13 Using Zigbee2MQTT<\/figcaption><\/figure>\n\n\n\n<p>I used <a href=\"https:\/\/mosquitto.org\/\" rel=\"nofollow\" >Mosquitto<\/a> to handle queues. Unfortunately, there is no UI here. The choice was prosaic \u2013 the first result in Google on MQTT implementation. Of course, the configuration on a Raspberry.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Summary<\/strong><\/h2>\n\n\n\n<p>Was it worth it? YES! I learned many things, like configuration. I deepened my knowledge of the Zigbee protocol, Raspberry and I know I want more. I\u2019m also aware that after the initial frustration at the number of articles and not-so-friendly documentation comes calming down and slowly moving towards the goal. In addition, after adding a few lines of the code, the bathroom fan turns on by itself when the humidity is above 60% and turns off when it drops to 50%.<\/p>\n\n\n\n<p><strong>Investment cost: <\/strong>PLN 700 for devices (without Raspberry, but its price used to be PLN 340). Considering the time and experience gained, I think the financial cost is very low. Thanks to what I\u2019ve learned, I\u2019ll soon prepare a Smart Home configuration on a larger scale.<\/p>\n\n\n\n<p><\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-left kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;left&quot;,&quot;id&quot;:&quot;323&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;1&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;2&quot;,&quot;greet&quot;:&quot;&quot;,&quot;legend&quot;:&quot;5\\\/5&quot;,&quot;size&quot;:&quot;30&quot;,&quot;title&quot;:&quot;Smart Home in the open-source version \u2013 how I built a smart home&quot;,&quot;width&quot;:&quot;159&quot;,&quot;_legend&quot;:&quot;{score}\\\/5&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 159px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 24px;\">\n            5\/5    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Smart Home and IoT. Two phrases that have always been buzzwords to me. Overused, surrounded by mystery, and in most &hellip; <a class=\"continued-btn\" href=\"https:\/\/sii.ua\/blog\/en\/smart-home-in-the-open-source-version-how-i-built-a-smart-home\/\">Continued<\/a><\/p>\n","protected":false},"author":34,"featured_media":324,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","inline_featured_image":false,"footnotes":""},"categories":[10],"tags":[13,83,84,82],"class_list":["post-323","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-soft-development","tag-after-hours-project-2","tag-iot","tag-open-source","tag-smart-home"],"acf":[],"aioseo_notices":[],"featured_media_url":"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/Smart-dom-w-w-wersji-open-source.jpg","category_names":["Soft development"],"_links":{"self":[{"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/posts\/323"}],"collection":[{"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/users\/34"}],"replies":[{"embeddable":true,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/comments?post=323"}],"version-history":[{"count":6,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/posts\/323\/revisions"}],"predecessor-version":[{"id":1012,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/posts\/323\/revisions\/1012"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/media\/324"}],"wp:attachment":[{"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/media?parent=323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/categories?post=323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/tags?post=323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}