This page is created to give an overview of all the possible commands and variables in Lua that can be used in Domoticz.

This Lua time script will run every minute (if named script_time_ping.lua) and checks the status of a device by sending one IP ping command to its IP address. Domoticz provides a wide range of capabilities in controlling your devices, but when further integration is needed, scripting opens up a tremendous degree of control for advanced users.

C++. This is a script is used to determine if anyone is still upstairs, it is a time based script that runs every minute and it uses two motion detectors to determine if there is any movement upstairs, and which direction (up or down) the last person was heading, if there is no motion upstairs, and the last person was heading downstairs it turns off all lights in the group "scene:lights_upstairs" when 30 minutes have passed. See also. The script example above has the potential of locking the Domoticz's event system for up to 10 seconds in case that the assert function doesn't return within that time. Using time difference in seconds between time that script runs (t1) and the time the door status was last seen.

Fill in the MAC-address (Bluetooth!) Example use-cases are turning on the lights in specific parts of the hallway depending on motion detectors and door magnet sensors. Optional 2nd param fallback will be returned if json is nil or invalid. LUA commands and variables list for use in DomoticzUpdate (one or more) numerical devices without using the device idx codeFunction to dump all variables supplied to the scriptLUA commands and variables list for use in Domoticz-- command will be repeated 5 times with 5 seconds interval-- every 4 seconds and do that 9 times, put device On for 2 seconds'subject#body#prio#sound#extraData#subSystem1;subSystem2;subSystem3'-- This is equal to 'Send camera snapshot with subject "Subject of Message" after 5 seconds. This simple script sends a "wake on lan" event to a predefined host using the command "etherwake" on linux. 600 seconds for 10 minutes, one notification is enough so make sure to put in an end value as well (<700) otherwise a notification will be sent every minute when the script is evaluated. C. VectorLibrarySample.

2. if you also want to use Bluetooth detection Variable name: the name of the group, I would recommend letters, numbers and underscores only the purpose of: commandArray['wakeup-server'] = 'Off' is to make sure that the wake on lan event only gets triggered once, since the script lacks any state checking capability Turns a xml string to a Lua table. This page is created to give an overview of all the possible commands and variables in Lua that can be used in Domoticz. The idea is simple: By giving a device (real or dummy) in Domoticz a name constructed by adding a pre-determined prefix to an existing device/group name, Lua is used to detect when *any* device with that prefix changes state and to carry out a specific action on an existing physical device/group defined already in Domoticz (and named with… nil = if you just want to use the ping command. It neither has to be detectable. ''turning off, no movement upstairs for more than 30m'Using Ping command to check the status of a network deviceUsing Ping & Bluetooth to check the status of a network deviceMotion detector 30 minute time-out (presence detection)--print('No motion has been detected for: ' ..no_motion_minutes.. ' minutes')--change the 30 to the amount of minutes you preferAdvanced motion detection with multiple detectors, switches and configurable timeouts-- The hallway_floor_0 is the variable name chosen earlier-- The detectors below can be anything that turns "On" when there's activity-- Store the no motion counter in the variable again-- If we have reached the timeout, disable the linked switches-- The hallway_floor_0 is the variable name chosen earlier-- The detectors below can be anything that turns "On" when there's activity-- Loop through all the changed devices sent by the trigger-- Check if it is one of the detectors and is set to "On"-- If one of the sensors was turned on, enable the light and reset the no motion variable the argument to etherwake is the mac address of the computer to be woken. There is already a lot of information available on the forum, but this is scattered throughout. The number (1) in this case is the ID of the camera, not the name!-- for updating Dummy devices e.g. Just add more lines.

This code has 3 devices but you can expand with as many as you want. With the script, Domoticz looks if the motion sensor stays in the 'Off' status for more than 30 minutes.The script above needs a uservariable called 'nomotionCounter', type 'Integer' and value '0' (zero).To create a more advanced motion detection system this script allows you to combine multiple detectors with multiple switches. [HC2] Lua scene – examples. My motion sensors are X10, check the motion status on your pirs using: for i, v in pairs(devicechanged) do print(i, v) end For every device create a user variable in Domoticz (set value to 1)

Send a warning when the garage door has been open for more than 10 minutesUsing Ping command to check the status of a network deviceUsing Ping & Bluetooth to check the status of a network deviceMotion detector 30 minute time-out (presence detection)Advanced motion detection with multiple detectors, switches and configurable timeoutsSend a warning when the garage door has been open for more than 10 minutes'Garage door alert#The garage door has been open for more than 10 minutes! The script runs every minute if you name the script "script_time_1. Example: local t = domoticz.utils.fromJSON('{ "a": 1 }'). Description. There is already a lot of information available on the forum, but this is scattered throughout.

However this will "hold up" the script for 3 seconds. For an introduction and overview/tutorial specific to Domoticz, see this wiki page: Scripting in Domoticz. Retrieved from "https://www.domoticz.com/wiki/index.php?title=Category:LUA&oldid=6598" Next to that, the syntax is not always clear. You don't need to pair your device. Table of contents. For every device create a dummy switch in Domoticz

2.