This simple script sends a "wake on lan" event to a predefined host using the command "etherwake" on linux. 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.
1.2.1 Function to dump all variables supplied to the script; 1.3 Date and Time. This is a bit short, i would like to extend it to a longer period. It is not unlikely that at some point you want to share Lua code among your scripts. Il en existe de 4 types différents basés sur les événements qui surviennent sur le matériel, le temps, les variables, le panel de sécurité. Updates: Note: As of version V3.7968 there is a new Lua-based event system for Domoticz called dzVents which makes writing events very simple and almost trivial. Note that it goes to "Group On" when on! ''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 1. 5.
This page is created to give an overview of all the possible commands and variables in Lua that can be used in Domoticz. 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! Let’s jump right in! If you want it can also check by Bluetooth. Two functions, time and date, do all date and time queries in Lua.
E.g. Example use-cases are turning on the lights in specific parts of the hallway depending on motion detectors and door magnet sensors.
( but you can create a new one with- or without an offset) Shared helper functions.
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 there is also a manual switch downstairs that turns on the ceiling light on the top floor, and to allow time for someone to make it up the stairs I never turn off the lights if the ceiling light was switched on within the last two minutes (120s), if you turn on the ceiling light upstairs, but never go up, it will automatically turn off the next time the script runs after two minutes. User variables enable users to store custom variables in the domoticz database. Remember, a long long time ago, before you went on a long holiday, you had to install a couple of electric timer switches in your house, to simulate you’re home, and mislead buglers from breaking in to your house?
(In most systems, that number is the number of seconds since some epoch.) Paste the following script but modify the variables at the top: the events system in Domoticz uses a scripting engine called Lua, which is used in many popular software titles like Photoshop and World of Warcraft. The feature is a little hidden in the GUI, and not very wel documented, but I think it is a very nice feature !
1.1 General. Check out 'dzVents': next generation LUA scripting.
My motion sensors are X10, check the motion status on your pirs using: for i, v in pairs(devicechanged) do print(i, v) end Par événement on entend toute modification qui survient. Note: it is currently not possible to change the domoticz.time object instance. commandArray = {} ping_success = os.execute ('ping -c1 192.168.1.156') if ping_success then print ("ping success") commandArray ['Ping'] = 'On' … You don't need to pair your device. However this will "hold up" the script for 3 seconds. 5. 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. Should the test be performed more often then once a minute a shell script can be used which can be found This Lua script checks the presence of a device by using the ping command.
For every device create a dummy switch in Domoticz