POur ma part concernant mes modules SONOFF avec home bridge je crée un virtual switch en plus du virtual initial que je lie pour le retour d'etat, puis l'original je le deplace en "hidden" dans périphérique par emplacement afin d'éviter la polution de plusieurs interrupteurs pour un meme sonoff.
Code : Tout sélectionner
commandArray = {}
if (devicechanged['ETAT GARAGE'] == 'On') then
commandArray['UpdateDevice']='50|0|1'
end
if (devicechanged['ETAT GARAGE'] == 'Off') then
commandArray['UpdateDevice']='50|1|1'
end
if (devicechanged['ECLAIRAGE / Extérieur'] == 'Off') then
commandArray['UpdateDevice']='140|0|1'
end
if (devicechanged['ECLAIRAGE / Extérieur'] == 'On') then
commandArray['UpdateDevice']='140|1|1'
end
return commandArray