More than 100 automation in a smart home

I already have more than a hundred different automations done in my house, so I've now started keeping a directory of all these automations, but of course it's not very convenient to keep it, because there are a lot of different automations, and there are minor automations that simply involve turning on or off some kind of wireless remote control or a wireless switch. or some more complex automation systems, complex ones that involve many sensors and many different devices.

I do most of the automation using scripts, I develop scripts on Bash, they run on my smart home server, my smart home server is based on Raspberry Pi version 4, these scripts run in different ways, there is a timer, there is a sensor trigger, I have sensors in fact, all information is transmitted via MQTT, the MQTT broker is installed and, accordingly, there is a script that listens to these messages via MQTT and then executes different scripts, I have made different rules for Bash, these rules are related to the control of thermostats, that is, the temperature value is checked and the corresponding thermostat is turned on or on, which controls either the underfloor heating or an additional radiator, there is also music control, that is, these scripts handle the launch of the player, switching a certain channel, and controlling the light in the rooms, also done on Bash, that is, it is switching on by timer, by time, by movement in different rooms, lights, there are different scenarios, which switch the light to different modes depending on the time of day or the illumination in the room, or I also check which specific switches are on and also control the overall illumination in this way.

Some of the automation I have done using a smart home from Yandex is quite a bit of automation, one automation controls the dawn function on the lamp, that is, it turns on at a certain time on a timer and the brightness is gradually added and then after a while it turns off, now it is done in half an hour, there is also the inclusion of music, but it is clear that in This is mainly due to Yandex Music, that is, starting playback on the speaker, stopping, selecting a playlist, and additionally there is some scenario., which triggers the player to turn off if I start listening on the speaker, there are several automations that I did in Node Red, in principle it is quite an interesting automation system, that is, you can visually describe different scenarios there, use different sensors from different systems, it basically connects well to the Home Assistant and MQTT, but actually all these additional modules, there are a lot of them, they somehow work with different logic, there are constantly not enough additional components in order, for example, to take a rule, AND OR OR, some other similar ones, that is, you have to come up with something, and very complex schemes, especially when it becomes necessary to take into account some delays, check the last time of parameter updates, then of course it turns out to be such a huge scheme, which, firstly, is very difficult to understand how it works, and if there are any failures, it is not clear at all how to reconfigure it, and therefore, in principle, I made it so that most of my scripts are called either by a script from Bash, the corresponding command is made, and it calls it with parameters and, accordingly, it is not actually Node Red that is triggered, but the Bash script., or also, in principle, with MQTT, some kind of request is made, for example, I can not directly request from MQTT, but for example, using a script to get some value with some parameters, that is, it turns out to be much more convenient than using the built-in Node Red integration functions with other systems, also inside Node Red in fact, you can write different additional functions in Java, it actually uses a slightly different language, it has a specific syntax, but if some function is missing or insufficient, then you can basically do processing, the input parameters are easily checked there., that is, it can be json and other formats in the input parameters, and it can also be output in different formats, you can just use a string, you can separate the values, you can also generate json and send it to the output, but in general I use it for experiments, in reality of course it works quite fast. there are no complaints about this, and it integrates well and even the integration works quickly, but due to the complexity of administration, of course I decided not to use it, maybe when I come back to it again.

There are also integrations that are made in the Home Assistant smart home system, these are mainly related to Bluetooth and ble processing, because in principle there are convenient components that either support integration with microcontrollers, in this case esp32, or support Bluetooth adapter processing, which is installed on the Raspberry server itself, so it is convenient. but the primary processing is done there, that is, just reading further, I check some basic parameters and send them via MQTT to my smart home system, and then I process all these values further., this is how Xiaomi scales work via Bluetooth, which are connected, this is how the definition of fitness trackers works for me, and the Bluetooth remote control from Yeelight also works for me, also through integration through the Home Assistant, in principle it works quite fast, but of course some very fast operations like volume up, that is, it in fact, the Yeelight dimmer, if you turn the knob there, the value will increase or decrease accordingly, and you can perform some action, but if you do it through integration, first through the Home Assistant, then transmit via MQTT, of course, this will not happen instantly, and then it is not very convenient to track what the current value is, because you need to get feedback from the controlled device, for example, if a light bulb is already on it, then let's say a certain value has become on it, and if I turn the knob further, then a few additional steps will be added there., the brightness increases or decreases.

Some of my scripts were made in OpenHAB, but there were very few scripts, I used to try to write a lot of scripts, but when switching from version 2 to version 3, I had to change all these scripts because of the different syntax, and in principle I realized that it was not very convenient, not very reliable, and eventually decided Even now, we are only processing what is related to integration through OpenHAB, in this case, I either have something that can be shown simply through remote access to OpenHAB, or they use OpenHAB to integrate with Yandex., and that's why there are some scripts that process these rules, these sensors and devices, but additionally there is integration through an application that determines geolocation, and, accordingly, the processing is primary in OpenHAB, and then everything is transferred to the smart home system via MQTT and already processed in my scripts.

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.