How to survive a blackout in a smart home

Yesterday, the light blinked in my apartment, some of the devices survived this normally, some of course could not survive normally and various problems arose. I have a smart home built on the basis of a Raspberry Pi microcomputer version 4, in principle it uses a fairly good power supply and of course it can survive various short-term shutdowns, because the consumption is not very large somewhere around 1 amp, but if a little longer, then of course it will reboot anyway and after a while it will be loaded. But at the start there are some difficulties sometimes they are all scripts and scripts are immediately loaded, I have made it so that when loading it checks whether all the scripts work accordingly if some script or some smart home system has not restarted, then I also get a telegram notification about this and the system tries to restart this component or some specific script. It can be a script that checks the weather every five minutes, or every minute there is a script that takes a picture of the camera, saves it, and there is also a script that is essentially the heart of a smart home, that is, it is actually a web server that is raised on this microcomputer that stores all the sensors, which can to process various web requests, from dashboards, from other devices, it may also not start immediately for some reason, and then of course the smart home system will not work for some time. But I don't check everything hidden often, I have made it so that if something happens, there is no constant running of scripts, that is, I check every five minutes if some scripts or services and services don't work, then just once every five minutes it tries to restart everything, those that they don't work.

I also have a media server on my Orange Pi version 3 computer on which the mpd media server is spinning, respectively, and it can accordingly broadcast music to different bluetooth speakers, and it turned out that after this reboot it simply could not turn on at all, that is, it glowed, but in reality it did not load and in fact of course it is also bad. If some server is in such a state, then of course the system at home will be quite difficult to raise. I also made it so that this microcomputer was plugged into a wi-fi outlet, that is, I can access it through a native application as well, for example, I used the thuja outlet and then of course I can go in and remotely turn off the outlet and turn it on again, and thus restart this server. There was a situation I also had when I was out of the house for some reason I lost contact with all systems and only Telegram actually worked, that is, the system processed Telegram but did not process anything else and I had to reanimate it even using what my telegram bot allows me to do, but it also had the situation when nothing answered me at all I couldn't understand what was going on, well, I think it's okay not to work anymore and it doesn't work nothing terrible will probably happen, I was hoping so much, and in fact it turns out I had to wait for the next light off, there was a period in my opinion, it was summer, when very often something turned off the electricity and somewhere in a couple of days it again apparently blinked and after that the microcomputer came to life and accordingly connected to the Internet. I was already able to remotely control and check what was happening there.

In general, I can certainly track such reboots in the smart home system, that is, for example, since I use Open HAB as a basic remote access system, I put all the different sensors there, I monitor the operation of microcomputers and, accordingly, I see how much memory they have, how much loading and how much disk space and, accordingly, the temperature I also track it because you are a very critical parameter for the microcomputer, and of course I display all these parameters there, but it turned out that I did not display uptime there, I used to have a separate parameter that was recorded and updated when the microcomputer was rebooted, but at the last moment when this happened, I could not track and naturally see whether it was actually rebooted or not. But in general, in principle, this is not difficult to do, and I will still set it up and see it. A lot of other sensors and devices do not survive shutdown well because first of all, if the light turns off, then the wi-fi router turns on, which is used to connect webcams, connect dashboards, the dashboards themselves of course continue to work, and their batteries work and there are no problems in this, this is probably the most reliable part of these devices, but wi-fi is still needed and of course if the router for some reason may not start, then, of course, there is a big problem with this at all, and I basically plan closer to the summer when I will need some more reliable remote control option, when it will not be possible to come and restart manually, so that the contour that I have does not depend on wi-fi, that is, in fact, the main ethernet network itself and Raspberry it is also connected to this network directly without this wi-fi router without the wi-fi connection itself and it can control zigbee sockets even if suddenly the wi-fi router does not work, and thus of course you will need to make a rule, which will allow you to restart this router and, accordingly, just turn it off and on, it will reboot and thus the Wi-Fi can be restored.

Actually, I had to do this because the router did not load, for some reason it just hung up and, accordingly, I also had to manually restart it. In general, different devices that work on wi-fi suffer the loss of wifi connection in different ways, for example dashboards are my iPad sometimes they establish a connection to the router without problems, and in general I use the 5 Ghz connection frequency on them, because it is freer, more reliable in this regard, it works faster, although there is a speed of not really necessary, and sometimes they just do not establish connections, but if the connection is established, then the dashboard itself, of course, connects to the smart home server and, in principle, everything is restored without problems. There are some webcams that I have quite cheap this is ESP 32 cam used, such a module, these cameras they do not tolerate the loss of wi-fi and although there are special algorithms functions that allow you to check and restart and even how to perform almost reset these modules, but in fact the wi-fi module itself it somehow remains active anyway, and only complete shutdown allows these cameras to be returned to the connected state. Also, I still use several sensors of such self-made gateways that work on esp8266 and one on esp32, these of course reboot in principle for them it is not critical and they connect further to wi-fi and further to mqtt and in principle for the most part they do it quite correctly, no big problems arise, the only sensor that I think is an electricity meter, if there is a loss of electricity, it restarts because I do not save the values themselves in this controller, the value is reset and the report starts from zero. I've asked it several times to simply read the value from the smart home server, and based on this value, I've already started reporting it, but by and large there were various difficulties with requesting data from this microcontroller, so I don't use this function yet, but if I'm already allowed to turn it off often, then of course I'll reanimate it again and in principle, the mood. For example, earlier I also had a water meter that also worked over wi-fi, and even when I redid it already on the Arduino, it still worked on the network and of course it did not save the value when the power was lost, sometimes the power supply was enough to last for some short-term shutdowns, but when it was a little longer, of course, the information it was lost, but it is already saved on the server itself in the smart home system, and the countdown also started from zero.

When I changed it to battery power, this problem went away and just the last shutdown, it very successfully showed that this is really a good solution, batteries work, and it can really guarantee that for a year and a half no problems at all with this sensor will arise and, accordingly, I can not always use its value. looking at the real live meters that are installed there at the entrance to the apartment of water and, accordingly, feed these values where you need to be timely and be sure that these values are accurate. But most of all the problems were not created by the Yeelight smart light bulb, of course, it simply lost the wi-fi network, did not install, did not connect, it fell off from the system of my own application, from the smart home system, I had to completely reconnect it, but it was not easy to do at all, because they had to be physically removed from the lamp and a very complex and tricky way to switch back to the smart home system.

Automation in a smart home should be useful and create additional comfort, but sometimes everything goes wrong… The reasons for this, and how to configure everything, see on my channel.

You may also watch

Article By Alex

If you have any ideas on how to improve automation, make it more reliable, fast and useful, then you can leave a comment below. I will try to implement the proposals and tell you in the following videos.