Menu

One switch to toggle through actors...

netsrac69
2011-11-03
2012-12-14
  • netsrac69

    netsrac69 - 2011-11-03

    I have two lamps I want to switch with one switch. The idea is the following:

    Off will always turn off both lamps.

    Press On will turn on Lamp1 & Lamp2
    Press On again: Will turn off Lamp1 & Lamp2 is still on
    Press On again: Will turn on Lamp1 & turn off Lamp2
    Press On again: Will turn on Lamp1 & Lamp2
    (this will start the process from the top)

    Any ideas how to create these rules in LinKNX?

     
  • Anthony

    Anthony - 2011-11-03

    hello,

    something like that : ? (not testing)

    <rule id="BP_Lamp1_Lamp2">
      <condition type="object" id="BP" value="on" trigger="true"/>
      <actionlist>
        <action type="script">
          Lamp1 = obj("Lamp1");
          Lamp2 = obj("Lamp2");
          if Lamp1 == "off" and  Lamp2 == "off" then 
            set("Lamp1", "on");
            set("Lamp2", "on"); 
          else 
            if Lamp1 == "on" and  Lamp2 == "on" then 
              set("Lamp1", "off");
              set("Lamp2", "on"); 
            else 
              if Lamp1 == "off" and  Lamp2 == "on" then 
                set("Lamp1", "on");
                set("Lamp2", "off"); 
              else 
                if Lamp1 == "on" and  Lamp2 == "off" then 
                  set("Lamp1", "off");
                  set("Lamp2", "off");
                end;
              end;
            end;
          end; 
          set("BP", "off"); 
        </action>
      </actionlist>
    </rule>
    

    Anthony.

     
  • netsrac69

    netsrac69 - 2011-11-04

    Hi Antony,

    thanks…this works pretty good except for one thing, but I have asked this in a different topic, because this is a more general questions.

    Netsrac

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.