Aller au contenu

Recommended Posts

Associations des Modules

 

Ce tutoriel à  pour but d'expliquer comment associer efficacement des modules entre eux tous en évitant de faire des changements d'états inutiles.

Pour quoi éviter les associations avec la Fibaro:

  • Trop fouillis pour moi
  • Faut une bonne mémoire pour ce rappeler de toutes les associations
  • Peut-être difficile à  débugger en cas de problème

1-     Pour commencer l'entête du script, on y mettra les ID qui doivent démarrer la scène:

--[[
%% properties
12 value
50 value
60 value
64 value
%% globals
--]]

2-     On définie nos locals et nos modules :

local startSource = fibaro:getSourceTrigger();
--Settings
debug = "no";

--IdDevice
lightMasterBathRoom = 12;
ledMasterBathRoom   = 26;
rgbwMasterBathRoom  = 30;
lightKitchen        = 60;
lightSalleManger    = 64;
lightSalleManger2    = 62;
spotKitchen         = 88;
lightRoom2        = 50;
light2Room2     = 52;

La fonction debug affichera en rouge un turnOn, en bleue un turOn, en vert un valeur et en orange la valeur et l'id  de lu module de commande

 

3-     La fonction qui permet d'éviter les changements d'états inutile.

function StateDevice (typeDevice, idDevice, valueDevice)
  if (typeDevice == "contactDevice") then
    if (valueDevice == "turnOff") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ==  1) then
        fibaro:call(idDevice, "turnOff");
        if (debug == "yes") then
          fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: TurnOff</font> ");
        end
      end
    elseif (valueDevice == "turnOn") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ==  0) then
        fibaro:call(idDevice, "turnOn");
        if (debug == "yes") then
          fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: TurnOn </font> ");
        end
      end
    end
  end
  if (typeDevice == "RgbwDevice") then
    if (valueDevice == "turnOff") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  0) then
        fibaro:call(idDevice, "turnOff");
        if (debug == "yes") then
          fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: TurnOff </font> ");
        end
      end
    elseif (valueDevice == "turnOn") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ==  0) then
        fibaro:call(idDevice, "turnOn");
        if (debug == "yes") then
          fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: TurnOn </font> ");
        end
      end
    end
  end
  if (typeDevice == "DimmerDevice") then
    if (valueDevice == "turnOn" or valueDevice == "turnOff") then
      if (valueDevice == "turnOff") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  valueDevice) then
          fibaro:call(idDevice, "turnOff");
          if (debug == "yes") then
            fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: TurnOff </font> ");
          end
        end
      elseif (valueDevice == "turnOn") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ==  valueDevice) then
          fibaro:call(idDevice, "turnOn");
          if (debug == "yes") then
            fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: TurnOn </font> ");
          end
        end
      end
    elseif ( tonumber(fibaro:getValue(idDevice, "value")) ~=  valueDevice) then
      fibaro:call(idDevice, "setValue", valueDevice);
      if (debug == "yes") then
        fibaro:debug("<font color='green'>Id: " .. idDevice .. ", value: " .. valueDevice .. " </font> ");
      end
    end
  elseif (typeDevice == "contactBlind") then
    if (valueDevice == "Close" or valueDevice == "Open") then
      if (valueDevice ~= "Close") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  0) then
          fibaro:call(idDevice, "close");
          if (debug == "yes") then
            fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: Fermé </font> ");
          end
        end
      elseif (valueDevice == "Open") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  99) then
          fibaro:call(idDevice, "open");
          if (debug == "yes") then
            fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: Ouvert </font> ");
          end
        end
      end
    elseif ( tonumber(fibaro:getValue(idDevice, "value")) ~=  valueDevice) then
      fibaro:call(idDevice, "setValue", valueDevice);
      if (debug == "yes") then
        fibaro:debug("<font color='green'>Id: " .. idDevice .. ", value: " .. valueDevice .. " </font> ");
      end
    end
  end
end

