Smart Home Software # 2
Good day everyone! Continuing the idea of my old post , I developed a program that can be used as a system for controlling a smart home.
In order to immediately interest the reader, I will demonstrate some of the software usage scenarios:
|Control of lighting, climate, |
multimedia, etc., using Z-Wave and Modbus
devices , the ability to expand the list of compatible protocols by writing plug-ins .
|GPS tracker and geolocation triggers.|
|Creation of algorithms for the |
scenario with cycles and conditions ;
using one script in
another ; the ability to combine
multiple Lazurite servers
via remote scripts .
Any script has its own switch in the user interface - "tile". Depending on the type of data in the script, the switch will look different.
Examples of script switches.
In addition, there are three types of scenarios in Lazurite: a single action, a complex script, and a remote script.
Single actions are scenarios that do not require complex logic, such as turning on the light or changing the sound level using the tile in the switch menu. In such a scenario, it will not be possible to create a cycle or a condition, in it you can only link a separate action from the plugin (about them below) to the switch.
The designer of a single action on the example of creating a switch ModbusRTU .
A complex scenario is scenarios with complex logic, in which there are cycles and conditions.
A complex scenario on the example of working with Z-Wave devices .
Lazurite has a built-in server on which WCF-service is running. This is what allows client applications to get information about scenarios and perform some actions. But beyond that, another Lazurite server can connect to the Lazurite server and use remote server scripts. In order to use this functionality, you need to create a remote script .
Support for remote scripting allows you to create a network of devices with Lazurite installed. Those. in a single server script, you can invoke scripts or get script values from another server.
For example, in a large house, you can create a distributed system in which several nodes with Lazurite installed will stand on different floors (rooms, buildings) with which the central Lazurite device will communicate. The administrator will configure the system and decide how independent the slave devices will be, whether they will be used as simple executors or whether some autonomy will be incorporated in them.
Triggers are specific actions that are triggered by special conditions. They differ from the scenario in that they have no data type and do not have a "tile". The trigger for triggering the trigger is to change the selected script, i.e. if we want to perform any actions when the temperature changes, the humidity changes, the user appears at home, etc., then we will need to create a trigger for the appropriate scenario. The trigger constructor is a copy of the script constructor, you can create loops, conditions, actions there.
Any line added to the script constructor is an "action". Each plugin installed in Lazurite adds some new features to the program - actions. Any work with Z-Wave, Modbus, geolocation, etc. produced through this functionality. Accordingly, any action, like a script, has its own data type .
In Lazurite, you can configure access to view and change the value of the script. This may be necessary when we create a user in the system for our guest or when we just want to hide a script that performs auxiliary functions and should not be displayed to users.
The following items are available to configure security:
- "Forbid for any use";
- "Forbid for all groups except ..." - prohibition of using the script to users who are not in the selected groups;
- "Forbid for all users, except ..." - prohibition of using the script for all users, except for selected ones;
- "Deny for groups" - a ban on execution for selected user groups;
- "Disallow launch from network" - scripts with this restriction cannot be displayed in client applications and cannot be used as a "remote script";
- "Disable for quick launch menu" - the script will not be displayed in the quick launch menu;
- "Deny for users" - a ban on execution for selected users;
- "Forbid from using from another script / trigger" - the script cannot be executed in another script or trigger.
By default, any script is not allowed to run from the network and for the quick launch menu.
USERS AND GROUPS
Users in Lazurite are an integral part of the system. Without an account, users will not be able to access the necessary scripts and control devices in the house. If there were no authentication, then any person would connect to the system and execute any scripts, which is highly undesirable.
For convenience of setting the security of a script, users can be grouped together, for example, you can create a group of "Guests" and prevent this group from running certain scripts.
Z-Wave is a wireless communication protocol used in home automation. To implement the protocol, miniature low-power radio frequency modules are used. Now on the ZWave market there is a rather extensive list of devices, such as ZWave light bulbs, sockets, relay modules, switches, locks, temperature sensors (humidity, movement, leakage), thermostats, air conditioning control devices, etc. Multi-sensors are also common - devices that combine several sensors (for example, a light sensor, presence, temperature, door sensor, etc.), which is very attractive in terms of financial costs and location in the room.
In Lazurite, the ZWave module allows you to perform all standard device operations, such as deleting, adding devices, and resetting the controller. You can also use multiple ZWave controllers, the end user will not see the difference. For example, you can read the temperature from the sensor, which is connected to the controller "A", and start the air conditioner using the controller "B". There are no restrictions, any action and verification are carried out in standard ways and are added to the script designer .
Lazurite has a functionality that allows you to keep a history of the values of different scenarios (for example, the temperature in the living room, the humidity in the room, the level of UV light, the detection of movements). The user can select the scenarios according to which it is necessary to keep statistics, then look at the graphs of their dynamics for a certain period of time.
GEOLOCATION OF USER
At Lazurite present functionality of the GPS-tracker. Any client application sends geodata information to the Lazurite server, where this data can be processed, saved and displayed. The actions presented in the UserGeolocationPlugin plugin are designed to work with user geolocation and allow you to calculate values such as the distance of a user to a location, the location of a user in a specific location, etc.
Some actions require the presence of not only the user, but also a place, or "location", which must be entered and configured in the program. This place can be a home, work, city, subway station. Actions with this parameter are needed in order to perform any action on the appearance or distance of the user from this "location". The place has three parameters: center coordinates, radius and name.
In addition, you can keep a history of movements, if you add the appropriate script to the statistics .
The program has the ability to create scripts for exchanging messages between users and receive notifications from the system about various events.
In addition, there are various other functions, such as Wake-on-Lan , emulation of multimedia keys on Windows , sound control on Windows , work with Windows processes , control of Modbus devices , etc.
Learn how to create plugins here .
Further development of the system is currently seen as follows:
- the program architecture will be upgraded in such a way that it is possible to use ready-made engines or speech recognition services as plug-ins;
- Further decomposition and modernization of the functionality of plug-ins and scenarios in the future will allow you to create scripts from a tablet or smartphone;
- it is planned to create a video surveillance module that would include the functionality of video recording, video streaming to mobile devices, motion detection, etc.