Here is my problem. In the script below, I ask to change the state of a button. This command works well (the button changes state). But if I ask to show me this state immediately, the answer is wrong.
Can anyone explain to me? And find me a solution?
Thanks
Code: Select all
return {
on = {
timer = {'every 1 minutes'},
},
execute = function(dz, item)
if item.isTimer then ------------ TIMER -----------------
print ('Etat: '..dz.devices('Bouton').sValue)
print ('')
print ('On éteint Bouton')
dz.devices('Bouton').switchOff()
print ('Etat: '..dz.devices('Bouton').sValue)
print ('')
print ('On allume Bouton')
dz.devices('Bouton').switchOn()
print ('Etat: '..dz.devices('Bouton').sValue)
print ('')
print ('On éteint Bouton')
dz.devices('Bouton').switchOff()
print ('Etat: '..dz.devices('Bouton').sValue)
end
end
}
Code: Select all
2024-02-02 16:33:03.564 Status: dzVents: Etat: Off
2024-02-02 16:33:03.564 Status: dzVents:
2024-02-02 16:33:03.564 Status: dzVents: On éteint Bouton
2024-02-02 16:33:03.564 Status: dzVents: Etat: Off
2024-02-02 16:33:03.565 Status: dzVents:
2024-02-02 16:33:03.565 Status: dzVents: On allume Bouton
2024-02-02 16:33:03.565 Status: dzVents: Etat: Off
2024-02-02 16:33:03.565 Status: dzVents:
2024-02-02 16:33:03.565 Status: dzVents: On éteint Bouton
2024-02-02 16:33:03.565 Status: dzVents: Etat: Off