La fonction StateDevice a besoin de 3 paramètres:

  • typeDevice qui a pour valeur: contactDevice/RgbwDevice/DimmerDevice/contactBlind
  • idDevice: l'id du device qu'il faut modifier l'état
  • valueDevice qui a pour valeur: turnOn/turnOff/Close/Open/0-99

Attention, vue qu'il y a un problème pour les volets avec la box, le contactBlind ne fonctionne pas.

 

4-     Et pour finir on met notre code d'associations:

if (startSource['type']=='property') then
  if (debug == "yes") then
    fibaro:debug("<font color='green'>Id:" .. startSource['deviceID'] .. ", value: " .. tonumber(fibaro:getValue(startSource['deviceID'], "value")) .. "</font> ");
  end
  -- Lumière salle de bain Master
  if (startSource['deviceID'] == lightMasterBathRoom) then
    if ( tonumber(fibaro:getValue(lightMasterBathRoom, "value")) == 99 ) then
      StateDevice ("contactDevice", ledMasterBathRoom, "turnOn");
      StateDevice ("RgbwDevice", rgbwMasterBathRoom, "turnOn");
    elseif ( tonumber(fibaro:getValue(lightMasterBathRoom, "value")) <= 95 ) then
      StateDevice ("contactDevice", ledMasterBathRoom, "turnOff");
      StateDevice ("RgbwDevice", rgbwMasterBathRoom, "turnOff");
    end
  elseif (startSource['deviceID'] == lightKitchen) then
    if ( tonumber(fibaro:getValue(lightKitchen, "value")) == 99 ) then
      StateDevice ("contactDevice", spotKitchen, "turnOn");
    elseif ( tonumber(fibaro:getValue(lightKitchen, "value")) < 99 ) then
      StateDevice ("contactDevice", spotKitchen, "turnOff");
    end
  elseif (startSource['deviceID'] == lightRoom2) then
    if ( tonumber(fibaro:getValue(lightRoom2, "value")) == 99 ) then
      --StateDevice ("contactDevice", spotKitchen, "turnOn");
      fibaro:call(52, "setValue", "99")
    elseif ( tonumber(fibaro:getValue(lightRoom2, "value")) < 99 ) then
      --StateDevice ("contactDevice", spotKitchen, "turnOff");
      fibaro:call(52, "setValue", "0")
    end
   elseif (startSource['deviceID'] == lightSalleManger) then
    StateDevice ("DimmerDevice", lightSalleManger2, fibaro:getValue(lightSalleManger, "value"));    
  end
end

Je vous ai mis qu'une partie de mon code pour voir un peu le fonctionnement.

Amusez-vous bien.

  • Upvote 3

Partager ce message


Lien à poster
Partager sur d’autres sites

Tu peux détailler un peu ?

Qu'entends tu par changements d'états inutiles ?

En gros tu passes par une scène, c'est ça ? Mais donc tes modules ne sont plus associés, et donc la réactivité est moindre, car passant par la box ici... Je ne vois pas trop l'intérêt en fait. J'ai pas mal d'association entre des FGMS et des FGS pour les lumières des points de passage, cela fonctionne parfaitement, stable et surtout ultra rapide. Autre avantage, fonctionne même si la HC2 est coupé en autonome.

Partager ce message


Lien à poster
Partager sur d’autres sites

Avec ce code :

--[[
%% properties
434 value
436 value
452 value
454 value

%% globals
--]]

local startSource = fibaro:getSourceTrigger();
--Settings
debug = "no";
 
--IdDevice
local InterGtlTERRASSE = 434;
local InterGtlALLEE = 436;
local InterMuralTERRASSE = 452;
local InterMuralALLEE   = 454;

