This object is in archive! 

Logical operator in WHEN trigger condition does not work

Mattias Backman shared this problem 9 years ago
Known

I thought that it would be allowed to use logical expressions in the WHEN trigger condition and have it trigger when the logical result changed and evaluated to TRUE.


That seems to not work, since if I use something like

  1. WHEN (A AND B)

the rule runs when switch A is inactive and B changes to active. That's not what I expected. I also have tried triggers such as

  1. WHEN ( scheduleC AND ( luminosityD < 200 ) )

and thought that it would trigger on the scheduled time only if the luminosity value for sensor D is less than 200.


Does anyone know exactly what is allowed in the WHEN condition? Not everyhing that fits in the puzzle will work.


I also use

  1. WHEN ( luminosity < 200 ) {
  2. do my stuff...
  3. }

do I have to change that to

  1. WHEN ( luminosityC ) {
  2. IF ( luminosityC >= 200 ) {
  3. STOP
  4. }
  5. ELSE {
  6. do my stuff...
  7. }
  8. }

to make it work?

Replies (6)

photo
1

Use


When (LUM)=!0

If (LUM) >= 200

light x = On

Else

light x = Off


And first one:


When Lamp x= ANY and Lamp y = ANY

If lamp x = True

etc

Else

Lamp y = True

etc


etc

photo
4

Thanks. Yes, that would work. I'm really mostly curious about if "my way" should work and I'm experiencing a bug or if I'm not supposed to try to do more in the WHEN condition.


As a programmer it gives me a very bad itch to have "write" these clumsy IF-clauses inside a rule when I really didn't want that rule to have started at all. I have had the box a couple of weeks and I already have ~50 rules, many of which have the same WHEN condition because of this issue. It gets messy pretty quickly.


I think at least that whatever is allowed in the WHEN clause should get a different shape from the other logical operators, and that the WHEN piece should have a that unique shape slot. That way something would have told me not to try to be clever.

photo
1

I have the same concerns as rules will execute a lot of times and do nothing.

photo
1

I think something like LUA or javascript support for script coding will be great!

photo
1

Hi, My rule

When Sensor Luminance < 200

Send message

Save

works fine. (aeotec multisensor).

But I receive mails with intervals of 12 or 24 minutes. I don't know where this frequency comes from and why it is not always the same interval.

All G-reports are configured at 600 seconds (=10 minutes)

Wakeup interval = 8 mins.

Timeout after no motion = 60 sec.


Any ideas?

photo
1

I do have an answer on the question why the message is not sent every 12 minutes but often in multiples of 12 minutes: it is because the system (I suppose "the sensor") only reports/triggers when there is a change in value.

Still, need an answer why it is 12 minutes (G-report interval = 10 minutes). When I changed the G-report interval (for luminance) to 5 minutes, the message interval became 8 minutes...


Any explanation?

Leave a Comment
 
Attach a file