J'ai mis en place un script qui permet d'allumer un groupe d'ampoules pour x minutes grâce a un détecteur.
J'ai maintenant besoin de faire la même chose mais avec deux détecteurs pour un eclairage exterieur qui s'allume si porte ouverte ou portail ouvert.
Voici le script :
Code : Tout sélectionner
-- chargement des modules
package.path = package.path..";/home/nico/domoticz/scripts/lua/?.lua"
require "modules"
time = os.date("*t")
t1 = os.time()
s = otherdevices_lastupdate['PIR Porte RDC']
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)
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
absence = (os.difftime (t1, t2))
Lux = otherdevices_svalues['Luminosite Exterieur']:match("([^;]+)")
Lux = tonumber(Lux)
commandArray = {}
if absence > 300 and (otherdevices['Lumiere Porche'] == 'On' or otherdevices['Eclairage Exterieur'] == 'On') then
groupOff('Eclairage Exterieur')
elseif (devicechanged['PIR Porte RDC'] == 'On' or devicechanged['Etat Portail'] == 'On') and (otherdevices['Lumiere Porche']=='Off' or otherdevices['Eclairage Exterieur']=='Off') and Lux <= 300 then
groupOn('Eclairage Exterieur')
end
return commandArrayAlors biensur, je pourrais faire un script qui active un dummy grace aux deux vrais capteurs, et ainsi check le lastseen du dummy mais c'est degueu.
Une idée svp ?