function StateDevice (typeDevice, idDevice, valueDevice)
  if (typeDevice == "contactDevice") then
    if (valueDevice == "turnOff") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ==  1) then
        fibaro:call(idDevice, "turnOff");
        if (debug == "yes") then
          fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: TurnOff</font> ");
        end
      end
    elseif (valueDevice == "turnOn") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ==  0) then
        fibaro:call(idDevice, "turnOn");
        if (debug == "yes") then
          fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: TurnOn </font> ");
        end
      end
    end
  end
  if (typeDevice == "RgbwDevice") then
    if (valueDevice == "turnOff") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  0) then
        fibaro:call(idDevice, "turnOff");
        if (debug == "yes") then
          fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: TurnOff </font> ");
        end
      end
    elseif (valueDevice == "turnOn") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ==  0) then
        fibaro:call(idDevice, "turnOn");
        if (debug == "yes") then
          fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: TurnOn </font> ");
        end
      end
    end
  end
  if (typeDevice == "DimmerDevice") then
    if (valueDevice == "turnOn" or valueDevice == "turnOff") then
      if (valueDevice == "turnOff") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  valueDevice) then
          fibaro:call(idDevice, "turnOff");
          if (debug == "yes") then
            fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: TurnOff </font> ");
          end
        end
      elseif (valueDevice == "turnOn") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ==  valueDevice) then
          fibaro:call(idDevice, "turnOn");
          if (debug == "yes") then
            fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: TurnOn </font> ");
          end
        end
      end
    elseif ( tonumber(fibaro:getValue(idDevice, "value")) ~=  valueDevice) then
      fibaro:call(idDevice, "setValue", valueDevice);
      if (debug == "yes") then
        fibaro:debug("<font color='green'>Id: " .. idDevice .. ", value: " .. valueDevice .. " </font> ");
      end
    end
  elseif (typeDevice == "contactBlind") then
    if (valueDevice == "Close" or valueDevice == "Open") then
      if (valueDevice ~= "Close") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  0) then
          fibaro:call(idDevice, "close");
          if (debug == "yes") then
            fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: Fermé </font> ");
          end
        end
      elseif (valueDevice == "Open") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  99) then
          fibaro:call(idDevice, "open");
          if (debug == "yes") then
            fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: Ouvert </font> ");
          end
        end
      end
    elseif ( tonumber(fibaro:getValue(idDevice, "value")) ~=  valueDevice) then
      fibaro:call(idDevice, "setValue", valueDevice);
      if (debug == "yes") then
        fibaro:debug("<font color='green'>Id: " .. idDevice .. ", value: " .. valueDevice .. " </font> ");
      end
    end
  end
end


if (startSource['type']=='property') then
  if (debug == "yes") then
    fibaro:debug("<font color='green'>Id:" .. startSource['deviceID'] .. ", value: " .. tonumber(fibaro:getValue(startSource['deviceID'], "value")) .. "</font> ");
  end

  
  

  -- Lumière TERRASSE
  if (startSource['deviceID'] == InterMuralTERRASSE) then

      if ( tonumber(fibaro:getValue(InterMuralTERRASSE, "value")) == 99 ) then
      StateDevice ("contactDevice", InterGtlTERRASSE, "turnOn");
      elseif ( tonumber(fibaro:getValue(InterMuralTERRASSE, "value")) < 99 ) then
      StateDevice ("contactDevice", InterGtlTERRASSE, "turnOff");
      end
  -- Lumière ALLEE
  elseif (startSource['deviceID'] == InterMuralALLEE) then
    
      if ( tonumber(fibaro:getValue(InterMuralALLEE, "value")) == 99 ) then
      StateDevice ("contactDevice", InterGtlALLEE, "turnOn");
      elseif ( tonumber(fibaro:getValue(InterMuralALLEE, "value")) < 99 ) then
      StateDevice ("contactDevice", InterGtlALLEE, "turnOff");
      end

  end
end  

Où me suis-je planté ? Il ne m'affiche pas d'erreur dans le DEBUG ... et n'allume rien non plus ???

Partager ce message


Lien à poster
Partager sur d’autres sites

Les modules esclaves ne doit pas pouvoir démarrer la scène. Enlève les de l’en-tête.

 

