1. Introduction #
One of the main goals of a smart home is saving time. Have you ever left the house in a rush because you were already late for work or a meeting? And then you suddenly remember all the things left on at home that need your attention – lights, heating, safety valves? Or when returning home, wouldn’t it be nice to activate all key devices with a single action?
At DOMIQ, we believe that simplifying daily routines is essential. In this tutorial, we’ll show you how to implement a home entry and exit scenario to make your home more comfortable.
After reading this tutorial, you should know:
- what a macro definition is;
- how to build ready-to-use functionality blocks in the DOMIQ system;
- how to build complex scenarios using macro definitions;
- how to trigger macros in several ways.
2. Structure #
This tutorial is more than just presenting the implementation of the entry/exit scenario. We want to teach you how to configure the DOMIQ/Base module so that a single configuration can be reused in various contexts without additional effort. So before describing the specific scenario, we’ll first explain how to build macro definitions – a powerful tool worth learning. This time investment will pay off. Let’s recap from the “Automatic Alarm” tutorial, where we explained what macros are:
What are macro definitions? #
- A macro definition (or macro for short) is technically a regular event definition, but created in a specific way that includes a custom identifier. Macros offer two key advantages:
- By wrapping many commands into one, you can reuse the macro elsewhere, avoiding repetition and saving time and Base module resources.
Let’s relate this to the exit scenario. Suppose it includes the following actions:
- Turning off all lights.
- Setting heating to economy mode.
- Closing safety valves: water and/or gas.
- Turning off selected sockets.
- Turning off music.
- Opening the entrance gate.
- Arming the alarm.
Of course, the list can vary depending on your needs.
The simplest way to implement this would be to define one event and assign each building action as a command.
Now imagine you also want to turn off all lights and music separately in a “going to sleep” scenario. Using the above approach, you would need to repeat part of the work already done for the exit scenario. That sounds like wasted time, right?
This is where macro definitions help. Think of them as ready-made functional blocks, like building blocks. So you have a “turn off lights” block, a “set heating to economy” block, a “turn off sockets” block, etc. Each macro contains specific commands that execute a function. You define them once and can trigger them from anywhere in the system.
As you can guess, the exit scenario will require several macros, which we’ll then wrap into one master macro.
3. Exit Scenario #
Single macro
We’ll start by showing how to create a macro definition. Technically, it differs from a regular event only in the Channel field, which contains a custom command instead of a predefined identifier. The Data field can also be freely defined.
Let’s say we want to create a macro to turn off lights. First, decide which identifier will trigger the macro. You have full freedom here, but we recommend using descriptive names that clearly define each macro. All names must be prefixed with C. and should not include Polish characters or spaces.
For lights, we propose the identifier lights. The macro definition would then be:
Channel: C.lights
Data: off
A quick note: the Data field is also arbitrary. We used off as an example. Similarly, for a macro to turn on lights, you could use the same Channel (C.lights) and set Data to on.
Important: Events in the Base module are processed by comparing strings. The unique event identifier is a combination of Channel and Data. Therefore, C.lights=on and C.lights=off are completely different events, each with its own list of actions.
Next, in the Actions section, define the commands assigned to the macro. We’ll skip that here, as it depends on your specific installation.
Repeat this process for each macro that will be part of the main exit macro. Example macros (example Channel and Data values):
Channel: C.alarmon, Data: 1
Channel: C.lights, Data: off
Channel: C.heating, Data: eco
Channel: C.valves, Data: off
Channel: C.sockets, Data: off
Channel: C.music, Data: off
Channel: C.gate, Data: open
Master macro #
Now, combine all macros into one master macro. We’ll call it exit. Its definition is:
Channel: C.exit
Data: 1
Then, in the Actions section, call the sub-macros:
- +Command -> Name: C.lights, Value: off
- +Command -> Name: C.heating, Value: eco
- +Command -> Name: C.valves, Value: off
- …and so on

4. Triggering #
The final step is to decide how the exit scenario will be triggered. Since the entire functionality is wrapped in a macro, triggering it becomes incredibly flexible – it’s just amatter of executing a single command! Below are a few ideas for how to trigger the exit macro:
Button by the door
The macro can be triggered by pressing a physical button near the door. Let’s assume this button is connected to a Shelly module named “hallway“. Then just define the following event:
Channel: E.SHELLY.hallway.input_event.0
Data: 1
Actions -> +Command -> Name: C.exit, Value: 1
Of course, your physical button could also be connected to other devices like the INT-IORS module via DOMIQ/Expander, to the Satel Integra alarm system input, or to the LCN system, etc.
Arming the alarm #
The exit scenario can also be triggered when the alarm is armed. In this case, skip the macro creation for arming the alarm described earlier. The event would look like:
Channel: E.IDS.armed.xx, where xx is the alarm zone number
Data: 1
Actions -> +Command -> Name: C.exit, Value: 1
This assumes manual alarm arming. If you want the alarm to be armed automatically (and trigger the exit scenario), refer to the “Automatic Alarm” tutorial available here:
https://domiq.pl/wiki/automatyczny-alarm/
Button in the Remote app #
You can also manually trigger the scenario from the Remote app. Here’s how (in the Remote tab):
- Add a Button element and double-click to edit.
- In the Label field, enter a description (e.g., “Exit Home“) and optionally choose an icon.
- In the Short Press tab -> +Command ->
Name: C.exit, Value: 1 - Done!
5. Entry Scenario #
For the home entry scenario, the approach is similar. The key is deciding when it should trigger. Here are some ideas:
- Disarming the alarm
- Time rules (e.g., at a specific time before your planned return)
- Button near the entrance
- Manually via the Remote app
Optional #
You can also modify the entry scenario. For example, some actions like turning on heating could be done ahead of time via a time rule. Others, like turning on lights, music, or opening valves, can happen directly upon entering. This improves the scenario’s flexibility.
6. Summary #
As you can see, executing a complex entry or exit scenario has been reduced to a single command in the system. It took a bit of setup, but now you have elegant, reusable functions that can be called from many places without duplication. It also makes scenario changes easy, since you only need to edit one place. Of course, your entry and exit macros can also be part of other macros — the flexibility is yours.