Je suis sous Domoticz Version: 2023.2.
Afin d'allumer 2 ampoules a certaines heures j'utilise un capteur de présence Ikéa.
J'utilisais un script depuis pas mal de temps, sans problème, mais depuis une semaine, il ne fonctionne plus du tout, sans que je n'ai rien modifié (Ou alors je ne sais pas trop comment... tant que domoticz fonctionne, je n'y touche pas !!!)
Code : Tout sélectionner
function timebetween(s,e)
timenow = os.date("*t")
year = timenow.year
month = timenow.month
day = timenow.day
s = s .. ":00" -- add seconds in case only hh:mm is supplied
e = e .. ":00"
shour = string.sub(s, 1, 2)
sminutes = string.sub(s, 4, 5)
sseconds = string.sub(s, 7, 8)
ehour = string.sub(e, 1, 2)
eminutes = string.sub(e, 4, 5)
eseconds = string.sub(e, 7, 8)
t1 = os.time()
t2 = os.time{year=year, month=month, day=day, hour=shour, min=sminutes, sec=sseconds}
t3 = os.time{year=year, month=month, day=day, hour=ehour, min=eminutes, sec=eseconds}
sdifference = os.difftime (t1, t2)
edifference = os.difftime (t1, t3)
isbetween = false
if sdifference >= 0 and edifference <= 0 then
isbetween = true
end
--~ print(" s:" .. s .. " e:" .. e .. " sdifference:" .. sdifference.. " edifference:" .. edifference)
return isbetween
end
commandArray = {}
Print "debut de script"
if devicechanged['Sensor'] == 'On' then
Print "switch on"
if timebetween("23:00:00","23:59:59") or timebetween("00:00:00","07:15:00") then
print "Heure et sensor ok"
if devicechanged['Lampe 1']=='Off' and devicechanged['Lampe 2']=='Off' then
commandArray[#commandArray+1]={['Sensor']='Off'}
commandArray[#commandArray+1]={['Lampe 1']='On'}
commandArray[#commandArray+1]={['Lampe 1']='Set Level:10'}
commandArray[#commandArray+1]={['Lampe 2']='On'}
commandArray[#commandArray+1]={['Lampe 2']='Set Level:10'}
commandArray[#commandArray+1]={['Lampe 1']='Off AFTER 180'}
commandArray[#commandArray+1]={['Lampe 2']='Off AFTER 180'}
end
else
print "Heure NOK"
end
end
return
J'ai fait les MAJ, relancer les services Domoticz, et cette erreur a lieu que je sois en trigger Device ou All...2023-12-06 16:37:00.463 Error: EventSystem: in Script #1: [string "function timebetween(s,e) ..."]:28: attempt to call a nil value (global 'Print')
Je suis un peu paumer... Merci par avance de votre aide !