[SOLVED]Is PLEG double-tapping the action? Answer = NO.

I have a script to turn off the light in the laundry room after 10 minutes of on time. If I happen to be in the room when that executes, and I’m within arm’s reach of the light switch, I’ll turn the light on within 2-3 seconds. If I do that, about 2 seconds later, the light turns off again. So, I have to turn it on one more time. Alternatively, I can sit in a dark room, count to 5, then turn it on, and it’ll stay on.

The PLEG script only calls for a single action (turn off light), one time, no intervals. Is that common for zwave to send the command twice?

FWIW, I’ve noticed this with pretty much all of my auto-off scripts.

It’s probably that your condition for turning the light off is still true when you turn the light back on, so it then fires again and turns it off.

I have the same “issue” when I use a motion sensor to turn a light on and then manually turn it off while the motion sensor is still tripped, except it turns it back on.

I haven’t really considered it a big enough issue to spend any time on yet though :slight_smile:

Same here. It’s been like this since I started using PLEG, and I’ve gotten used to it. I guess today I finally had enough ‘me time’ to put the question out there to see if I’m the only one.

If you can get someone else to turn the light back on when it goes off and you load the status page up immediately, you’ll be able to see what the trigger and condition values are.

Better chance of all 9, er, 8 planets aligning than me getting anyone in my house to help with something like that. I mean, they would, but it would likely end in divorce or adoption.

Trained monkey? :slight_smile:

It’d probably help to post your logic anyway, someone might be able to show a better way.


URLightOn Whenever the Utility Room Light is turned on

URLightAutoOff URLightOn and (URLightOn; NOW > 10:00)

Utility Room Light[58] SetTarget newTargetValue=0

Looks ok to me. How quick does the switch you’re using report status? I’m wondering if Vera isn’t getting confirmation of the Off back (even though it’s turning it off) before you turn it back On, so Pleg doesn’t see the state toggle.

When everything is running snappy, I’d say within 2 seconds. I guess my (initial) question is, when PLEG sends an action to turn off a light, does it ‘re-fire’ that action a second time everytime - i.e. is that just standard with z-wave communications? Or is there some bi-directional communication going on, as you suspect, where PLEG is waiting for confirmation that the switch did turn off?

Assuming there is bi-directional comms, I’d see it like this:

  1. PLEG issues off command
  2. Switch turns off, and initiates a report back to the controller that it is off
  3. PLEG waits for confirmation
  4. Before report is sent from switch, I turn it back on, aborting the “off” report
  5. Switch sends “on” report
  6. PLEG receives “ON” command, and resends “OFF”
  7. Switch turns off again, and waits for report(?)
  8. I turn switch on again, in the same timing/sequence as before
  9. Light stays on.

So, IF PLEG is listening for the off report (step 3) and gets an on report, it must only do that once - else I would be constantly toggling the switch.

Now I know why I didn’t let it bother me :slight_smile:

I wouldn’t expect the zWave command to be going out twice, and PLEG is not waiting on the Off report. Richard would have to answer definitively, but what I would expect the flow to be like is:

  1. Because you are using Now in your condition, PLEG checks every minute if the light is on and if it has been on for more than 10 minutes (your condition)
  2. When both conditions are true, PLEG sends the Off command and the light turns off
  3. You’re in the room so you turn it back on
  4. Your light switch realises it has to send a report, so it sends a “I’m currently turned on”
  5. Either the status report or the next Now triggers PLEG to re-evaluate the condition, finds it true, so sends the Off action again

If you can wait for 5 seconds and it doesn’t then re-fire, then it sounds to me like your light switch takes a second or 3 to send the status report (not instant status??) and it doesn’t send two, just one with the status at the time it sends it.

The Aeon Labs parameter 80 set to 2 enable instant reporting. And I don’t know how I could prove whether it’s refiring if I wait 5 seconds. If during those 5 seconds (where the light is off) the command to turn off hits a second time, I wouldn’t know.

Hopefully Richard can set me straight. Thanks for helping me banter this around.

Which model switch do you have? I have a couple of Micro Smart Switch v2 that I can see if I can replicate the issue with (one is in my pantry and has identical logic to turn off after 5 minutes)

PLEG does not send commands more than once, with the possible exception that Vera restarted at the same time as a command was sent.
In that case when Vera restarts, it may or may not have updated the fact that it sent the command, causing it to resend the command.

It’s definitely not restarting. It happens everytime, and I don’t get notification of a restart. And, restarts take 10-15 seconds to complete, which is way longer than the 2 second interval between off pulses. It was doing this on the Edge and now the Plus - so it’s probably not hardware specific.

While mildly annoying, it’s certainly not anything serious. I was just hoping it was something simple that I could rectify.

If you post the Status in PDF, we might be able to see something there that points to the problem…



This is always the first step and without it only a portion of the picture is painted.

Here ya go… Sorry about the PDF quality. When printing it as a standard PDF from Chrome, the file size was over the max allowed by the forums. This took a little effort, but I found a way to get it down in size - at the expense of clarity.

I’ve highlighted the elements we’ve been discussing.

Strange the timestamp for URLightOn looks like it was automatically turned off after exactly 5 minutes, but the timestamps for URLightAutoOff don’t indicate it was the condition that turned it off (they are before the light turned on and off).

Do you have any other automation, like in another PLEG or standard scene, that acts on this light?

YES! That’s it! When I initially set up my PLEG routines, I had the same condition both turn lights on, and off by way of an interval (5min in the case of this light). At some point, I separated the on triggers/conditions from the auto off routines. So I created a second PLEG device specifically for all the auto-off functions. Well, apparently, I forgot to remove the 5min interval (off) on the original logic.

So, when the utility door opens (trigger) it turns on the light, and starts a 5 min timer to turn it off. At the same time, the auto-off PLEG device is triggered by the light coming on, and after 5 min, also turns the light off. So at the 5 min mark, both race to turn off the light.

You guys are brilliant. Self inflicted, as usual. Just wish I had the talent and skill to recognized what was happening by looking at the status reports. I get snowed so easily, apparently. THANK YOU…

Now I have to look at all my actions in the “trigger on” PLEG device to see how many others I’ve got on duplicate off timers.