Changes away from any of


#1

I’d like to use the “changes away from any of” trigger with a series of values, but I can’t figure out how to give it multiple values.

I tried comman delimiting the values in “compared to box” but it won’t like me.

I just need an array like 0,15,30,60.

Is this correct using expression instead of value? Thanks


#2

Yeah ok so the expression syntax above doesn’t work.

I’m now trying to use a variable Number List (integer), but… I can’t figure out how to initialize it with values.


#3

Hacky way around it is probably a switch/case, default is anything other than your values.


#4

Are you using “change away from any of”?


#5

I’m trying to do this, also, for comparing a level on a switch. Does anyone have an answer?


#6

Wow I just came back looking for this answer (still). How to I enter the 2nd and third possible values?


#7

You can write an Expression, although depending on your skills, it may be easier to stack multiple lines:

IF Lights level changes away from 25
   OR
   Lights level changes away from 50
   OR
   Lights level changes away from 75
      Then do stuff
END IF

#8

I’m guessing “changes away from any of” only works for device attributes that take an enumerated list, and you can’t give a list of arbitrary values (like 25,50,75 in my example above.


#9

I have not spent time trying to create an expression, so I can’t say it is impossible.
(however, it is 100% normal to have multiple triggers on multiple lines)

In fact, I cannot recall ever seeing two triggers on the same line.
(although combining two conditions is often easy)


#10

I just made it work for a dimmer percentage with the expression …

"25,50,75"


#11

I see - with or without the double quotes?

I ended up rewriting it to store the level I set it to in a variable (setLevel), so I could just see if it changes away from that one specific value. But it’s good to know!


#12

pic

You know… for science and all. :grin:


#13

With the double quotes. The piston Groovy code calls ‘tokenize()’ to split a string into a list on the comma. If you do it without the quotes you get Groovy errors in the logs complaining about attempting it on integers.

Starting level 48, followed by 75, 17, 51, 50, 14, 25 and 49.

Logs

13/07/2020, 07:46:44 +459ms
+2ms ╔Received event [Shed Virtual Temperature Test].level = 49 with a delay of 68ms
+55ms ║RunTime Analysis CS > 17ms > PS > 26ms > PE > 11ms > CE
+57ms ║Runtime (36382 bytes) successfully initialized in 26ms (v0.3.110.20191009) (55ms)
+58ms ║╔Execution stage started
+66ms ║║Comparison (integer) 49 changes_away_from_any_of (string) 25,50,75 = true (1ms)
+67ms ║║Cancelling condition #2’s schedules…
+68ms ║║Condition #2 evaluated true (6ms)
+69ms ║║Cancelling condition #1’s schedules…
+70ms ║║Condition group #1 evaluated true (state changed) (8ms)
+71ms ║╚Execution stage complete. (14ms)
+72ms ╚Event processed successfully (72ms)
13/07/2020, 07:37:52 +565ms
+2ms ╔Received event [Shed Virtual Temperature Test].level = 25 with a delay of 69ms
+51ms ║RunTime Analysis CS > 17ms > PS > 24ms > PE > 9ms > CE
+53ms ║Runtime (36376 bytes) successfully initialized in 24ms (v0.3.110.20191009) (50ms)
+53ms ║╔Execution stage started
+61ms ║║Comparison (integer) 25 changes_away_from_any_of (string) 25,50,75 = false (3ms)
+62ms ║║Cancelling condition #2’s schedules…
+63ms ║║Condition #2 evaluated false (5ms)
+63ms ║║Cancelling condition #1’s schedules…
+64ms ║║Condition group #1 evaluated false (state changed) (8ms)
+66ms ║╚Execution stage complete. (13ms)
+67ms ╚Event processed successfully (66ms)
13/07/2020, 07:37:47 +65ms
+2ms ╔Received event [Shed Virtual Temperature Test].level = 14 with a delay of 75ms
+60ms ║RunTime Analysis CS > 22ms > PS > 27ms > PE > 11ms > CE
+63ms ║Runtime (36382 bytes) successfully initialized in 27ms (v0.3.110.20191009) (59ms)
+63ms ║╔Execution stage started
+72ms ║║Comparison (integer) 14 changes_away_from_any_of (string) 25,50,75 = true (2ms)
+73ms ║║Cancelling condition #2’s schedules…
+74ms ║║Condition #2 evaluated true (7ms)
+75ms ║║Cancelling condition #1’s schedules…
+76ms ║║Condition group #1 evaluated true (state changed) (9ms)
+78ms ║╚Execution stage complete. (15ms)
+79ms ╚Event processed successfully (79ms)
13/07/2020, 07:37:43 +133ms
+1ms ╔Received event [Shed Virtual Temperature Test].level = 50 with a delay of 68ms
+51ms ║RunTime Analysis CS > 18ms > PS > 24ms > PE > 8ms > CE
+53ms ║Runtime (36381 bytes) successfully initialized in 24ms (v0.3.110.20191009) (51ms)
+53ms ║╔Execution stage started
+62ms ║║Comparison (integer) 50 changes_away_from_any_of (string) 25,50,75 = false (3ms)
+63ms ║║Condition #2 evaluated false (6ms)
+64ms ║║Condition group #1 evaluated false (state did not change) (7ms)
+66ms ║╚Execution stage complete. (12ms)
+67ms ╚Event processed successfully (66ms)
13/07/2020, 07:37:34 +571ms
+2ms ╔Received event [Shed Virtual Temperature Test].level = 51 with a delay of 68ms
+59ms ║RunTime Analysis CS > 20ms > PS > 28ms > PE > 10ms > CE
+61ms ║Runtime (36377 bytes) successfully initialized in 28ms (v0.3.110.20191009) (59ms)
+62ms ║╔Execution stage started
+71ms ║║Comparison (integer) 51 changes_away_from_any_of (string) 25,50,75 = false (3ms)
+73ms ║║Cancelling condition #2’s schedules…
+73ms ║║Condition #2 evaluated false (7ms)
+75ms ║║Cancelling condition #1’s schedules…
+75ms ║║Condition group #1 evaluated false (state changed) (9ms)
+77ms ║╚Execution stage complete. (15ms)
+78ms ╚Event processed successfully (78ms)
13/07/2020, 07:37:20 +833ms
+2ms ╔Received event [Shed Virtual Temperature Test].level = 17 with a delay of 69ms
+56ms ║RunTime Analysis CS > 19ms > PS > 26ms > PE > 11ms > CE
+58ms ║Runtime (36382 bytes) successfully initialized in 26ms (v0.3.110.20191009) (56ms)
+59ms ║╔Execution stage started
+69ms ║║Comparison (integer) 17 changes_away_from_any_of (string) 25,50,75 = true (3ms)
+71ms ║║Cancelling condition #2’s schedules…
+72ms ║║Condition #2 evaluated true (8ms)
+73ms ║║Cancelling condition #1’s schedules…
+74ms ║║Condition group #1 evaluated true (state changed) (10ms)
+76ms ║╚Execution stage complete. (17ms)
+78ms ╚Event processed successfully (77ms)
13/07/2020, 07:37:10 +373ms
+1ms ╔Received event [Shed Virtual Temperature Test].level = 75 with a delay of 72ms
+53ms ║RunTime Analysis CS > 17ms > PS > 23ms > PE > 12ms > CE
+55ms ║Runtime (36356 bytes) successfully initialized in 23ms (v0.3.110.20191009) (53ms)
+56ms ║╔Execution stage started
+65ms ║║Comparison (integer) 75 changes_away_from_any_of (string) 25,50,75 = false (2ms)
+66ms ║║Condition #2 evaluated false (6ms)
+67ms ║║Condition group #1 evaluated false (state did not change) (8ms)
+68ms ║╚Execution stage complete. (12ms)
+69ms ╚Event processed successfully (69ms)


#14

Beautiful example of multiple triggers on a single line!

Kudos :+1: