first commit

This commit is contained in:
Souti
2025-03-06 11:09:58 +01:00
commit 11f7d440ff
330 changed files with 38306 additions and 0 deletions

46
templates/Device.Lua Normal file
View File

@@ -0,0 +1,46 @@
--
-- Domoticz passes information to scripts through a number of global tables
--
-- device changed contains state and svalues for the device that changed.
-- devicechanged['yourdevicename'] = state
-- devicechanged['svalues'] = svalues string
--
-- otherdevices, otherdevices_lastupdate and otherdevices_svalues are arrays for all devices:
-- otherdevices['yourotherdevicename'] = "On"
-- otherdevices_lastupdate['yourotherdevicename'] = "2015-12-27 14:26:40"
-- otherdevices_svalues['yourotherthermometer'] = string of svalues
--
-- uservariables and uservariables_lastupdate are arrays for all user variables:
-- uservariables['yourvariablename'] = 'Test Value'
-- uservariables_lastupdate['yourvariablename'] = '2015-12-27 11:19:22'
--
-- other useful details are contained in the timeofday table
-- timeofday['Nighttime'] = true or false
-- timeofday['SunriseInMinutes'] = number
-- timeofday['Daytime'] = true or false
-- timeofday['SunsetInMinutes'] = number
-- globalvariables['Security'] = 'Disarmed', 'Armed Home' or 'Armed Away'
--
-- To see examples of commands see: http://www.domoticz.com/wiki/LUA_commands#General
-- To get a list of available values see: http://www.domoticz.com/wiki/LUA_commands#Function_to_dump_all_variables_supplied_to_the_script
--
-- Based on your logic, fill the commandArray with device commands. Device name is case sensitive.
--
commandArray = {}
-- loop through all the changed devices
for deviceName,deviceValue in pairs(devicechanged) do
print ("Device based event fired on '"..deviceName.."', value '"..tostring(deviceValue).."'");
-- if (deviceName=='myDevice') then
-- if deviceValue == "On" then
-- print("Device is On")
-- elseif deviceValue == "Off" then
-- commandArray['a device name'] = "On"
-- commandArray['another device name'] = "Off AFTER 10"
-- commandArray['Scene:MyScene'] = "Off"
-- commandArray['Group:My Group'] = "Off AFTER 30"
-- end
-- end
end
return commandArray