Bonjour,
j'essaie en vain de modifier ton script pour coller à mes besoin mais j'y arrive pas
j'utilise dans la chambre de mon fils un xiaomi wireless bouton qui fonctionne avec le script suivant :
Code : Tout sélectionner
-- chargement des modules
dofile('/var/packages/domoticz/target/var/scripts/lua/modules.lua')
commandArray = {}
if (devicechanged['BP Xiaomi CH Alex']=='Click' and otherdevices['Chambre Alexandre']=='Off') then
switchOn('Chambre Alexandre',100)
elseif (devicechanged['BP Xiaomi CH Alex']=='Click' and otherdevices['Chambre Alexandre']~='Off') then
switchOff('Chambre Alexandre')
end
return commandArray
je voulais ajouter une condition d'heure pour allumer les lumières à 30% entre 21h et 6h
mais ça ne fonctionne pas
Code : Tout sélectionner
commandArray = {}
if (devicechanged['BP Xiaomi CH Alex']=='Click' and otherdevices['Chambre Alexandre']=='Off') then
if (os.date('%H') > '21' and os.date('%H') < '6' ) then
switchOn('Chambre Alexandre',30)
elseif (os.date('%H') > '6' and os.date('%H') < '21' ) then
switchOn('Chambre Alexandre',100)
elseif (devicechanged['BP Xiaomi CH Alex']=='Click' and otherdevices['Chambre Alexandre']~='Off') then
switchOff('Chambre Alexandre')
end
end
return commandArray
ou
Code : Tout sélectionner
commandArray = {}
if (os.date('%H') > '21' and os.date('%H') < '6' ) and (devicechanged['BP Xiaomi CH Alex']=='Click' and otherdevices['Chambre Alexandre']=='Off') then
switchOn('Chambre Alexandre',30)
elseif (os.date('%H') > '6' and os.date('%H') < '21' ) and (devicechanged['BP Xiaomi CH Alex']=='Click' and otherdevices['Chambre Alexandre']=='Off') then
switchOn('Chambre Alexandre',100)
elseif (devicechanged['BP Xiaomi CH Alex']=='Click' and otherdevices['Chambre Alexandre']~='Off') then
switchOff('Chambre Alexandre')
end
return commandArray
j'avais dans l'idée de d'initier une variable
Si + 21h variable Lumière = 30
Si non + 6h variable Lumière = 100
puis à la ligne switchOn('Chambre Alexandre',$Lumière)
est ce que mon raisonnement est juste?
Bref je ne suis pas au top avec le LUA (ça doit ce voir

) si vous avez des conseils ou des pistes je suis preneur
Merci