Two-state switch sample trials

Ok, so the sequence seems to have solved my issues… so:

_TurnOnFoyerLightFromPin FrontDoorUnlockedByPin1 AND !FoyerLightsOn AND (!FoyerLightsOn;FrontDoorUnlockedByPin1)

worked, which reads:

Run this action if The front door is unlocked by any pin, and the foyer lights are NOT on and the foyer lights were turned off BEFORE the front door was unlocked by any pin.

My next fix will be to put a condition and action which turns off my multiswitch if the light is turned off manually and the multiswitch button is on.

So, of you @erkme73, I think this will do what you want with a few modifications. I think if you use a Virtual Switch or MultiSwitch, you will have better luck.

VS is Virtual Switch, or you could do what I do and use Multiswitch, which would give you 8 Virtual Switches to do such logic with.

Triggers
LightOn Light is turned on
ManualOff VS is turned on

Conditions
KillAutoOff (!LightOn; LightOn < 10)
ClearVS !LightOn
AutoOff LightOn and (LightOn; Now > 10:00) and !ManualOff

Actions
KillAutoIff Turn VS on
ClearVS Turn VS off
AutoOff Turn Light off

Basicallly this says When you turn the light Off and back on within 10 seconds (note that if it is already off, you’ll have to do On, Off, then On again), it will not automatically turn off the light.
If you Just turn the light on (with more than 10 seconds between it being turned off), the timer will kill the light after 10 minutes.

Note that the above will not work without Instant Status switches (that I know of). I think there is some kind of hack to work with GE switches. If course if you do all of this from the Vera Interface, it will work regardless of instant status (so you can test).

I am about to test this for you now using a new PLEG I am setting up for testing logic like this. I will report back if it works.

[quote=“Bulldoglowell, post:20, topic:179618”]So I am clear… you come home, you unlock the door (DoorIsUnlocked) and open it (DoorIsOpened) and you want the light on (LightOn), unless it is already on (!LightOn) (kid at computer)

Condition
AutoOn = (DoorIsUnlocked;Now<30) AND DoorIsOpened AND !FoyerLightOn [AND IsNight?]
Action: Turn Light On

returns true if you just unlocked the door, the door then opened and the light is off.

And, you want the light to turn off in 10min (AutoOff) only if it was turned on by the AutoOn

Condition
AutoOff = AutoOn AND (AutoOn; NOW>10:00)
Action: Turn Light Off

No?[/quote]

