Author Topic: Scene trigger when switch paddle toggled  (Read 730 times)

Offline .jake

  • Sr. Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
Scene trigger when switch paddle toggled
« on: November 16, 2014, 10:02:27 pm »
So my scenes are working on schedules fine.  Simply set up like this:

Front porch light turns on 30 minutes after sunset.
A second scene "sees" that event and turns on the garage man door porch light and a back patio light.
Different scenes turns these off at different times over the night.

All good to here. 

Now if I put a scene to trigger the same light switches but with a different source, say I manually turn on the patio light, and I want it to turn on the front porch and garage man door, it creates a loop in that when the front porch lights it will try to re-light the others.  Maybe it's a no drama issue, but I thought I'd ask.

Basically, for my perimeter lights, when I manually trigger any of them I want them all to come on.  Hopefully this is clear?  Hard to expain.

Thx.

Offline aa6vh

  • Hero Member
  • *****
  • Posts: 637
  • Karma: +15/-0
Re: Scene trigger when switch paddle toggled
« Reply #1 on: November 17, 2014, 10:20:58 am »
There is no harm in turning on a light that is already on. You do want to avoid the "infinate loop"  problem though (where one scene calls another scene which subsequently recalls the first).

There is a way to associate LUA code with specific triggers. So in a scene, the LUA code associated with the trigger that activated the scene is run first, then the main LUA code for the scene is run, then the scene itself is processed.

So you could have your LUA code in the timer trigger, and that code would not be run when manually running the scene.

One other thought: Rather than depend on triggers, there is a LUA call that can explictly run scenes. This might also be a solution for you.

Have you looked at PLEG?
« Last Edit: November 17, 2014, 10:22:33 am by aa6vh »

Offline .jake

  • Sr. Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
Re: Scene trigger when switch paddle toggled
« Reply #2 on: November 18, 2014, 08:22:12 pm »
Thanks for the reply.  PLEG I've looked at but I didn't get too far.  I think I prefer the LUA coding route (mostly because I'm mentally wired more toward CLI than GUI).

I did read the sticky http://forum.micasaverde.com/index.php/topic,18679.0.html about conditional scripting and I was thinking I could accomplish this by evaluating the state of devices before acting.  Vera should have renamed itself to "Time Sink" - that's what it does best!

Thx.