Today, Yandex is sending 26 million links to the “security systems” request. So the subject of security is clearly interesting to a wide range of users. Activity in this segment is confirmed by the statistics of specialized exhibitions. For example, last year there were more than 200 participants and almost 17,000 visitors at MIPS / Securika.

Given that smart home solutions often have elements similar to security systems, such as motion sensors, light control, cameras and notifications, the idea of endowing them with appropriate functionality looks quite logical. This will simplify the hardware and use the programming flexibility of the automation controller to implement various scenarios.
')
In this material, we will explore what existing solutions based on the Z-Wave protocol can offer in this area and what they might have interesting compared to traditional products.
Fast and easy
Of course, in terms of convenience, it is best to use ready-made motion sensors and open the door / window for Z-Wave. The benefit of the range is very wide, and in most cases there are no problems with compatibility. This option is suitable for those who need to implement the required functionality with the least amount of time.
Adding a device to a home automation system is not easy, but very simple - we install a battery, connect it to the controller, fix it in the right place, change the name, distribute it in the right room and use it. Optionally, you can change the device settings, but usually everything works with factory settings. It is also worthwhile to note the advantages of the majority of models that, in addition to the main task, can act as sensors, for example, temperature, light, humidity.
The most interesting models on the market today are the Fibaro Motion Sensor (motion, temperature, illumination, disassembly (accelerometer)), Fibaro Door / Window Sensor (open, temperature, binary input), Philio MultiSensor (motion, open, temperature , illumination), Aeotec multi-sensor 4 in 1 (movement, illumination, temperature, humidity) and the novelty of this year - Aeotec multi-sensor 6 in 1 (movement, illumination, temperature, humidity, ultraviolet, vibration).
The battery CR123A, which lasts for a year or two, is usually responsible for the power supply of autonomous sensors. The need to replace it will tell you the controller. By the way, most devices are also equipped with additional special sensors for detecting dismantling and hacking.
I used the Fibaro Motion Sensor in the living room, which made it possible to realize the script to automatically turn on the light (halogen lamps at half brightness through a dimmer) when motion was detected in the dark. This device has a compact size - the diameter of the "ball" is less than 5 centimeters. A convenient compact mount makes it easy to choose the position of the device.

It was not possible to fix the “eyes” flashing when the sensor is triggered with different colors, but official photos quite accurately convey its appearance.

Well, in addition, this sensor provided the system with information about the temperature in the room. Also interesting is the scenario of switching on the main lighting for a more effective camera shooting when motion is detected in armed mode.
The second ready device in the system is the door opening sensor. There was no special need in this case, since a standard reed switch was installed on the front door. So we use this device to obtain data on the temperature in the bedroom, as well as turning on the light in the corridor at night, since the motion sensor in this case triggers with a significant delay, because it is located on the back of the same door) and is not so convenient.

In addition to sensors, in this scenario, relay modules and specialized sirens will be useful for switching on the light and sound alarms. The latter are not only powered from the network, but also from batteries or batteries. There are even external models with recharge from sunlight.
Note that this solution is also multifunctional - the motion sensor can work not only in security, but also to turn on the light or transfer the heating system in a particular room to an economical mode, the window sensor blocks the air conditioner when the window is opened, the wall code panel is useful for enable special lighting or temperature control modes.
Use a soldering iron
For those who are interested in working with their hands and who are not averse to saving money, you can offer a second option - use the Fibaro Universal Sensor module and connect traditional wired cables with motion sensors and / or reed switches to it. At the same time, one module supports two digital inputs at once. So if you do not need information about the movement in each room individually, and in the apartment or house there are already wiring and standard sensors, then the issue price is significantly reduced compared to the first option. True, there is no longer so interesting with additional features. Only the option of connecting to a universal sensor up to four Dallas DS18B20 1-Wire temperature sensors remains, which, however, is not bad either.

The module itself pleasantly surprises with its size - dimensions do not exceed 30x15x12 mm. Power supply - unipolar 9-30 V (the battery in the photo is only for estimating the size of the sensor). The operating temperature range is 0 .. + 40 degrees. The model has two digital inputs, two digital outputs, as well as a 1-Wire bus loop. For real use, it is advisable to install the sensor in the case. I got a fairly large box, but it was easy to solder.

Even one of the standard motion sensors can be used as a housing; there is usually more than enough space in them. In this case, it will only be necessary to give power to the common bus.

The line of such sensors, which were previously installed in the apartment, I connected to the first channel of the universal sensor. And the second entrance connected to the reed switch on the front door. This combination allows you to track the main events in demand - the movement in the apartment and the entrance.
Interesting scenarios for the use of this module are also the connection of wired street motion sensors and the implementation of a “panic button”. As you understand, in the latter case, practically any actions on the controller can be “hung up” on an event.
Connection to the existing security system
In the event that an alarm system is already implemented in a house or apartment, using the same Fibaro Universal Sensor or relay modules in most cases it will be possible to connect to it. This allows you to significantly expand the capabilities of the system, as well as implement scenarios that go beyond the standard framework. In this case, data exchange can take place in two directions. Connection options are usually described in the documentation.