@nico, je suis d'accord avec toi que les associations des modules depuis les groupes on un avantage si ta box est en rad. Mais après c'est un gros bordel à  gérer je trouve car tu n'as aucune vue d'ensemble.

La je fais ce que je veux en personnalisant avec les modules RGB ou mettre créer des ambiances avec différente luminosité. Avec la box, les valeurs seront les mêmes.

Si tu prend m'a mon salon, j'ai mis des points lumineux d'ambiance, des hues et un éclairage pour bien tout éclairer. Et bien je peux faire des associations suivant des ambiances, l'heure, si je regarde un film ou non.

 

Pour les changements d'état inutile, disons que tu as allumé un switch depuis ton smartphone, si une association bête est fait dessus il va renvoyer le changement d'état pour que ton switch change sa valeur, mon script vérifie la valeur.

 

Pour la réactivité, chez moi c'est instantané, ma box tourne depuis 1 mois, mes cpu tournent en moyenne à  10% avec des pics à  50% de temps en temps et la ram à  42%. Donc quasiment instantané.

 

Donc j'utiliserais perso les groupes, quand ce sera plus simple, un tableau pour visualiser tes associations et plus de flexibilité.

Partager ce message


Lien à poster
Partager sur d’autres sites

modules enlevés :( pas de changement même après avoir redémarré la box

Partager ce message


Lien à poster
Partager sur d’autres sites

Tu peux détailler un peu ?

Qu'entends tu par changements d'états inutiles ?

En gros tu passes par une scène, c'est ça ? Mais donc tes modules ne sont plus associés, et donc la réactivité est moindre, car passant par la box ici... Je ne vois pas trop l'intérêt en fait. J'ai pas mal d'association entre des FGMS et des FGS pour les lumières des points de passage, cela fonctionne parfaitement, stable et surtout ultra rapide. Autre avantage, fonctionne même si la HC2 est coupé en autonome.

 

 

Et toi Nico, as-tu pu associer deux FGS ? via les groupes ?

Partager ce message


Lien à poster
Partager sur d’autres sites

j'ai testé avec une simple scène en mode blocs une pour on et une autre pour off, pour S1 et S2 du FGS.

S1 et S2 du FGS221 n°1 sont bien synchros avec respectivement S1 et S2 du FGS221 n°2 via l'interface de la HC2.

 

Sur le bouton poussoir mural, aucune action sur S1, que sur S2 (du FGS n°1) ????????

Les deux sorties physiques S1 et S2 marchent, car j'ai ajouté un voyant led dans l'inter ... Sous l'action du poussoir, donc  de S1 et S2 ... ils s'allument ou s'éteignent bien.

Partager ce message


Lien à poster
Partager sur d’autres sites

Associer 2 FGS de quelle façon ?

 

Sinon Shad oui, pour de l'ambiance. Mais bon, moi c'est vrai que j'utilise ça plus pour tous les lieux de passage, couloir, cage d'escalier, palier etc.

Mais pourquoi pas ton système dans le salon.

Dans les lieux de passage, loin de la box, il y a une différence de réaction : Exemple mon dressing : S1 en direct sur le FGMS, S2 allumer par un scénario dans la box : J'ai 1s de différence.

Partager ce message


Lien à poster
Partager sur d’autres sites

Voilànico, perso moi je n'ai plus besoin de ce genre d'association, j'ai refait 90% de la maison (pas encore finie).

Donc c'est vraiment un autre genre d'associations que je recherche. Bon après j'ai pas encore remis mes détecteur de mouvement.

Partager ce message


Lien à poster
Partager sur d’autres sites

@chrispec

Passe le code en debug= yes tu verras làou le code ne démarre pas.

Partager ce message


Lien à poster
Partager sur d’autres sites

Je verrai, c'est prévu l'an prochain la partie, ambiance et la salle HC :)

Mais mes couples FGMS/FGS, je ne m'en passerai pour rien au monde tellement c'est nickel !

Partager ce message


Lien à poster
Partager sur d’autres sites

rien ...

Tu veux dire que même en mettant debug="yes", il n'y a rien qui s'écrit ?

