75 lines
2.8 KiB
Lua
Executable File
75 lines
2.8 KiB
Lua
Executable File
require "scripts/lua/functions"
|
|
|
|
commandArray = {}
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
--recupere les minutes
|
|
-- ------------------------------------------------------------------------------
|
|
time=os.time()
|
|
minutes=tonumber(os.date('%M',time))
|
|
jour=tonumber(os.date('%w',time))
|
|
heures=tonumber(os.date('%H',time))
|
|
heurmin= heures * 60 + minutes
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- Determination de l'augmentation de la temperature exterieure
|
|
-- ------------------------------------------------------------------------------
|
|
if devicechanged['DETECTION_CAMERA1'] then
|
|
print("--------------Detection camera 1--------------------------------")
|
|
|
|
-- if (otherdevices['Presence'] == 'Off' or otherdevices['Vacances'] == 'On'
|
|
-- or heures <= 11 or heures >= 21
|
|
--) then
|
|
commandArray['SendNotification']='Alerte intrusion '..tostring(heures)..':'..tostring(minutes)..' #Attention Detection intrusion par camera 1#0'
|
|
-- end
|
|
|
|
-- print("------------------------------------------------------------------")
|
|
end
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- Detecteur de fumée, on allume les lumières et on ouvre les volets
|
|
-- ------------------------------------------------------------------------------
|
|
if devicechanged['DétecteurFuméeCuisine'] then
|
|
debug("--------------Detecteur fumée --------------------------------")
|
|
|
|
if (otherdevices['Presence'] == 'Off' or otherdevices['Vacances'] == 'On') then
|
|
commandArray['SendNotification']='Alerte détection de fumée '..tostring(heures)..':'..tostring(minutes)..' #Attention Detection fumée#0'
|
|
else
|
|
if uservariables['Dark'] == "True" then
|
|
commandArray['VoletsSalon'] = 'Off'
|
|
commandArray['LumieresSalon'] = 'On'
|
|
end
|
|
end
|
|
|
|
debug("------------------------------------------------------------------")
|
|
end
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- Réglage volume
|
|
-- ------------------------------------------------------------------------------
|
|
if devicechanged['VolumeSonoJasper'] then
|
|
print("--------------Volume Sono Jasper --------------------------------")
|
|
|
|
local slash = '\\'
|
|
|
|
--local val = os.capture(cmd2)
|
|
-- print(tostring(val))
|
|
local cmd = "/opt/domoticz/scripts/changevol.sh "
|
|
|
|
os.execute('/opt/domoticz/scripts/changevol.sh &')
|
|
print("Réglage volume " .. cmd)
|
|
|
|
print("------------------------------------------------------------------")
|
|
end
|
|
|
|
|
|
|
|
--debug("temperature lue par otherdevice "..otherdevices_svalues['Bureau'])
|
|
|
|
--debug(round(timeofday['SunsetInMinutes'] / 60, 0)..'H'..timeofday['SunsetInMinutes'] % 60)
|
|
--debug(round(timeofday['SunriseInMinutes'] / 60, 0)..'H'..timeofday['SunriseInMinutes'] % 60)
|
|
|
|
--debug("################################# SUNSET "..uservariables['Couche'])
|
|
|
|
return commandArray
|