We have moved at community.getvera.com

Author Topic: "off" command for switch that is already "off"?  (Read 869 times)

Offline Duncank

  • Sr. Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
"off" command for switch that is already "off"?
« on: August 25, 2014, 06:17:53 am »
I've got the following (simplified) setup:

My living room has two lights: lamp1 and lamp2.
I can control them seperately, but I've also created a Virtual Switch that is used as a PLEG trigger to switch on/off both lights at once. It is called "master living room".

Sometimes, I manually switch on only lamp1, the virtual switch stays in off position. If I want to switch the entire living room off, I'll have to switch off lamp1 manually again, instead of pressing "off" on the virtual switch again.

Do you know of a way to make the switch work in either position? So when it is "off", I want to be able to press "off" again to fire the actions tied to it again.

Offline RexBeckett

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3891
  • Karma: +483/-12
Re: "off" command for switch that is already "off"?
« Reply #1 on: August 25, 2014, 07:36:16 am »
I would think your best bet is to have a PLEG Condition and Action that turns on the virtual switch if either of the lamps turn on while the virtual switch is off. For completeness, you could also turn the VS off if both lamps are off while it is on.
 
TurnMasterOn     (Lamp1On or Lamp2On) and !MasterOn
TurnMasterOff    !Lamp1On and !Lamp2On and MasterOn
« Last Edit: August 25, 2014, 07:39:52 am by RexBeckett »

Offline Duncank

  • Sr. Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
Re: "off" command for switch that is already "off"?
« Reply #2 on: August 25, 2014, 08:01:10 am »
Hi Rex, thanks for your reply.

Your answer would be suited for this situation, if I didn't want it to work the opposite way too. If I swith on lamp1, I still want to be able to press the master switch for living room to "on" as well. That way it will switch on lamp2 and a few other devices as well.

So it doesn't matter which state the virtual switch is in, I would like to be able to press that same state again to execute the same action that is tied to it.

Offline RexBeckett

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3891
  • Karma: +483/-12
Re: "off" command for switch that is already "off"?
« Reply #3 on: August 25, 2014, 09:14:37 am »
Quote
So it doesn't matter which state the virtual switch is in, I would like to be able to press that same state again to execute the same action that is tied to it.

Unfortunately, if the VS does not change state it will not raise an event.

You could use two MultiSwitch buttons set to Pulse mode. Use one as MasterOn and the other as MasterOff. In Pulse mode, the state reverts to off 200ms after being turned on. Adjust your PLEG Conditions to fire whenever the appropriate switch turns on.

Offline Duncank

  • Sr. Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
Re: "off" command for switch that is already "off"?
« Reply #4 on: August 25, 2014, 10:49:42 am »
You could use two MultiSwitch buttons set to Pulse mode. Use one as MasterOn and the other as MasterOff. In Pulse mode, the state reverts to off 200ms after being turned on. Adjust your PLEG Conditions to fire whenever the appropriate switch turns on.

Okay! I'm going to check that out! Thanks for your help