Forum dédié aux problématiques concernant les scripts pour DomoticZ.
Entourez votre code et les logs avec les balises nommées code grâce au bouton <\>.
commandArray = {}
if (devicechanged['Interrupteur Anna'] == '1 Click' and otherdevices['Virtuel Anna'] == 'Off') then
commandArray['Virtuel Anna']='On'
commandArray['Group:Lumiere blanche Anna1']='On'
commandArray['Interrupteur Anna']='Set Level: 40'
else
if (devicechanged['Interrupteur Anna'] == '1 Click' and otherdevices['Virtuel Anna'] == 'On') then
commandArray['Group:Lumiere blanche Anna1']='Off'
commandArray['Group:Lumiere blanche Anna2']='Off'
commandArray['Group:Lumiere blanche Anna rgb']='Off'
commandArray['Group:Lumiere violette Anna']='Off'
commandArray['Virtuel Anna']='Off'
commandArray['Interrupteur Anna']='Set Level: 40'
end
end
if (devicechanged['Interrupteur Anna'] == '2 Click' and otherdevices['Virtuel Anna'] == 'Off') then
commandArray['Virtuel Anna']='On'
commandArray['Group:Lumiere blanche Anna2']='On'
commandArray['Interrupteur Anna']='Set Level: 40'
else
if (devicechanged['Interrupteur Anna'] == '2 Click' and otherdevices['Virtuel Anna'] == 'On') then
commandArray['Group:Lumiere blanche Anna1']='On'
commandArray['Interrupteur Anna']='Set Level: 40'
end
end
if ((devicechanged['Interrupteur Anna'] == '3 Click' and otherdevices['Virtuel Anna'] == 'Off')) then
commandArray['Virtuel Anna']='On'
commandArray['Group:Lumiere violette Anna']='On'
commandArray['Interrupteur Anna']='Set Level: 40'
else
if ((devicechanged['Interrupteur Anna'] == '3 Click' and otherdevices['Virtuel Anna'] == 'On')) then
commandArray['Group:Lumiere blanche Anna rgb']='On'
commandArray['Interrupteur Anna']='Set Level: 40'
end
end
if ((devicechanged['Interrupteur Anna'] == '4 Click' and otherdevices['Virtuel prise Anna'] == 'Off')) then
commandArray['Virtuel prise Anna']='On'
commandArray['Prise lampe Anna']='On'
commandArray['Interrupteur Anna']='Set Level: 40'
else
if ((devicechanged['Interrupteur Anna'] == '4 Click' and otherdevices['Virtuel prise Anna'] == 'On')) then
commandArray['Virtuel prise Anna']='Off'
commandArray['Prise lampe Anna']='Off'
commandArray['Interrupteur Anna']='Set Level: 40'
end
end
return commandArray
Je pense que les latences que j'ai peuvent provenir de scripts assez mal fait comme celui là, et peut être qu'une autre façon de les écrire réduirait les latences non ?
J'ai une vingtaine de script basé sur un changement d'état, dont certain portant sur plusieurs device, peu ou pas de latence (maxi 1 seconde), je ne pense pas que les regrouper dans un même script change grand chose, mais tu peux toujours essayer.