Author Topic: Are triggers And or Or?  (Read 2590 times)

Offline 416to305

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +0/-0
Are triggers And or Or?
« on: October 18, 2014, 09:43:31 am »
Sorry if this is a dumb question.  When I used the ISY or HomeSeer, adding triggers would always let you group them or pick and/or etc.  I'm assuming this has to be done with Luup code, but if I'm using UI7 and for example I want a lamp to come on when a device for weather shows either cloudy, overcast, thunderstorm, etc, what is the Vera doing with those triggers?  Like right now it lists them all like:

Device Trigger
World Weather: Condition Group is 'Cloudy/Overcast'

Device Trigger
World Weather: Condition Group is 'Mostly Cloudy'

Device Trigger
World Weather: Condition Group is 'Snow'

Device Trigger
World Weather: Condition Group is 'Thunderstorm'

How do I know if that is using all those conditions as And or Or?  I mean it can't really be and in this case so I assume or?  But what happens if I want to take it further and have the lamp come on only if the weather meets one of the criteria above AND if the Kitchen light is off?

Where that's confusing me is if I then add the Kitchen Light to a trigger, and I say "Off", it adds it like:

Device Trigger
Kitchen Light is turned off

With HomeSeer, the ISY etc, that would mean that it only triggers WHEN the light is turned off.  Where as if I want a condition to be the light has to be off, there would be a second option, basically "Device changes to off" or "Device is off".  So just confused here as well, does the above only run when the kitchen light is turned off?  Or is it a criteria meaning the other conditions are only true if and while the kitchen light is off?  Then how do I know if it is saying weather is one of the above AND the kitchen light is off, vs weather is one of the above OR the kitchen light is off? Just confused with that, thanks!

Offline Z-Waver

  • Master Member
  • *******
  • Posts: 4437
  • Karma: +247/-120
Re: Are triggers And or Or?
« Reply #1 on: October 18, 2014, 09:49:22 am »
By default, Vera's conditions/triggers are OR only.

To get AND functionality, you need to use your own Lua code or the Program Logic Event Generator(PLEG) plugin. I highly recommend PLEG.

Offline 416to305

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +0/-0
Re: Are triggers And or Or?
« Reply #2 on: October 18, 2014, 11:54:24 am »
Thanks I bought PLEG but I have no idea how to use it lol, the manuals are complicated but I'll see if I can figure it out since I definitely need the conditions to be grouped into or and and etc, thanks!

Offline 416to305

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +0/-0
Re: Are triggers And or Or?
« Reply #3 on: October 18, 2014, 12:04:04 pm »
Oops I bought the Program Logic Core and the Logic Timer one not the PLEG so will try that one out now.  Didn't realize you set things from it directly, I was thinking that it added functionality to the built in scenes module.  Thanks!

Offline Z-Waver

  • Master Member
  • *******
  • Posts: 4437
  • Karma: +247/-120
Re: Are triggers And or Or?
« Reply #4 on: October 18, 2014, 12:48:00 pm »
PLEG and the others offer free trials.

PLC is a requirement for running PLEG and several other plugins, I did not think it was licensed separately. If you contact @RichardTSchaefer he might be willing to exchange your PLT license for the PLEG one. Richard is very reasonable and very helpful on these forums.

As well as the official documentation and the countless examples on the forum, have a look at @Rexbeckett's PLEG Basics - An Introduction to the Program. It is an excellent tutorial.

Offline 416to305

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +0/-0
Re: Are triggers And or Or?
« Reply #5 on: October 18, 2014, 03:16:43 pm »
Unless I'm missing something it doesn't seem to work on UI7, which seems to be what Richard said in the other forum.  So doesn't seem to be an option.  Is it hard to do the same thing using code?  Otherwise I'll probably look at returning this and going back to the ISY unfortunately, as right now the built in scenes are far too limited and I'm finding this Lua stuff hard to understand.  It's too bad because the PLEG plug in seems pretty straight forward, it just doesn't work at all for me on UI7.

Offline integlikewhoa

  • Master Member
  • *******
  • Posts: 5620
  • Karma: +157/-380
Re: Are triggers And or Or?
« Reply #6 on: October 18, 2014, 03:22:56 pm »
PLEG should work on ui7. But like many plugins ui7 is a problem.  You best option is to downgrade to ui5 rather then returning VERA.  Then everything will work.

Offline Z-Waver

  • Master Member
  • *******
  • Posts: 4437
  • Karma: +247/-120
Re: Are triggers And or Or?
« Reply #7 on: October 19, 2014, 10:15:09 am »
Unless I'm missing something it doesn't seem to work on UI7, which seems to be what Richard said in the other forum.  So doesn't seem to be an option.  Is it hard to do the same thing using code?  Otherwise I'll probably look at returning this and going back to the ISY unfortunately, as right now the built in scenes are far too limited and I'm finding this Lua stuff hard to understand.  It's too bad because the PLEG plug in seems pretty straight forward, it just doesn't work at all for me on UI7.
Admittedly, I don't use UI7, so I can't speak definitely on this, however PLEG is described as mostly working on UI7, though there are several issues.

You can accomplish the same thing with Lua code just not as easily. Again @RexBeckett has done a fantastic tutorial with Conditional Scene Execution: Some Examples

Offline 416to305

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +0/-0
Re: Are triggers And or Or?
« Reply #8 on: October 19, 2014, 10:22:36 am »
Thanks all sorry forgot about this thread as was posting in the PLEG forum.  It doesn't work on UI7, you can't do conditions or actions on it, but I downgraded to UI5 and wow what a difference, it's so fast!