Sa veut dire que la scène ne démarre pas. Tu es sur de tes ID ?

Partager ce message


Lien à poster
Partager sur d’autres sites

à  part les deux ID supprimées de l'entête ... le code est inchangé  ...

Partager ce message


Lien à poster
Partager sur d’autres sites

Si tu es sur de tes ID, j'ai pris ton code que j'ai tester chez moi en remplaçant les ID et sa fonctionne nickel.

Si c'est bien les ID 452 et 454 qui doivent actionner la scène, voilà 

--[[
%% properties
452 value
454 value
%% globals
--]]
 
local startSource = fibaro:getSourceTrigger();
--Settings
debug = "yes";
 
--IdDevice
local InterMuralTERRASSE = 452;
local InterGtlTERRASSE = 434;
local InterMuralALLEE   = 454;
local InterGtlALLEE = 436;
 
function StateDevice (typeDevice, idDevice, valueDevice)
  if (typeDevice == "contactDevice") then
    if (valueDevice == "turnOff") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ==  1) then
        fibaro:call(idDevice, "turnOff");
        if (debug == "yes") then
          fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: TurnOff</font> ");
        end
      end
    elseif (valueDevice == "turnOn") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ==  0) then
        fibaro:call(idDevice, "turnOn");
        if (debug == "yes") then
          fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: TurnOn </font> ");
        end
      end
    end
  end
  if (typeDevice == "RgbwDevice") then
    if (valueDevice == "turnOff") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  0) then
        fibaro:call(idDevice, "turnOff");
        if (debug == "yes") then
          fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: TurnOff </font> ");
        end
      end
    elseif (valueDevice == "turnOn") then
      if ( tonumber(fibaro:getValue(idDevice, "value")) ==  0) then
        fibaro:call(idDevice, "turnOn");
        if (debug == "yes") then
          fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: TurnOn </font> ");
        end
      end
    end
  end
  if (typeDevice == "DimmerDevice") then
    if (valueDevice == "turnOn" or valueDevice == "turnOff") then
      if (valueDevice == "turnOff") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  valueDevice) then
          fibaro:call(idDevice, "turnOff");
          if (debug == "yes") then
            fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: TurnOff </font> ");
          end
        end
      elseif (valueDevice == "turnOn") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ==  valueDevice) then
          fibaro:call(idDevice, "turnOn");
          if (debug == "yes") then
            fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: TurnOn </font> ");
          end
        end
      end
    elseif ( tonumber(fibaro:getValue(idDevice, "value")) ~=  valueDevice) then
      fibaro:call(idDevice, "setValue", valueDevice);
      if (debug == "yes") then
        fibaro:debug("<font color='green'>Id: " .. idDevice .. ", value: " .. valueDevice .. " </font> ");
      end
    end
  elseif (typeDevice == "contactBlind") then
    if (valueDevice == "Close" or valueDevice == "Open") then
      if (valueDevice ~= "Close") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  0) then
          fibaro:call(idDevice, "close");
          if (debug == "yes") then
            fibaro:debug("<font color='blue'>Id: " .. idDevice .. ", value: Fermé </font> ");
          end
        end
      elseif (valueDevice == "Open") then
        if ( tonumber(fibaro:getValue(idDevice, "value")) ~=  99) then
          fibaro:call(idDevice, "open");
          if (debug == "yes") then
            fibaro:debug("<font color='red'>Id: " .. idDevice .. ", value: Ouvert </font> ");
          end
        end
      end
    elseif ( tonumber(fibaro:getValue(idDevice, "value")) ~=  valueDevice) then
      fibaro:call(idDevice, "setValue", valueDevice);
      if (debug == "yes") then
        fibaro:debug("<font color='green'>Id: " .. idDevice .. ", value: " .. valueDevice .. " </font> ");
      end
    end
  end
end
 
