Scene with logical AND triggers

You can certainly have multiple schedules, but I’m at a loss to understand AND in relation to those. Would that be, for example, on the fifth day of the month if it’s a Wednesday? Seems a bit esoteric to me!

I’ll try that tonight to see if it works for schedules.

I don’t see how it can, since a schedule is a moment in time, not a continuing state.

Ah, but maybe the meaning is ALL the trigger states true AND a scheduled event starts the scene.

Who knows?! Seems like it can get confusing from now on.

I still have not gotten the chance to check my wife’s iOS phone, but I ran the Luup Request for scenes and I do see where it says “OR” in it. Does this mean that with some proper modification the AND function could be on its way to everyone?

{ "name": "Nightlight motion", "room": "8", "triggers_operator": "OR", "groups": [ { "delay": 0, "actions": [ { "device": "23", "service": "urn:upnp-org:serviceId:Dimming1", "action": "SetLoadLevelTarget", "arguments": [ { "name": "newLoadlevelTarget", "value": 6 } ] } ] }, { "delay": 900, "actions": [ { "device": "23", "service": "urn:upnp-org:serviceId:Dimming1", "action": "SetLoadLevelTarget", "arguments": [ { "name": "newLoadlevelTarget", "value": 0 } ] } ] } ], "triggers": [ { "name": "", "enabled": 1, "template": "3", "device": "81", "arguments": [ ], "last_run": 1501502312, "last_eval": 0 } ], "timers": [ ], "users": "", "modeStatus": "3", "lua": "bG9jYWwgcFN0YXJ0ID0gIjIxOjMwIiAgIC0tIFN0YXJ0IG9mIHRpbWUgcGVyaW9kCmxvY2FsIHBFbmQgPSAiMDY6MDAiICAgICAtLSBFbmQgb2YgdGltZSBwZXJpb2QKbG9jYWwgYWxsb3cgPSB0cnVlICAgICAgIC0tIHRydWUgcnVucyBzY2VuZSBkdXJpbmcgcGVyaW9kLCBmYWxzZSBibG9ja3MgaXQKbG9jYWwgaFMsIG1TID0gc3RyaW5nLm1hdGNoKHBTdGFydCwiKCVkKyklOiglZCspIikKbG9jYWwgbVN0YXJ0ID0gKGhTICogNjApICsgbVMKbG9jYWwgaEUsIG1FID0gc3RyaW5nLm1hdGNoKHBFbmQsIiglZCspJTooJWQrKSIpCmxvY2FsIG1FbmQgPSAoaEUgKiA2MCkgKyBtRQpsb2NhbCB0Tm93ID0gb3MuZGF0ZSgiKnQiKQpsb2NhbCBtTm93ID0gKHROb3cuaG91ciAqIDYwKSArIHROb3cubWluCmlmIG1FbmQgPj0gbVN0YXJ0IHRoZW4KICAgICByZXR1cm4gKCgobU5vdyA+PSBtU3RhcnQpIGFuZCAobU5vdyA8PSBtRW5kKSkgPT0gYWxsb3cpCmVsc2UgCiAgICAgcmV0dXJuICgoKG1Ob3cgPj0gbVN0YXJ0KSBvciAobU5vdyA8PSBtRW5kKSkgPT0gYWxsb3cpCmVuZA==", "encoded_lua": 1, "id": 76, "Timestamp": 1497068889, "last_run": 1501477871 }

Yes, I don’t see why not. It’s relatively easy to retrieve the scene JSON (you’ve done that already), modify it, and then send it back to the scene (documented in the reference I gave earlier.)

Is it just me, using And condition with Day plugin do not work?

I created 2 schedule triggers - 1 every minute, and 1 every 2 minutes. Edited the scene in the iOS to ensure both were true to fire the notifcation. I got my first notification at 1 min, a double at 2 min, and a single at 3 min. Could be a timing issue since both could not be created at the exact same time, but when the scene was saved, I expected the timers to be synced. Not a very good test since Vera could be off by milliseconds.

Will try other ideas later in the week.

Are you saying that the timer structures in the scene have the triggers_operator attribute?

I highly doubt that the timers would by synched anyway. Vera has never done this (you might imagine that, for example, a one-minute timer would be synchronised to the minute, but it isn’t.)

That is why I posted the question …
In PLEG … timers change a state in Vera Scenes they are an instant in time.

So my question still stands … what is the behavior of the AND operator
when you have:

  1. Two Triggers and 1 Timers
  2. Two Triggers and 2 Timers
    I could do the experiment … but I am travelling right now.

[quote=“Don Phillips, post:27, topic:196815”]I created 2 schedule triggers - 1 every minute, and 1 every 2 minutes…

I got my first notification at 1 min, a double at 2 min, and a single at 3 min.[/quote]

This works this way as AND and OR and it is working as instructed. Expect a double at 4 minutes, a single at 5, a double at 6, a single at 7…

That only confirms that schedules are still ORed with respect to each other.
It does not state how they interact with TRIGGERS.

In my proposed scenario, with AND logic …

  1. TWO Conditions and 1 Timer
    Will the scene run on the Timers if either condition is false ?

2)) TWO Conditions and 2 Timers
Will the scenes run on BOTH timers if either condition is false? if both conditions are true ?

[quote=“Z-Waver, post:30, topic:196815”][quote=“Don Phillips, post:27, topic:196815”]I created 2 schedule triggers - 1 every minute, and 1 every 2 minutes…

