je n'y arrive pas:
dans ce script dz vents :
Code : Tout sélectionner
return {
on = {
devices = {'lumiére véranda'},
timer = {'at 08:00 - 22:00'},
},
logging = {
level = domoticz.LOG_INFO,
marker = "lumiére véranda ",
},
execute = function(domoticz, lumi)
domoticz.log(lumi.state, domoticz.LOG_INFO)
domoticz.log (tonumber(domoticz.devices('lumiére véranda')) , domoticz.LOG_INFO)
[i] if (tonumber(domoticz.devices('lumiére véranda')) > 1000) then[/i]
domoticz.devices('LedVer1').switchOff()
else
domoticz.devices('LedVer1').switchOn()
end
end
}dans if ....
j'essaie de tester la condition (>1000) , la fonction "tonumber" donne nil et rend le test impossible.
dans le LOG:
Code : Tout sélectionner
2021-12-11 16:12:42.647 Status: dzVents: Info: Handling events for: "lumiére véranda", value: "641"
2021-12-11 16:12:42.647 Status: dzVents: Info: lumiére véranda : ------ Start internal script: Script essai: Device: "lumiére véranda (ZWAVE)", Index: 11
2021-12-11 16:12:42.647 Status: dzVents: Info: lumiére véranda : 641
2021-12-11 16:12:42.647 Status: dzVents: Info: lumiére véranda : nil
2021-12-11 16:12:42.647 Status: dzVents: Info: lumiére véranda : ------ Finished Script essai
2021-12-11 16:12:42.647 Error: dzVents: Error: (3.1.7) lumiére véranda : An error occurred when calling event handler Script essai
2021-12-11 16:12:42.647 Error: dzVents: Error: (3.1.7) lumiére véranda : ...oticz/scripts/dzVents/generated_scripts/Script essai.lua:13: attempt to compare number with nilJ'ai essayé toutes les syntaxes possibles sans résultat.
même utiliser une variable intermédiaire (num = tonumber('lumiére véranda')) ne fonctionne pas.
ça a l'air tout bête, je fais probablement une erreur quelque part ?
Merci de votre aide.