The alarm system can report arming, which will automatically switch your "Smart Home" to the "Nobody's Home" mode. This, in particular, will be useful in terms of saving electricity. Similarly, you can program for this time active airing, turning off wireless networks, switching the video surveillance system to active mode, starting the cleaning with your vacuum cleaner robots, or cleaning the air with a quartz lamp. Here you can think up a lot of things, and considering the capabilities of the Fibaro Home Center 2 controller, and implement it.
The second possible type of message from the standard security system to the automation system is information about hacking. Here, your smart home can also do a lot of interesting things - send you an SMS or e-mail, turn on sound and light alarms and even send a picture of the attacker. Note that these functions usually do not require reconfiguration of the alarm itself, which can be significant in some installations.
Messages in the other direction may be equally useful. Through the relay, you can add new cables from the Z-Wave sensors to the alarm. So if necessary, your existing system can be expanded with wireless sensors, leakage, smoke sensors and other non-standard devices. True, in most cases, for effective use of this scheme, it will be necessary to reconfigure the signaling unit.
Can be implemented using the Z-Wave controller and the function of arming and disarming. True, here we must not forget about the security of the solution obtained. For example, if your system supports the popular “tablets” (Touch memory / Contact memory / iButton), you can do this — install the Z-Wave relay and switch this sensor (with the key connected) to the corresponding alarm input.
More features
If the options described above are few and you want not only to solder, but also to program in the Arduino IDE, then Z-Uno, which has 22 GPIOs, comes to the rescue. On one such board, it will be possible to implement several inputs and outputs at once, and you can think of a lot of applications for this scenario. For example, you can entrust Z-Uno with the task of controlling the door - an opening sensor, an electromechanical lock control, a bolt position control (will help answer the question “did I forget to close the door?”), Visitor count, motion sensor, ambient light control . And all this - on a single board and with simple integration into the automation system based on Z-Wave. Read more about this device in our recent
publication .

Another option that can clearly be claimed in the task described is the management of an access control panel, including indicators and matrix screens, a code panel, a reader of tablets or access cards. Unfortunately, the regular features of Z-Wave in this direction are not very interesting and convenient. Yes, and with devices that perform such tasks, things are not very good today.
For sweetness - programming
The traditional programming of security systems and access control systems, to put it mildly, is very sad. For example, a “proprietary” program is used with a local computer connection to the system. Some of them even have an outdated serial port as a programming interface, which most potential consumers have seen, if only in pictures or in old hacker films. There is also the option of downloading a configuration file from the device, then editing it on a computer (also in a special utility, an example in the following illustration) and then downloading it back to the system.

Work with a Z-Wave controller looks like a laptop versus a programmable calculator (if anyone remembers such devices) compared to this. Firstly, all operations for changing configurations and work patterns can be performed remotely and without interrupting the operation of the system. Secondly, even in the basic “cube-like” programming you can create quite complex algorithms for the operation of the automation system. And thirdly, the use of LUA practically removes restrictions from you and allows you to implement the most flexible and versatile options for the interaction of system elements.
In the basic version, we got the following configuration: a common bus for motion sensors in the apartment, a reed switch on the front door, a motion sensor in the corridor (there was no regular wired there), a sensor on the bedroom door and a camera in the corridor.

In the general case, having a programmable controller and sensors available, you yourself create the required algorithms for the system to work. When using Fibaro Home Center 2, you can start with the pre-installed features in the device. The main part of the settings is “embedded” in the system, and some are highlighted in the “Alarm Panel”.

In it, you can check the event log, as well as select the required actions when an alarm is triggered. There are several ready-made options in the list (for example, send notifications, turn on certain lamps or send pictures from cameras), or you can add your own scenes.
Each sensor that is able to work in the protection mode can, independently of other devices, be in two states - “normal” and “armed”. Depending on it, the triggering of the sensor leads to the generation of different events, which allows the device to be used in different scenarios.

In addition, you can exclude the sensor from the security system, as well as set additional timeouts for arming and disarming.
The arming and disarming operations are available both online through the Web interface and the mobile application, and can be performed from user scripts. Note that PIN code entry is required for disarming. There are no standard versions of the code panel or iButton in the system, but it can be implemented using external devices and scripts.
As we said above, the flexibility of the system allows for the same sensors and additional functions in the normal mode. For example, the script for switching on the night illumination may look like this.

Three conditions are checked here at once - movement, low lighting level and the off state of the lamp. To turn off the backlight you will need to add another simple script.

In reality, it is worthwhile to consider more flexible algorithms that take into account, for example, the time of day, or the state of other sensors.
Conclusion
As we see, the implementation of the security system based on the automation controller with the Z-Wave protocol is quite feasible. The solution has certain advantages over traditional products, including configuration flexibility, the possibility of multi-purpose use of sensors, remote control and programming, wireless connection of sensors without laying new cables, and gradual expansion of system capabilities.
At the same time, it is possible to create hybrid configurations - combinations of a Z-Wave controller with conventional sensors or with alarm units. Of the minuses, we note the complexity or even the impossibility of using third-party security systems with traditional remote monitoring services.