So I come home and unlock the door by a pin and I want the light to turn on (regardless if the door is opened or not). There is some logic I put in that post that is for locking the door as long as the door was unlocked more than 10 minutes ago and it has been closed for over 2 minutes. That all works just fine. Also, since the foyer is always dark, I am not utilizing IsNight for this particular set of logic (I have it, but I didn’t put all my triggers and conditions in the post, that is why “lockDoor2” is not in the triggers. It allows me to flip a Multiswitch and keep the door unlocked while I am in “party mode” where people are coming and going.

What I needed was the light to turn on when someone entered a pin (which worked!), but I only needed it to kill the light if they unlocked it by a pin and it was already off (Not so easy!) as you can see, the sequence fixed it. It now basically says “it was off before it was unlocked by a pin”. At that point I turn on the light and turn on the multiswitch. It was the sequence that was missing that was throwing my logic off.

so, are you good?

if you want, you can add another piece to cancel the 10minute AutoOff by Cycling the switch (OFF-ON quickly but not so fast as Vera doesn’t see it) adding this:

Condition
AutoOff = AutoOn AND (AutoOn; NOW>10:00) AND VSwitchOff
Action: Turn Light Off

Condition
VSwitchOff = LightOn AND (!LightOn;Now<10) [or substitute 10sec for whatever amount of time you can use]

So if you walk in the door, and you don’t want the light to cycle off in 10min, turn it off and on again quickly.

Of course… this depends on Vera’s response time to the switch and is likely to be kludge if you don’t have an instant update switch.

earkme73, The following works for me. Note though that I am using a Multiswitch. Position 1 is actiing as the light and position 2 I am using for the flag to note whether or not to use the autoOff feature.

Triggers
[table]
[tr]
[td][font=times new roman]Name[/font][/td]
[td][font=times new roman]Description[/font][/td]
[/tr][tr]
[td][font=times new roman]LightOn[/font][/td]
[td][font=times new roman]Test Bed MS Switch 1 is turned on[/font][/td]
[/tr][tr]
[td][font=times new roman]ManualOff[/font][/td]
[td][font=times new roman]Test Bed MS Switch 2 is turned on[/font][/td]
[/tr]
[/table]

[font=times new roman][size=medium]Conditions[/size][/font]
[table][tr]
[td][font=times new roman][size=medium]Name[/size][/font][/td]
[td][font=times new roman][size=medium]Expression[/size][/font][/td]
[/tr][tr]
[td][font=times new roman][size=medium]KillAutoOff[/size][/font][/td]
[td][font=times new roman][size=medium](!LightOn; LightOn < 10)[/size][/font][/td]
[/tr][tr]
[td][font=times new roman][size=medium]ClearVS[/size][/font][/td]
[td][font=times new roman][size=medium]!LightOn[/size][/font][/td]
[/tr][tr]
[td][font=times new roman][size=medium]AutoOff[/size][/font][/td]
[td][font=times new roman][size=medium]LightOn and (LightOn; Now > 10:00) and !ManualOff[/size][/font][/td]
[/tr][/table]

[font=times new roman][size=medium]ActionsActions for Condition: KillAutoOff

Immediate[/size][/font]

[table][tr]
[td][font=times new roman][size=medium]Device[/size][/font][/td]
[td][font=times new roman][size=medium]Action[/size][/font][/td]
[td][font=times new roman][size=medium]Arguments[/size][/font][/td]
[/tr][tr]
[td][font=times new roman][size=medium]Test Bed MS[/size][/font][/td]
[td][font=times new roman][size=medium]SetStatus2[/size][/font][/td]
[td][font=times new roman][size=medium]newStatus2=1[/size][/font][/td]
[/tr][/table]
*The above turns on the “ManualOff” flag/switch when the light is turned off, then back on again within 10 seconds.

[font=times new roman][size=medium]Actions for Condition: ClearVS

Immediate[/size][/font]

[table][tr]
[td][font=times new roman][size=medium]Device[/size][/font][/td]
[td][font=times new roman][size=medium]Action[/size][/font][/td]
[td][font=times new roman][size=medium]Arguments[/size][/font][/td]
[/tr][tr]
[td][font=times new roman][size=medium]Test Bed MS[/size][/font][/td]
[td][font=times new roman][size=medium]SetStatus2[/size][/font][/td]
[td][font=times new roman][size=medium]newStatus2=0[/size][/font][/td]
[/tr][/table]
*The above turns off the “manualOff” switch when you turn off the light (so next time you turn it on, the autoKill will work as long as it was more than 10 seconds from when it was on)

[font=times new roman][size=medium]Actions for Condition: AutoOff

Immediate[/size][/font]

[table][tr]
[td][font=times new roman][size=medium]Device[/size][/font][/td]
[td][font=times new roman][size=medium]Action[/size][/font][/td]
[td][font=times new roman][size=medium]Arguments[/size][/font][/td]
[/tr][tr]
[td][font=times new roman][size=medium]Test Bed MS[/size][/font][/td]
[td][font=times new roman][size=medium]SetStatus1[/size][/font][/td]
[td][font=times new roman][size=medium]newStatus1=0[/size][/font][/td]
[/tr][/table]
*The above turns the Light off. In this case Text Bed MS switch 1 is the “light” (for testing purposes)

[quote=“Bulldoglowell, post:23, topic:179618”]So if you walk in the door, and you don’t want the light to cycle off in 10min, turn it off and on again quickly.

Of course… this depends on Vera’s response time to the switch and is likely to be kludge if you don’t have an instant update switch.[/quote]

I won’t need the above. the MultiSwitch will always be set to “off” when the light is turned off. So if I come in and turn it off, then back on, as long as the switch has time to report the 2 distinct triggers, it will work without the above. Nice idea though :slight_smile:

[quote=“erkme73, post:17, topic:179618”][quote=“RexBeckett, post:14, topic:179618”]I may not have understood what you are trying to achieve. If all you want to do is have a light automatically turned off after ten minutes - unless the switch was quickly turned on/off/on, this should do it:

Triggers
LightOn Light is turned on

Conditions
AutoOff LightOn and (LightOn; Now > 10:00) and Not (!LightOn; LightOn < 10)

Actions
AutoOff Turn Light off[/quote][/quote]

Let me see if I get the logic: AutoOff becomes true when: The light is on, and it has been more than 10 min since the light was turned on, but not if it's true that the light was turned on less than 10 seconds since it was not on.
Exactly right. You're getting it now.
Just tried this, and it's still shutting down after the timer expires.
It will only work with a switch that reports status to Vera within a few seconds. If it doesn't, you cannot use the on/off/on mechanism.

Well, when I switch the actual switch that’s part of the 18103 Aeon, the VERA GUI screen shows the change within 5 seconds. Not instant, but it’s also not waiting for the next polling cycle. It didn’t do that right out of the box - I had to add the parm 80 that turns it on.

I appreciate the virtual switch suggestions, and will try those if I can’t get this simpler, one-line approach to work. Looks to me like the VS is just a way to set a variable flag.

I’m running out of usable hours today, but will give it another go soon and post back here.

[quote=“SirMeili, post:25, topic:179618”][quote=“Bulldoglowell, post:23, topic:179618”]So if you walk in the door, and you don’t want the light to cycle off in 10min, turn it off and on again quickly.

Of course… this depends on Vera’s response time to the switch and is likely to be kludge if you don’t have an instant update switch.[/quote]

I won’t need the above. the MultiSwitch will always be set to “off” when the light is turned off. So if I come in and turn it off, then back on, as long as the switch has time to report the 2 distinct triggers, it will work without the above. Nice idea though :)[/quote]

