Automation of a real smart cottage (part 4) software
To create a smart dacha, of course, it is better to choose the most reliable solutions, because access to it may be very limited, it may be quite far away, and if something stops working, you may not always be able to come and fix something there, because if you are in a house or apartment, you are most often there yourself, and you can fix something, so it is important that the connection there via the Internet is more or less reliable and the possibilities of this connection are also unlimited, because if you just install an operating system on the server, for example, then it is not a fact that you will have access to this server remotely, because there may be no way get a white IP address there in order to connect, well, you need some other options for connecting to this server.
Also with devices, they should in principle be quite reliable, it should be possible to duplicate these devices, for example, if you make a wired temperature sensor and install it in a certain place, it may turn out that the server is central or the connection is interrupted with it, maybe some animals will gnaw the wires, too.
there can be such a complexity, well, you need to ensure that there are some duplicate sensors and that you can understand that, for example, if one sensor has stopped sending temperature, but always so that you can rewrite some scenario to another sensor, for example, responsible for heating.
At least this is important, of course, first of all with such more energy-intensive things, convectors, heaters, than with light bulbs or other such devices.
It is still very important to use the most proven solutions from the point of view of software, well, now I made it so that when automating at the dacha of a friend, we also set up the option of working on the Orange Pi 3 server and chose the latest version of the Linux operating system there, we did not consider any other options and on this server, the desktop version of Linux was selected so that you can configure something there, launch something, change it, but now there are no normal applications to connect to the desktop and in fact this option no longer works.
There is no way to connect via SSH over the Internet, you need to consider some other options, but since the keenetic router is used, it has the ability to forward the port, well, not any, there it is mainly http and https, to any device, well, we did so that we installed a special utility on this server Shellinbox, it allows you to the browser can connect and fully manage the operating system, for example, I installed updates on this server through it without any problems, reinstalled Home Assistant there, completely demolished it several times, even updated zegbee2mqtt, that is, in general, everything works completely through this shell, you can also run a file manager there, well, basically this is Midnight Commander, and through it you can see all the folders on this server, in general, copy files, and even edit the file allows this shell without any difficulties, well, some configuration files can be changed, because for example there is Home Assistant and the version is not Supervised, then there is no way to reconfigure there somehow some files will need to be connected through the shell through the shell and configured there.
As a smart home system, Home Assistant is used, access to it is also provided via Keenetic, that is, you can go remotely to configure everything there, all scripts can be rewritten, now Home Assistant in the latest versions is quite well made editor of all visual elements and scripts that can be copied and pasted there, for example, somewhere without any problems.
there are no difficulties, and you can, for example, if you transfer information from some other source simply in the form of text copy and paste this text into Home Assistant and that's it, and all the elements and all the configurations will immediately appear there, that is, it's quite convenient, well,you don't need to use some kind of cloud connection of Home Assistant, which is also paid, that is, everything works without any problems and with normal full access.
To work with zigbee devices, zigbee2mqtt is installed, remote access is also provided to it, you can view devices in the zegbee2mqtt interface, activate the pairing mode if necessary, well, it's clear that if a person is not in the country, then the pairing mode is not particularly necessary, it makes no sense to start it, but at least it doesn't hurt to disable it if suddenly it was turned on and no self-disconnection occurred.
Well, in principle, you can see all the devices their status, all the parameters, of course there is no history, but some basic things can be viewed and even there is a control panel for these devices, that is, you can turn them on, off, in general, everything you need to do if, for example, in Home Assistant this device is either not it was added for some reason correctly or not all attributes are shown, well, in general, there is such a possibility to check everything.
The main difficulty arose with the fact that there is no program to upload files there, you can do it there using scripts from somewhere to pull up individual files, well, you also installed a file browser, additionally a utility, it also allows you to view all folders, all files, copy them and also they can be downloaded from there to an external computer.
computer, there is something to edit and upload back, the only thing that when loading they set the properties are not always correct, and it is necessary there if it is a startup file or some other such, then you will need to change all these parameters there, this is such a small limitation, but there is a full possibility for example all these files see, copy some configurations, take backups from this server remotely, that is, it's all pretty good too.
In Home Assistant, the necessary integrations are configured, HACS is installed so that you can download some third-party modules, installed through the actual HACS just Yandex shell, for working with Yandex stations, well, you can also integrate with the Yandex ecosystem, there is also a special module installed there, through it very much conveniently, you can take any element, specify that it should be added to the Yandex ecosystem, and it will be created there and you can manage it through the Yandex app, you can also manage it with your voice through the Yandex column, this is quite convenient, it develops this module quite well, there are different features, for example, you can combine several separate sensors in one object, if, for example, a temperature, humidity, and pressure sensor, such as the Aqara sensor, was previously loaded as three different sensors, but now you can make it so that it is combined into one device and then it will just be in the Yandex app as one device, it will have different properties, but this can still be done only through the configuration file, this is not very convenient, that is, you will need access to the file system., so that the YAML file can be corrected there, but for now there is no way to do this from the Home Assistant interface.
To configure scripts in Home Assistant, everything is also quite well done, some simple scripts can be written in general without any additional code, just by selecting the necessary elements there, for example, if the temperature sensor is turned on and off, for example, an outlet, this can be configured in the script without any problems, well, the only thing you may need to create two scripts, one that will work on turning on when the temperature drops a lot and the second will work on turning off when the temperature rises, well, with the help of such a scenario, heating control is automated to maintain the desired temperature, and when you go to the dacha, you can simply turn on this scenario in advance or simply change the parameter for example, that the target temperature let's say it was at least 5° C, and it will become, for example, 25° C, well, then, accordingly, this scenario will simply maintain the new temperature, well, we made another small scenario for controlling the lighting in the toilet, there is a motion sensor and a relay from Sonoff the simplest and they are essentially controlled automatically when motion is detected, and it also turns off after 90 seconds when traffic stops, the Sonoff relay also has the ability to turn on using conventional switches and there is actually such a switch, this is also quite convenient, that is, if for some reason something did not work or for example you wanted to turn it off, then you can do this manually, well, it is clear that remotely, if there are any problems if, for example, there is something else with the connection, then if it is still restored, you can disable it via Home Assistant.
In Home Assistant, more webcams have been added, they show a picture there, you can also view the stream.
This is also quite convenient, that is, you don't have to use the proprietary application from these webcams, you can go directly through Home Assistant and see it, but if you still forward this camera to the Yandex ecosystem, you can go directly through the Yandex app, and this also works, is a rather interesting solution, as a simple way to view any camera format, that is, not only those that Yandex supports.
Well, since there is quite a small amount of built-in EMMC memory on the Orange Pi 3 server, it is planned to come and replace the operating system with a version without dextop even now, when it becomes warmer, and then there will be more free space and it will be possible to further develop this smart home.
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.