Lorsque j'ai voulu repondre à ta question, et bien en fait, je n'ai meme pu entrée dans http://192.168.x.x:8080/#/Events
J'ai du faire un restart de domoticz.
Je me suis appercu du probleme avec ce genre de script, puisque la lumiere ne s'allume plus.
Code : Tout sélectionner
--
-- ##### Configuration start here ####
-- Define morning hour
morning = 1
-- Define night hour
night = 23
-- Define motion sensor
local motion_sensor = 'Mouvement_chaufferie_tempo'
-- Define light bulb
local light_bulb = 'Eclairage_chaufferie'
-- To turn debug on set to true
debug=true
-- #### Configuration stop here ####
s = otherdevices_lastupdate[motion_sensor]
time = os.date("*t")
t1 = os.time()
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
commandArray = {}
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t1, t2))
if (devicechanged[motion_sensor] == 'On') then
if (debug) then print("Motion on") end
if (otherdevices[light_bulb] == 'Off') then
if (time.hour < morning or time.hour > night) then
if (debug) then print('its nighttime') end
commandArray[1]={[light_bulb]='On'}
--commandArray[2]={[light_bulb]='Set Level 1'}
else
if (debug) then print('its daytime') end
commandArray[1]={[light_bulb]='On'}
-- commandArray[2]={[light_bulb]='Set Level 40'}
end
end
end
if (otherdevices[light_bulb] ~= 'Off' and otherdevices[motion_sensor] == 'Off' and difference > 60) then
if (debug) then print('Turning ' .. light_bulb .. ' Off after '..difference..'.') end
commandArray[light_bulb]='Off'
end
return commandArray