Living Room Automation Scenario

Been working on this for a couple of days and not getting very far… I have the following setup in my living room:

[ul][li]Schlage Motion Sensor which resets if no motion after 4 minutes.
Leviton control module. Toggles between on and off. Click once to on, click again to off. Consecutive on or off signals (On;On or Off;Off) not possible.
2 lights [/li]
[li][/li][/ul]
with dimmers.

I would like to have the following behavior:

  1. If it is night time and motion is detected turn on lights to 100% turn off after 20 minutes no motion detected.
  2. Manual on 1st time (1 click) = Lights go to 100% and stay on for at least 60 minutes and then turn off 20 minutes after no motion detected. When lights go off the control switch is also reset and turns off.
  3. Manual on 2nd time (3 clicks) within 1 minute (Movie Mode) = Lights go to 50% and stay on for at least 120 minutes and then turn off 20 minutes after no motion detected. When lights go off the control switch is also reset.
  4. 4 clicks within 1 minute resets the entire system to initial state.
  5. Can turn system off manually using the control switch at any time.

I have been trying to implement using PLEG and PLTS or a combination of both, but getting stuck on the having the logic recognize multiple clicks.

I have probably overthought this so would like a fresh set of more experienced eyes to take a look and see how you would do it.

It’ll help if we see your status report output.

I did something similar. The trick is using the @ operator for counts. Like:
switchOn @ 2 < 5

would trigger when it sees 2 "on"s in less than 5 seconds. Keep in mind that Vera won’t see 2 ons without offs (I think that’s what you’re describing with 3 clicks, but wanted to mention). Your switches will also need to support instant status or Vera will only see changes when it polls the switch.

In my situation, I also found that sequences (this;that < 5) were helpful (this one triggers on seeing this then that within 5 seconds).

Thanks, I’ve started working with the @ operator and made more progress. The switches do show immediate status. I have some ideas that I will try out and then post.

Cheers!

PD