if (startSource['type']=='property') then
  if (debug == "yes") then
    fibaro:debug("<font color='green'>Id:" .. startSource['deviceID'] .. ", value: " .. tonumber(fibaro:getValue(startSource['deviceID'], "value")) .. "</font> ");
  end
   -- Lumière TERRASSE
  if (startSource['deviceID'] == InterMuralTERRASSE) then
   if ( tonumber(fibaro:getValue(InterMuralTERRASSE, "value")) == 99 ) then
      StateDevice ("contactDevice", InterGtlTERRASSE, "turnOn");
   elseif ( tonumber(fibaro:getValue(InterMuralTERRASSE, "value")) < 99 ) then
      StateDevice ("contactDevice", InterGtlTERRASSE, "turnOff");
   end
  -- Lumière ALLEE
  elseif (startSource['deviceID'] == InterMuralALLEE) then
 
      if ( tonumber(fibaro:getValue(InterMuralALLEE, "value")) == 99 ) then
      StateDevice ("contactDevice", InterGtlALLEE, "turnOn");
      elseif ( tonumber(fibaro:getValue(InterMuralALLEE, "value")) < 99 ) then
      StateDevice ("contactDevice", InterGtlALLEE, "turnOff");
      end
 
  end
end  
 

Partager ce message


Lien à poster
Partager sur d’autres sites

Merci du mal que tu te donnes ...

Mais toujours rien ??? Je n'y comprends rien ?? Pas de debug non plus ??

Partager ce message


Lien à poster
Partager sur d’autres sites

J'ai redémarré la box ... et une évolution ...

Je clique dans l'interface HC2 sur ON des ID 452 et 454:

 - debug ok! en vert ...

- clic du relais du FGS ok!

- ID 434 et 436 ne bougent pas ni sur l'interface, ni ne claquent (par l'association): pas ok

- et les lumières sont restées éteintes ...

Partager ce message


Lien à poster
Partager sur d’autres sites

Je suis en 4.080. Mais là  j'avoue ne pas pouvoir t'aider plus car moi fonctionne nickel.

Si tes id 452 et 454 c'est bien des dimmers j'avoue ne pas comprendre.

Là  il faut que tu rajoutes des fibaro:debug  dans les différentes étapes pour voir ou sa coince.

Récupère les valeurs avec un fibaro:getValue(ID, "value") pour être sur que les 452 et 454 ont bien une valeur de 99.

Partager ce message


Lien à poster
Partager sur d’autres sites

J'ai cru comprendre que c'était des FGS, pas des FGD...

Partager ce message


Lien à poster
Partager sur d’autres sites

Si les modules qui commandes les autres sont des switch dans ce cas il faut modifier le code car tu parles de FGD en haut de cette page.  ^_^

if (startSource['type']=='property') then
  if (debug == "yes") then
    fibaro:debug("<font color='green'>Id:" .. startSource['deviceID'] .. ", value: " .. tonumber(fibaro:getValue(startSource['deviceID'], "value")) .. "</font> ");
  end
   -- Lumière TERRASSE
  if (startSource['deviceID'] == InterMuralTERRASSE) then
   if ( tonumber(fibaro:getValue(InterMuralTERRASSE, "value")) == 1 ) then
      StateDevice ("contactDevice", InterGtlTERRASSE, "turnOn");
   elseif ( tonumber(fibaro:getValue(InterMuralTERRASSE, "value")) == 0 ) then
      StateDevice ("contactDevice", InterGtlTERRASSE, "turnOff");
   end
  -- Lumière ALLEE
  elseif (startSource['deviceID'] == InterMuralALLEE) then
 
      if ( tonumber(fibaro:getValue(InterMuralALLEE, "value")) == 1 ) then
      StateDevice ("contactDevice", InterGtlALLEE, "turnOn");
      elseif ( tonumber(fibaro:getValue(InterMuralALLEE, "value")) == 0 ) then
      StateDevice ("contactDevice", InterGtlALLEE, "turnOff");
      end
 
  end
end
  • Upvote 1

Partager ce message


Lien à poster
Partager sur d’autres sites

×