Files
Domoticz/lua/script_time_variables_HeureCreuse.lua
2025-03-06 11:09:58 +01:00

49 lines
1.7 KiB
Lua
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
require "scripts/lua/functions"
----------------------------------------------------------------------------------------------------------
-- Script parameters
----------------------------------------------------------------------------------------------------------
-- Setting the time variables:
-- %a abbreviated weekday name (e.g., Wed)
-- %A full weekday name (e.g., Wednesday)
-- %b abbreviated month name (e.g., Sep)
-- %B full month name (e.g., September)
-- %c date and time (e.g., 09/16/98 23:48:10)
-- %d day of the month (16) [01-31]
-- %H hour, using a 24-hour clock (23) [00-23]
-- %I hour, using a 12-hour clock (11) [01-12]
-- %M minute (48) [00-59]
-- %m month (09) [01-12]
-- %p either "am" or "pm" (pm)
-- %S second (10) [00-61]
-- %w weekday (3) [0-6 = Sunday-Saturday]
-- %x date (e.g., 09/16/98)
-- %X time (e.g., 23:48:10)
-- %Y full year (1998)
-- %y two-digit year (98) [00-99]
-- %% the character `%´
year = tonumber(os.date("%Y"));
month = tonumber(os.date("%m"));
day = tonumber(os.date("%d"));
hour = tonumber(os.date("%H"));
min = tonumber(os.date("%M"));
weekday = tonumber(os.date("%w"));
commandArray = {}
-- ----------------------
-- Heures creuses
-- ----------------------
if (min%10 == 0) then
debug('######### Lancement du check Heures Creuses ' ..hour..'h'..min)
if ((hour > 21 or (hour == 21 and min >= 30)) or (hour < 5 or (hour == 5 and min <= 30))) then
--switchIfNeeded('Variable:HeuresCreuses', 'On')
commandArray['Variable:HeuresCreuses'] = 'On'
else
commandArray['Variable:HeuresCreuses'] = 'Off'
end
end
return commandArray