
The Presence Switch (JEK) is a Python plugin for Domoticz that automatically controls selected Domoticz devices based on presence monitoring configured in the Smart Home section of an OpenWrt router.
The plugin allows various electrical appliances, lights and other switchable devices to be controlled depending on whether the users belonging to a specified presence group are at home or away.
Presence detection is performed by the OpenWrt router, while the Domoticz plugin executes switching operations based on the information received. The system operates entirely on the local network, without requiring external cloud services.
The plugin periodically queries the OpenWrt router's presence monitoring service and checks the status of the configured presence group.
Based on the received information, two states are distinguished:
For each state, you can independently specify which Domoticz devices should be switched on and which should be switched off.
The plugin checks the current state of each device and only sends a switching command if the device is not already in the required state.
In automatic mode, these checks are performed periodically according to the Domoticz plugin execution cycle. This allows the system to restore the configured device states whenever necessary.
The Presence Switch is an open-source application available free of charge on GitHub.
Domoticz-JEK-Presence-Switch – GitHub
Navigate to the Domoticz plugins directory. The exact location depends on your Domoticz installation.
Download the complete project from GitHub using the following command:
git clone https://github.com/szelessavalapitvany/Domoticz-JEK-Presence-Switch.git JEK
This command creates a directory named JEK and downloads the project files into it.
The Python plugin file should be located in the following directory structure:
domoticz/plugins/JEK/plugin.py
Additional files, including translation files, should be installed while preserving the project's directory structure.
On Linux systems, set the executable permission for the Python plugin file if necessary:
cd JEK chmod +x plugin.py
The plugin includes a separate HTML-based user interface. The required files must be placed in the appropriate Domoticz directory for custom web interfaces.
The user interface can be accessed in Domoticz using the following path:
#/Custom/JEK_Jelenlet_kapcsolo_Show_switch
The HTML interface can only be used after a plugin instance has been created in Domoticz.
After installing the plugin files, restart the Domoticz service.
For systems using systemd:
sudo systemctl restart domoticz.service
For OpenWrt systems:
/etc/init.d/domoticz restart
Open the Domoticz web interface and navigate to Setup → Hardware.
Select Presence Switch from the hardware type list and assign a name to the new hardware instance.
Configure the connection parameters, presence group name and devices to be controlled, then add the hardware.
The plugin creates the required Domoticz devices, including a selector switch named Presence-based switch.
The following connection parameters can be configured:
By default, the plugin uses the IP address 192.168.1.1 and port 8080. These values should be adjusted to match your network configuration.
In the Presence name field, enter the name of a presence group previously created in the OpenWrt router's presence monitoring service.
The presence group and its monitoring settings must be configured in the Smart Home section of the OpenWrt router.
The plugin does not perform presence detection itself. Instead, it uses the results provided by the router's presence monitoring service.
The plugin supports four independent device lists:
| Setting | Function |
|---|---|
| On arrival ON | Devices to switch on when presence is detected |
| On arrival OFF | Devices to switch off when presence is detected |
| When leaving ON | Devices to switch on when presence is no longer detected |
| When leaving OFF | Devices to switch off when presence is no longer detected |
Devices must be specified using their unique Domoticz device identifiers (IDX).
Multiple devices can be entered in each list, with their identifiers separated by commas:
1051,617,1054
Any list can be left empty if no devices need to be controlled for that particular action.
Avoid assigning the same device to both the ON and OFF lists for the same presence state, as this could result in conflicting switching commands.
The Logging Level setting determines the amount of information recorded in the Domoticz log.
For normal operation, the Normal setting is recommended. For troubleshooting, Verbose or one of the available Debug modes can be selected.
After installation, the plugin creates a selector switch named Presence-based switch in the Domoticz system.
The selector provides two operating modes:
When automatic switching is disabled, devices remain in their last configured states. The plugin does not automatically switch them off.
In automatic mode, the plugin periodically checks the devices and restores the required states whenever necessary.
The plugin includes a separate HTML-based user interface accessible through the Domoticz custom interface menu.
The interface allows users to review and manage the plugin's configuration.
It can also be opened using the HTML setup! link in the plugin hardware configuration.
The HTML interface can only be used after the corresponding plugin hardware has been added to Domoticz.
Presence-based automation can be used for a wide range of smart home functions.
The Presence Switch is part of the Szélessáv Smart Home project, which focuses on local, cloud-independent smart home automation.
Both presence monitoring and device switching are performed within the local network.
No external cloud service or internet connection is required for normal operation, provided that the local network and the necessary services are available.
The source code of the Presence Switch is publicly available in the GitHub repository of the Szélessáv Public Benefit Foundation.
Domoticz-JEK-Presence-Switch – Source Code and Downloads
An installation cloned from GitHub can be updated from the plugin directory using:
git pull
It is recommended to create a backup of the existing configuration before updating. A Domoticz restart may be required after installing an update.