when somewone is home and it is nighttime the light outsite must go on 100% for 20 min. after the 20 min he must go back on the state that is has before.
ik cant gat the right solution. is there some one who could help me out.
Code: Select all
return {
on = {
timer = { 'at nighttime at 05:30 on mon, tue, wed, thu, fri',
'at nighttime at 07:00 on sat, sun',
'at sunrise',
'at sunset',
'at 20:25',
'at 15 minutes before sunset',
'at 22:00 at nighttime on mon, tue, wed, thu, fri, sat, sun',
'at 23:00 at nighttime on mon, tue, wed, thu, fri, sat, sun' },
devices = { 'PowerOff',
167,
117,
185}
},
logging = {
level = domoticz.LOG_INFO,
marker = "Verlichting"
},
execute = function(domoticz, item)
local Binnen_Lampen = domoticz.groups('Binnen-Lampen') --domoticz.devices('Keuken')
local Buiten_Lampen = domoticz.groups('Buiten-Lampen') --domoticz.devices('Keuken')
local Harmony_off = domoticz.devices(109) --domoticz.devices('Woonkamer')
local Lamp_Buiten_voordeur = domoticz.devices(184)
local Minke = domoticz.devices(167)
local Klaas = domoticz.devices(117)
local Lamp_Buiten_voordeur_schakelaar = domoticz.devices(185)
if (item.isTimer) then
if (domoticz.time.matchesRule('at 05:30')) then
Binnen_Lampen.switchOn()
Buiten_Lampen.switchOn()
domoticz.log(Binnen_Lampen.name ..' groep is '.. Binnen_Lampen.state ..' geschakelt', domoticz.LOG_INFO)
domoticz.log(Buiten_Lampen.name ..' groep is '.. Buiten_Lampen.state ..' geschakelt', domoticz.LOG_INFO)
elseif (domoticz.time.matchesRule('at 08:20')) then
Binnen_Lampen.switchOn()
Buiten_Lampen.switchOn()
domoticz.log(Binnen_Lampen.name ..' groep is '.. Binnen_Lampen.state ..' geschakelt', domoticz.LOG_INFO)
domoticz.log(Buiten_Lampen.name ..' groep is '.. Buiten_Lampen.state ..' geschakelt', domoticz.LOG_INFO)
elseif (domoticz.time.matchesRule('at sunrise')) then
Binnen_Lampen.switchOff()
Buiten_Lampen.switchOff()
domoticz.log(Binnen_Lampen.name ..' groep is '.. Binnen_Lampen.state ..' geschakelt', domoticz.LOG_INFO)
domoticz.log(Buiten_Lampen.name ..' groep is '.. Buiten_Lampen.state ..' geschakelt', domoticz.LOG_INFO)
elseif (domoticz.time.matchesRule('at 15 minutes before sunset') and domoticz.time.matchesRule('at 00:00-22:00')) then
Binnen_Lampen.switchOn()
Buiten_Lampen.switchOn()
domoticz.log(Binnen_Lampen.name ..' groep is '.. Binnen_Lampen.state ..' geschakelt', domoticz.LOG_INFO)
domoticz.log(Buiten_Lampen.name ..' groep is '.. Buiten_Lampen.state ..' geschakelt', domoticz.LOG_INFO)
elseif (domoticz.time.matchesRule('at 22:00')) and (Harmony_off.state == "On") then
Binnen_Lampen.switchOff()
domoticz.log(Binnen_Lampen.name ..' groep is '.. Binnen_Lampen.state ..' geschakelt', domoticz.LOG_INFO)
domoticz.log('22 uur lampen gaan uit', domoticz.LOG_INFO)
elseif (domoticz.time.matchesRule('at 23:00')) and (Harmony_off.state == "On") then
Binnen_Lampen.switchOff()
domoticz.log(Binnen_Lampen.name ..' groep is '.. Binnen_Lampen.state ..' geschakelt', domoticz.LOG_INFO)
domoticz.log('23 uur lampen gaan uit', domoticz.LOG_INFO)
elseif (domoticz.time.matchesRule('at 23:00')) then
Buiten_Lampen.switchOff()
domoticz.log(Buiten_Lampen.name ..' groep is '.. Buiten_Lampen.state ..' geschakelt', domoticz.LOG_INFO)
domoticz.log('Buiten verlichting gaat gaan uit', domoticz.LOG_INFO)
end
elseif (item.isDevice) then
if (Klaas.state == "On") and (domoticz.time.matchesRule('at daytime')) then
Lamp_Buiten_voordeur.dimTo(100).forMin(1)
domoticz.log('Buitenlamp gaat aan voor x minuten klaas komt thuis', domoticz.LOG_INFO)
else
domoticz.log('trigger klaas', domoticz.LOG_INFO)
end
if Minke.state == "On" and (domoticz.time.matchesRule('at daytime')) then
Lamp_Buiten_voordeur.dimTo(100).forMin(1)
domoticz.log('Buitenlamp gaat aan voor x minuten minke komt thuis', domoticz.LOG_INFO)
else
domoticz.log('trigger minke', domoticz.LOG_INFO)
end
if Harmony_off.state == "On" and (domoticz.time.matchesRule('at 22:01-05:00')) then
domoticz.log('tv gaat uit en lampen straks ook', domoticz.LOG_INFO)
Binnen_Lampen.switchOff().afterMin(10)
end
end
end
}