I got my first notification at 1 min, a double at 2 min, and a single at 3 min.[/quote]

This works this way as AND and OR and it is working as instructed. Expect a double at 4 minutes, a single at 5, a double at 6, a single at 7…[/quote]

What I had expected was a single notification every 2 minutes since both schedules had to be true to send the notification.

[quote=“akbooer, post:28, topic:196815”]Are you saying that the timer structures in the scene have the triggers_operator attribute?

I highly doubt that the timers would by synched anyway. Vera has never done this (you might imagine that, for example, a one-minute timer would be synchronised to the minute, but it isn’t.)[/quote]

This is what I see:
{ “id”: 100, “name”: “Away Test”, “triggers_operator”: “AND”, “paused”: 1, “groups”: [ { “delay”: 0, “actions”: [ { “device”: “158”, “service”: “urn:richardgreen:serviceId:VeraAlert1”, “action”: “SendAlert”, “arguments”: [ { “name”: “Message”, “value”: “Away Test” }, { “name”: “Recipients”, “value”: “phillid2” } ] } ] } ], “timers”: [ { “id”: “1”, “name”: “”, “enabled”: 1, “type”: 1, “interval”: “1m”, “last_run”: 1501546443, “next_run”: 0 }, { “id”: “2”, “name”: “”, “enabled”: 1, “type”: 1, “interval”: “2m”, “last_run”: 1501546376, “next_run”: 0 } ], “users”: “”, “modeStatus”: “0”, “Timestamp”: 1501542576, “room”: 0 }

I have no clue how to interpret this.

Now add a trigger (i.e. some light being turned on) and see what happens over a 3 minute interval when the light is on, and when the light is off (Continue to use the AND logic).

I added a wall outlet as a trigger. When the outlet was turned on at 9:05:47, the IU reported the next run at 9:06:47, it sent me an alert at that time. At 9:07:47, I got the double alert, 9:08:47 a single alert.

I turned off the outlet, and the IU still said the next run of the scene was 9:09:47. But the alert did not come.

Turned the outlet back on and 1 alert at 9:10:47 and a double at 9:11:47.

I have it off (normally off until Christmas) and no alerts and I type this.

So it appears if you have a device trigger and a schedule, AND appears to work. A double schedule is just a schedule.

Here is an update:
{ “id”: 100, “name”: “Away Test”, “triggers_operator”: “AND”, “paused”: 0, “groups”: [ { “delay”: 0, “actions”: [ { “device”: “158”, “service”: “urn:richardgreen:serviceId:VeraAlert1”, “action”: “SendAlert”, “arguments”: [ { “name”: “Message”, “value”: “Away Test” }, { “name”: “Recipients”, “value”: “phillid2” } ] } ] } ], “triggers”: [ { “name”: “”, “enabled”: 1, “template”: “1”, “device”: “135”, “arguments”: [ { “id”: 1, “value”: “1” } ], “last_eval”: 0 } ], “timers”: [ { “id”: “1”, “name”: “”, “enabled”: 1, “type”: 1, “interval”: “1m”, “last_run”: 1501636607, “next_run”: 1501636667 }, { “id”: “2”, “name”: “”, “enabled”: 1, “type”: 1, “interval”: “2m”, “last_run”: 1501636607, “next_run”: 1501636727 } ], “users”: “”, “modeStatus”: “0”, “Timestamp”: 1501635998, “room”: 0, “last_run”: 1501636367 }

Nice test - makes sense entirely, within the constraints of Vera. You’re saying that a scheduled event is only run if ALL the trigger conditions are true (if triggers_operator is AND.) The AND/OR flag is indeed scene-wide (ie. not per trigger) so you’d have to have separate scenes if you wanted a more complex logical structure.

I formatted your scene code so that I could see it more clearly…

{ "Timestamp":1501635998, "groups":[{ "actions":[{ "action":"SendAlert", "arguments":[{ "name":"Message", "value":"Away Test" },{ "name":"Recipients", "value":"phillid2" }], "device":"158", "service":"urn:richardgreen:serviceId:VeraAlert1" }], "delay":0 }], "id":100, "last_run":1501636367, "modeStatus":"0", "name":"Away Test", "paused":0, "room":0, "timers":[{ "enabled":1, "id":"1", "interval":"1m", "last_run":1501636607, "name":"", "next_run":1501636667, "type":1 },{ "enabled":1, "id":"2", "interval":"2m", "last_run":1501636607, "name":"", "next_run":1501636727, "type":1 }], "triggers":[{ "arguments":[{ "id":1, "value":"1" }], "device":"135", "enabled":1, "last_eval":0, "name":"", "template":"1" }], "triggers_operator":"AND", "users":"" } nil

Does anyone have any clue when this will be implemented in Android, web versions of the UI?

Thanks for the test and the analysis.
That covers all of the boundary conditions I could think of.
So I believe the behavior is now well understood.
Just waiting for the final implementation.

We did not even know it existed in iOS - it may be months before fully implemented and who knows when or if it will be communicated.

My Vera iOS version is 3.5, which the App Store reports was issued 5/31/17. Reading through the version history, I cannot find that feature mentioned going back to December, 2015.

3+ years later (January 2021) and I’m not sure I see the ‘AND’ option in Android or the web UI yet.

It is in the app under add event, advanced options, add group of events. It is only available for the new Ezlo devices.

1 Like