Author Topic: Using virtual switch to turn on/off 2 switches?  (Read 249 times)

Offline dannieboiz

  • Sr. Member
  • ****
  • Posts: 412
  • Karma: +2/-2
Using virtual switch to turn on/off 2 switches?
« on: October 14, 2017, 09:31:00 pm »
I have 2 yard lights that I want to be able to turn on/off together but at the same time be able to independently control each lights when desire.

Setting up scene won't work for this scenario since I'll have to disable the scenes when I want to control them by themselves. Is the Virtual Switch the answer? I have it installed but not even sure where to start with it. Can't find much info on this site.

Offline Mike Yeager

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +6/-12
Re: Using virtual switch to turn on/off 2 switches?
« Reply #1 on: October 15, 2017, 12:40:21 am »
Sounds like a job for PLEG...

Offline dannieboiz

  • Sr. Member
  • ****
  • Posts: 412
  • Karma: +2/-2
Re: Using virtual switch to turn on/off 2 switches?
« Reply #2 on: October 15, 2017, 12:54:15 am »
I'm not sure how pleg would achieve this.


Offline kigmatzomat

  • Sr. Member
  • ****
  • Posts: 288
  • Karma: +8/-0
Re: Using virtual switch to turn on/off 2 switches?
« Reply #3 on: October 15, 2017, 01:23:49 am »
I have 2 yard lights that I want to be able to turn on/off together but at the same time be able to independently control each lights when desire.

So what light/ switches do you have and what is the scenario you want to happen?

In theory you could get some of the newer switches that support scenes (central scene. Iirc) and then have both turn on/off when you trigger the scene.  I would have both turn on if either is off, then have both turn off if both are on. It would require a smidgen of luup to make it work.

Offline cgmartin

  • Newbie
  • *
  • Posts: 15
  • Karma: +2/-0
Re: Using virtual switch to turn on/off 2 switches?
« Reply #4 on: October 17, 2017, 12:03:06 am »
Hi @dannieboiz,

Quote
Setting up scene won't work for this scenario since I'll have to disable the scenes when I want to control them by themselves.

Can you elaborate on why scenes won't work for this scenario? Scenes can coexist with independent light control, afaik.

I'm unsure if this is the exact scenario you are looking for, and this might be overkill for what you need, but in case it helps...

I used the files in this thread to extend Virtual Switch with a 3rd state "nothing". Here's how it is set up:
  • Create the 3-state virtual switch device: "Yard Lights"
  • Create a scene "Yard Lights On", triggered by the virtual switch device "on" state:
    • Turns on the individual lights
    • Changes the Virtual "Yard Lights" device back to "nothing" state
  • Create a scene "Yard Lights Off", triggered by the virtual switch device "off" state:
    • Turns off the individual lights
    • Changes the Virtual "Yard Lights" device to "nothing" state

This way you can control the individual lights themselves in addition to controlling them as a group device. You are always able to turn them all on or off through the Virtual Switch since it resets itself back to the "nothing" state each time it is run. I hope this makes sense.

I am primarily using this as a workaround for Alexa's use of scenes, where you are forced to say "Alexa, turn on {scene name}" (even when you actually want to turn "off" something). By using the Virtual Switch I can now say "Alexa, turn [on|off] Downstairs" and it will run those scenes in the background.