Ce matin réception de mon Kit Xiaomi Home, installation, raccordemen à domoticz ... Tout Ok.
Je voulais piloter une lumière avec le bouton et la dans mon script LUA je reçois deux fois les events. J'ai écris un contournement mais je trouve cela très moche. Un indice pour corriger ?
Code brut :
Code : Tout sélectionner
if (deviceName == 'Xiaomi Bouton') then
if (deviceValue == 'Click') then
if (otherdevices['Cuisine'] == "On" ) then
commandArray['Cuisine']='Off'
else
commandArray['Cuisine']='On'
end
end
end
Code corrigé mais crade avec une variable :
Code : Tout sélectionner
if (deviceName == 'Xiaomi Bouton') then
if (uservariables['PourXiaomi'] == '0') then
commandArray['Variable:PourXiaomi'] = '1'
if (Debug == 'Yes') then
print ("-------------> Xiaomi = '"..tostring(deviceValue).."'")
end
if (deviceValue == 'Click') then
if (otherdevices['Cuisine'] == "On" ) then
commandArray['Cuisine']='Off'
else
commandArray['Cuisine']='On'
end
end
else
commandArray['Variable:PourXiaomi'] = '0'
if (Debug == 'Yes') then
print ("-------------> 2 Xiaomi = '"..tostring(deviceValue).."'")
end
end
end