glad to see you ended up where you wanted to be :slight_smile: It is interesting to see your approach, trying to integrate things like “PartyMode” gives me something to thick about that I may not have otherwise.

I think I’m going to do something like that that triggers into party mode when my kids open and close the door to the patio/pool more than 50 times in 5 minutes!

@erkme73, if it takes five seconds for Vera to see the switch change status, extend the time in the condition to, say 20 seconds and try that.

AutoOff LightOn and (LightOn; Now > 10:00) and Not (!LightOn; LightOn < 20)

You can see what times Vera is seeing on PLEG’s Status report. Post it if you need help interpreting it.

[quote=“erkme73, post:27, topic:179618”]Well, when I switch the actual switch that’s part of the 18103 Aeon, the VERA GUI screen shows the change within 5 seconds. Not instant, but it’s also not waiting for the next polling cycle. It didn’t do that right out of the box - I had to add the parm 80 that turns it on.

I appreciate the virtual switch suggestions, and will try those if I can’t get this simpler, one-line approach to work. Looks to me like the VS is just a way to set a variable flag.

I’m running out of usable hours today, but will give it another go soon and post back here.[/quote]

I tested this and it works as well. I wasn’t sure it would work, but it does. I don’t even know why I thought it wouldn’t work. I actually like this more simple approach better. The only down side is that you can’t set it to not turn automatically off as part of a scene or other PLEG action without turning it off and back on programatically. If that’s not a concern, they I would definitely use this method:

AutoOff LightOn and (LightOn; Now > 10:00) and Not (!LightOn; LightOn < 10)

[quote=“Bulldoglowell, post:28, topic:179618”]glad to see you ended up where you wanted to be :slight_smile: It is interesting to see your approach, trying to integrate things like “PartyMode” gives me something to thick about that I may not have otherwise.

I think I’m going to do something like that that triggers into party mode when my kids open and close the door to the patio/pool more than 50 times in 5 minutes![/quote]

Thanks, the Party mode is pretty nice. The “scene” actually turns my “autoLock” MS button off, turns the “PartyMode” button on (on the same MultiSwitch), and unlocks the door. Then in PLEG, I have triggers for isNight and PartyMode and condition isNight AND PartyMode. The action is that it turns on lights in the house to specific levels. This way as a party goes from day to night, the house will auto light up (including the back porch and soon (this week) the backyard’s flood lights). It’s worked fairly well and I have my “good night” scene set to reset AutoLock to on and PartyMode to off so that no matter what, when I go to bed, it will lock the door and make sure it auto locks from then on (until the next party!!!).

I’m still getting used to PLEG and it’s a bit confusing at times (and I’m a programmer by trade!). I’m sure I will only get more and more stuff going through PLEG as time goes on and my HA system grows :slight_smile:

[quote=“RexBeckett, post:14, topic:179618”]I may not have understood what you are trying to achieve. If all you want to do is have a light automatically turned off after ten minutes - unless the switch was quickly turned on/off/on, this should do it:

Triggers
LightOn Light is turned on

Conditions
AutoOff LightOn and (LightOn; Now > 10:00) and Not (!LightOn; LightOn < 10)

Actions
AutoOff Turn Light off[/quote]

Well, Rex, it worked just fine. I upped the cycle timer to 15 seconds just to make sure I had enough time for switch to register with VERA. Turns out this entire time, it was self-inflicted grief (as it almost always is). I still had my original 2min timer running that I thought I’d deleted/disabled. Ugh.

Still, this was a great experience in understanding the logic, and troubleshooting - even if it reveals to the world how much egg I have on my face. Thanks to all for the suggestions and aid.