Executing the "I came" scenario when opening the front door

Surely many people have seen in movies how when entering an apartment, lights, music automatically turn on, curtains come off. It would seem that it could be easier than to execute a pre-written scenario when the door opening sensor is triggered. But, as often happens, the devil is in the details - with this approach, our script will be executed at every opening, and this spoils everything. In this article, we will look at the correct implementation of the automatic launch of the "I came" script upon returning home.

YouTube: https://youtu.be/t-rUk-E-WG8

VK: https://vk.com/video-211035547_456239138


For example, consider a small apartment with only 5 lighting groups. They can be managed by:

- push-button switches,
- master switch,
- the "I came" scenario button,
- through the Yandex Alice voice assistant.

   Let's assume that when "I came" is closed, the hallway and living room lights turn on. You can find out how to do this in the article on configuring the scripts of the SE 8i module.

We need to press this button only when we open the front door to the apartment and there is no one at home. To perform this action, we will need the SEQUENTATUS module. Its main task is to store information about the presence of people at home, display this status in Yandex Alice, and automatically press the "I came" buttons./"I'm gone."


The logic of the module's operation is incredibly simple — when the Input 1 is closed for a long time (the "I left" button), the module immediately closes the Output 1 for 2 seconds and after 5 minutes sets the internal state "No one is home". When the door opening sensor is triggered, the module checks its internal state and, if it is equal to "No one is home", switches to the "Home" state, closing the Entrance for 2 seconds ("I came"). That's all.

As a door opening sensor, any one used in burglar alarms is suitable. For example, ST-DM125NO-WT.
The final connection diagram of the module is given below.
When opening the front door, you can not only run the "I came" script configured for the SE 8i module, but also play Alice's voice greeting. To do this, follow these steps::

- in your personal account on the website alice.smart-elec.ru configure the SE HomeStatus module to display information about the presence of people at home in Yandex.Alice,
- in the Smart Home app, create a scenario with a welcome at the Yandex Station when people arrive at home.

Information about the presence of people will be displayed in the Smart Home application in the form of a switch or motion sensor, which we called "People". 5 minutes after pressing the "I left" button, the switch will turn off, and when the front door is opened, it will turn on. It is this activation event that will trigger the playback of the message. Screenshots of all the setup steps are provided below.

If some actions need to be performed only at a certain time, then you will additionally need to configure a modular trigger for this task. Modular triggers are designed to automatically perform a set of actions when the input or output state of the module changes to the required one. It should be remembered that modular triggers relate to Online automation. For this reason, they will only work if there is an internet connection. In our case, we will set up the lighting in the living room if the time is greater than sunset time and less than 23:00.

   First, we need to go to the Online Automation section. This page will display all our scripts (sets of commands), which in the future we will be able to run at a specified time, with HTTP requests or, as in our case, with a modular trigger.
Let's create a script here with the name "The Light when I came". We will add commands to enable the necessary lighting groups in the living room.

Please note that there should be a check mark next to the "Activate" item. If it is not present, the script will not be executed.


Next, go to the "Modular Trigger" section.


Here we will create a trigger that will execute our lighting switch script if we come home after sunset, but before 23:00. We can find out that someone has come home from the SE HomeStatus module with the address 41.

The SEQUATUS module can be used to solve other interesting tasks. For example, to control the street lighting in the courtyard of a private house. The light can turn on automatically when the owners approach the house or according to the schedule. More information about this can be found in the following articles.