Smart Home: An Example of Development and Implementation. Part 3
ImplementationTo implement a smart home system, you need to select a hardware solution (which is not covered by this article) and a software platform. Today there are many open-source software solutions in the market. In my opinion, the following projects are worth considering (systems that I have had experience with):
- OpenHAB is a well-known system written in Java. In my opinion, it is difficult to set and provide a logical connection between smart home devices. You can also use Google Blockly as logic programming tools
- Node-red is a system for implementing simple smart home logic, provided that devices are connected via standard application level protocols (rest, mqtt, etc.). I recommend it for simple solutions, such as a security system, presence imitation system
The smart home itself is now implemented on the basis of Rapsberry PI 3 and the Rapsberrian operating system. As already mentioned, ioBroker is used as a control system. The lightning and power supply control is based on the Noolite technology. As additional hardware a GSM module is used, which is utilized for emergency alarms in the absence of an Internet connection, and as an additional channel to control the system through SMS from trusted phones.
schedule('0 0,8-23 * * *',() =>
let currentTime = new Date();
let hour = currentTime.getHours();
if(hour > 12)
hour -= 12;
let file = hour.toString() + 'h.mp3';
playSound('audio/' + file);
The ioBroker code every hour within the interval 8:00AM-11:00PM calls a function that forms the name of the file in which the chime is recorded for a relevant time and plays the required audio file on an external device.
Here we can see the subscription to the event of the motion sensor’s change state. This code will be called once the state changes and will contain “true.”
And by using Node-red, we can implement simple control scripts. In the bathroom, for example, we can use simple code to control lights with a motion sensor.
Once the sensor changes its state, Node-red blocks are executed automatically. When the sensor transmits a “turn off” command, the script provides a 5-minute delay and then turns off the light. If during 5 minutes the sensor sends the “turn on” command, the delay will be canceled and the light will remain on. Detailed discussion of how to implement Node-red block is outside the scope of this article.
Thus, by treating the smart home as a system for increasing the quality of life, I have managed to realize my dream without substantial expenses. By the time of launching the project for a two-room apartment, its cost was around $810.
.NET & C++ Consultant