Multistate button -9tg4

buttons

#1

1) Give a description of the problem
I have a push button and 4 lamps. For each push I want to turn on a lamp.
push 1: Turn on lamp 1
push 2: thurn on lamp 1 2
push 3: turn on lamp 1 2 3
push 4: lamp 1 2 3 4
push 5: turn OFF lamp 1 2 3 4

template: 9tg4 see below

2) What is the expected behaviour?
not sure how to do it. Tried with case and adding 1 to a variable. not sure if the expression is correct as it doesnt seem to add 1 to the variable.

3) What is happening/not happening?
variable stays 0 , lamps dont do anything

5) Attach logs after turning logging level to Full
1/13/2020, 7:02:26 PM +569ms
+2ms ╔Received event [IKEA TRÅDFRI Remote].button = pushed with a delay of 91ms
+85ms ║RunTime Analysis CS > 18ms > PS > 53ms > PE > 14ms > CE
+88ms ║Runtime (40285 bytes) successfully initialized in 53ms (v0.3.110.20191009) (86ms)
+89ms ║╔Execution stage started
+99ms ║║Comparison (enum) pushed gets (string) pushed = true (4ms)
+101ms ║║Condition #2 evaluated true (7ms)
+102ms ║║Condition group #1 evaluated true (state did not change) (9ms)
+104ms ║║Cancelling statement #3’s schedules…
+110ms ║║Calculating (integer) 0 + (integer) 1 >> (integer) 1
+113ms ║║Executed virtual command setVariable (1ms)
+131ms ║║Executed virtual command sendPushNotification (15ms)
+135ms ║║Evaluating switch with values [[i:6:null:0, v:[t:integer, v:1, vt:string]]]
+138ms ║║Comparison (integer) 1 is (integer) 1 = true (1ms)
+140ms ║║Cancelling statement #12’s schedules…
+147ms ║║Skipped execution of physical command [LB LIR BR30 RGB SY09].on([]) because it would make no change to the device. (2ms)
+148ms ║║Executed [LB LIR BR30 RGB SY09].on (4ms)
+150ms ║╚Execution stage complete. (61ms)
+151ms ╚Event processed successfully (151ms)


#2

I am about to walk out the door, but your line 17 will force “0” each and every cycle.

Normally, if the variable is going to be changed, we leave it (no value set) up top…

pic

This way, the variable only changes when we tell it to.


#3

thank you that helped.

It’s working now.


#4

Glad to hear!!