[RESOLVED] Piston to increase/decrease lights brightness using wireless dimmer switch remote


#1

1) Give a description of the problem
So when I run my piston by pressing the button connected to it, it runs two or three times making the brightness change too much. I have two separate pistons for brightness up and down to prevent it from going up then down like when I had one piston.

2) What is the expected behaviour?
Change brghtness of two lights by 20 percent

3) What is happening/not happening?
It’s changing by 20 percent but it’s happening multiple times

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full

Down(1 press):
04/04/2020, 22:40:19 +749ms
+1ms ╔Received event [Room Switch].button = pushed with a delay of 60ms
+10077ms ║RunTime Analysis CS > 14ms > PS > 10047ms > PE > 16ms > CE
+10078ms ║Piston waited at a semaphore for 10017ms
+10080ms ║Runtime (41406 bytes) successfully initialized in 10047ms (v0.3.110.20191009) (10078ms)
+10081ms ║╔Execution stage started
+10089ms ║║Comparison (enum) pushed gets (string) pushed = true (0ms)
+10090ms ║║Condition #24 evaluated true (5ms)
+10091ms ║║Condition group #23 evaluated true (state did not change) (6ms)
+10103ms ║║Comparison (integer) 80 is_inside_of_range (integer) 100 … (integer) 81 = false (2ms)
+10104ms ║║Cancelling condition #26’s schedules…
+10105ms ║║Condition #26 evaluated false (12ms)
+10106ms ║║Cancelling condition #25’s schedules…
+10107ms ║║Condition group #25 evaluated false (state changed) (15ms)
+10119ms ║║Comparison (integer) 80 is_inside_of_range (integer) 80 … (integer) 61 = true (1ms)
+10120ms ║║Cancelling condition #30’s schedules…
+10121ms ║║Condition #30 evaluated true (12ms)
+10122ms ║║Cancelling condition #29’s schedules…
+10123ms ║║Condition group #29 evaluated true (state changed) (13ms)
+10125ms ║║Cancelling statement #31’s schedules…
+10139ms ║║Executed physical command [Bedroom Lamp].setLevel([60]) (9ms)
+10139ms ║║Executed [Bedroom Lamp].setLevel (10ms)
+10151ms ║║Executed physical command [lightstrip].setLevel([60]) (8ms)
+10151ms ║║Executed [lightstrip].setLevel (10ms)
+10163ms ║║Comparison (integer) 80 is_inside_of_range (integer) 60 … (integer) 41 = false (2ms)
+10164ms ║║Condition #34 evaluated false (10ms)
+10165ms ║║Condition group #33 evaluated false (state did not change) (11ms)
+10176ms ║║Comparison (integer) 80 is_inside_of_range (integer) 40 … (integer) 21 = false (1ms)
+10178ms ║║Condition #38 evaluated false (10ms)
+10179ms ║║Condition group #37 evaluated false (state did not change) (11ms)
+10190ms ║║Comparison (integer) 80 is_inside_of_range (integer) 20 … (integer) 2 = false (2ms)
+10191ms ║║Condition #42 evaluated false (10ms)
+10192ms ║║Condition group #41 evaluated false (state did not change) (11ms)
+10194ms ║╚Execution stage complete. (113ms)
+10195ms ╚Event processed successfully (10195ms)
04/04/2020, 22:40:19 +697ms
+0ms ╔Received event [Room Switch].button = pushed with a delay of 70ms
+63ms ║RunTime Analysis CS > 18ms > PS > 31ms > PE > 15ms > CE
+66ms ║Runtime (41325 bytes) successfully initialized in 31ms (v0.3.110.20191009) (65ms)
+67ms ║╔Execution stage started
+74ms ║║Comparison (enum) pushed gets (string) pushed = true (1ms)
+75ms ║║Condition #24 evaluated true (4ms)
+76ms ║║Condition group #23 evaluated true (state did not change) (5ms)
+91ms ║║Comparison (integer) 100 is_inside_of_range (integer) 100 … (integer) 81 = true (1ms)
+92ms ║║Condition #26 evaluated true (14ms)
+93ms ║║Condition group #25 evaluated true (state did not change) (15ms)
+95ms ║║Cancelling statement #27’s schedules…
+120ms ║║Executed physical command [Bedroom Lamp].setLevel([80]) (18ms)
+121ms ║║Executed [Bedroom Lamp].setLevel (19ms)
+136ms ║║Executed physical command [lightstrip].setLevel([80]) (12ms)
+136ms ║║Executed [lightstrip].setLevel (13ms)
+150ms ║║Comparison (integer) 100 is_inside_of_range (integer) 80 … (integer) 61 = false (1ms)
+152ms ║║Condition #30 evaluated false (13ms)
+153ms ║║Condition group #29 evaluated false (state did not change) (14ms)
+171ms ║║Comparison (integer) 100 is_inside_of_range (integer) 60 … (integer) 41 = false (2ms)
+173ms ║║Condition #34 evaluated false (17ms)
+174ms ║║Condition group #33 evaluated false (state did not change) (18ms)
+187ms ║║Comparison (integer) 100 is_inside_of_range (integer) 40 … (integer) 21 = false (1ms)
+188ms ║║Condition #38 evaluated false (12ms)
+189ms ║║Condition group #37 evaluated false (state did not change) (13ms)
+203ms ║║Comparison (integer) 100 is_inside_of_range (integer) 20 … (integer) 2 = false (2ms)
+205ms ║║Condition #42 evaluated false (13ms)
+206ms ║║Condition group #41 evaluated false (state did not change) (14ms)
+208ms ║╚Execution stage complete. (142ms)
+209ms ╚Event processed successfully (210ms)
04/04/2020, 22:40:19 +327ms
+1ms ╔Received event [Room Switch].button = pushed with a delay of 89ms
+84ms ║RunTime Analysis CS > 21ms > PS > 47ms > PE > 16ms > CE
+86ms ║Runtime (41329 bytes) successfully initialized in 47ms (v0.3.110.20191009) (84ms)
+87ms ║╔Execution stage started
+96ms ║║Comparison (enum) pushed gets (string) pushed = true (3ms)
+97ms ║║Cancelling condition #24’s schedules…
+98ms ║║Condition #24 evaluated true (7ms)
+99ms ║║Cancelling condition #23’s schedules…
+100ms ║║Condition group #23 evaluated true (state changed) (9ms)
+116ms ║║Comparison (integer) 100 is_inside_of_range (integer) 100 … (integer) 81 = true (1ms)
+118ms ║║Cancelling condition #26’s schedules…
+119ms ║║Condition #26 evaluated true (17ms)
+120ms ║║Cancelling condition #25’s schedules…
+121ms ║║Condition group #25 evaluated true (state changed) (19ms)
+123ms ║║Cancelling statement #27’s schedules…
+148ms ║║Executed physical command [Bedroom Lamp].setLevel([80]) (19ms)
+149ms ║║Executed [Bedroom Lamp].setLevel (21ms)
+170ms ║║Executed physical command [lightstrip].setLevel([80]) (15ms)
+170ms ║║Executed [lightstrip].setLevel (17ms)
+186ms ║║Comparison (integer) 100 is_inside_of_range (integer) 80 … (integer) 61 = false (2ms)
+187ms ║║Condition #30 evaluated false (14ms)
+188ms ║║Condition group #29 evaluated false (state did not change) (15ms)
+204ms ║║Comparison (integer) 100 is_inside_of_range (integer) 60 … (integer) 41 = false (1ms)
+206ms ║║Cancelling condition #34’s schedules…
+207ms ║║Condition #34 evaluated false (17ms)
+208ms ║║Cancelling condition #33’s schedules…
+209ms ║║Condition group #33 evaluated false (state changed) (19ms)
+224ms ║║Comparison (integer) 100 is_inside_of_range (integer) 40 … (integer) 21 = false (1ms)
+226ms ║║Condition #38 evaluated false (15ms)
+227ms ║║Condition group #37 evaluated false (state did not change) (16ms)
+242ms ║║Comparison (integer) 100 is_inside_of_range (integer) 20 … (integer) 2 = false (1ms)
+244ms ║║Condition #42 evaluated false (15ms)
+245ms ║║Condition group #41 evaluated false (state did not change) (15ms)
+247ms ║╚Execution stage complete. (160ms)
+248ms ╚Event processed successfully (248ms)

Up(1 press):

04/04/2020, 22:42:33 +408ms
+1ms ╔Received event [Room Switch].button = pushed with a delay of 65ms
+10113ms ║RunTime Analysis CS > 24ms > PS > 10064ms > PE > 24ms > CE
+10114ms ║Piston waited at a semaphore for 10016ms
+10116ms ║Runtime (42226 bytes) successfully initialized in 10064ms (v0.3.110.20191009) (10114ms)
+10117ms ║╔Execution stage started
+10124ms ║║Comparison (enum) pushed gets (string) pushed = true (0ms)
+10125ms ║║Condition #2 evaluated true (4ms)
+10126ms ║║Condition group #1 evaluated true (state did not change) (6ms)
+10143ms ║║Comparison (integer) 80 is_inside_of_range (integer) 80 .. (integer) 99 = true (2ms)
+10144ms ║║Cancelling condition #4's schedules...
+10145ms ║║Condition #4 evaluated true (17ms)
+10146ms ║║Cancelling condition #3's schedules...
+10147ms ║║Condition group #3 evaluated true (state changed) (20ms)
+10149ms ║║Cancelling statement #5's schedules...
+10205ms ║║Executed physical command [Bedroom Lamp].setLevel([100]) (50ms)
+10206ms ║║Executed [Bedroom Lamp].setLevel (51ms)
+10235ms ║║Executed physical command [lightstrip].setLevel([100]) (24ms)
+10236ms ║║Executed [lightstrip].setLevel (25ms)
+10255ms ║║Comparison (integer) 80 is_inside_of_range (integer) 60 .. (integer) 79 = false (2ms)
+10257ms ║║Cancelling condition #8's schedules...
+10258ms ║║Condition #8 evaluated false (19ms)
+10259ms ║║Cancelling condition #7's schedules...
+10260ms ║║Condition group #7 evaluated false (state changed) (21ms)
+10278ms ║║Comparison (integer) 80 is_inside_of_range (integer) 40 .. (integer) 59 = false (1ms)
+10279ms ║║Condition #12 evaluated false (17ms)
+10280ms ║║Condition group #11 evaluated false (state did not change) (18ms)
+10296ms ║║Comparison (integer) 80 is_inside_of_range (integer) 20 .. (integer) 39 = false (1ms)
+10298ms ║║Condition #16 evaluated false (16ms)
+10299ms ║║Condition group #15 evaluated false (state did not change) (17ms)
+10315ms ║║Comparison (integer) 80 is_inside_of_range (integer) 1 .. (integer) 19 = false (2ms)
+10316ms ║║Condition #20 evaluated false (15ms)
+10317ms ║║Condition group #19 evaluated false (state did not change) (16ms)
+10319ms ║╚Execution stage complete. (203ms)
+10320ms ╚Event processed successfully (10320ms)
04/04/2020, 22:42:33 +370ms
+1ms ╔Received event [Room Switch].button = pushed with a delay of 62ms
+10095ms ║RunTime Analysis CS > 20ms > PS > 10055ms > PE > 20ms > CE
+10096ms ║Piston waited at a semaphore for 10014ms
+10098ms ║Runtime (42226 bytes) successfully initialized in 10055ms (v0.3.110.20191009) (10096ms)
+10099ms ║╔Execution stage started
+10105ms ║║Comparison (enum) pushed gets (string) pushed = true (0ms)
+10107ms ║║Condition #2 evaluated true (4ms)
+10108ms ║║Condition group #1 evaluated true (state did not change) (5ms)
+10122ms ║║Comparison (integer) 80 is_inside_of_range (integer) 80 .. (integer) 99 = true (2ms)
+10123ms ║║Cancelling condition #4's schedules...
+10124ms ║║Condition #4 evaluated true (15ms)
+10125ms ║║Cancelling condition #3's schedules...
+10126ms ║║Condition group #3 evaluated true (state changed) (17ms)
+10128ms ║║Cancelling statement #5's schedules...
+10178ms ║║Executed physical command [Bedroom Lamp].setLevel([100]) (45ms)
+10179ms ║║Executed [Bedroom Lamp].setLevel (47ms)
+10201ms ║║Executed physical command [lightstrip].setLevel([100]) (18ms)
+10202ms ║║Executed [lightstrip].setLevel (20ms)
+10219ms ║║Comparison (integer) 80 is_inside_of_range (integer) 60 .. (integer) 79 = false (2ms)
+10221ms ║║Cancelling condition #8's schedules...
+10221ms ║║Condition #8 evaluated false (16ms)
+10222ms ║║Cancelling condition #7's schedules...
+10223ms ║║Condition group #7 evaluated false (state changed) (19ms)
+10236ms ║║Comparison (integer) 80 is_inside_of_range (integer) 40 .. (integer) 59 = false (1ms)
+10238ms ║║Condition #12 evaluated false (13ms)
+10239ms ║║Condition group #11 evaluated false (state did not change) (14ms)
+10253ms ║║Comparison (integer) 80 is_inside_of_range (integer) 20 .. (integer) 39 = false (1ms)
+10254ms ║║Condition #16 evaluated false (13ms)
+10255ms ║║Condition group #15 evaluated false (state did not change) (14ms)
+10269ms ║║Comparison (integer) 80 is_inside_of_range (integer) 1 .. (integer) 19 = false (1ms)
+10271ms ║║Condition #20 evaluated false (13ms)
+10272ms ║║Condition group #19 evaluated false (state did not change) (14ms)
+10274ms ║╚Execution stage complete. (174ms)
+10274ms ╚Event processed successfully (10274ms)
04/04/2020, 22:42:33 +265ms
+1ms ╔Received event [Room Switch].button = pushed with a delay of 64ms
+78ms ║RunTime Analysis CS > 21ms > PS > 39ms > PE > 18ms > CE
+80ms ║Runtime (42153 bytes) successfully initialized in 39ms (v0.3.110.20191009) (78ms)
+81ms ║╔Execution stage started
+88ms ║║Comparison (enum) pushed gets (string) pushed = true (1ms)
+90ms ║║Cancelling condition #2's schedules...
+91ms ║║Condition #2 evaluated true (5ms)
+92ms ║║Cancelling condition #1's schedules...
+92ms ║║Condition group #1 evaluated true (state changed) (7ms)
+107ms ║║Comparison (integer) 60 is_inside_of_range (integer) 80 .. (integer) 99 = false (2ms)
+109ms ║║Condition #4 evaluated false (15ms)
+110ms ║║Condition group #3 evaluated false (state did not change) (16ms)
+124ms ║║Comparison (integer) 60 is_inside_of_range (integer) 60 .. (integer) 79 = true (2ms)
+126ms ║║Cancelling condition #8's schedules...
+126ms ║║Condition #8 evaluated true (14ms)
+127ms ║║Cancelling condition #7's schedules...
+128ms ║║Condition group #7 evaluated true (state changed) (16ms)
+130ms ║║Cancelling statement #9's schedules...
+162ms ║║Executed physical command [Bedroom Lamp].setLevel([80]) (26ms)
+163ms ║║Executed [Bedroom Lamp].setLevel (27ms)
+180ms ║║Executed physical command [lightstrip].setLevel([80]) (13ms)
+181ms ║║Executed [lightstrip].setLevel (14ms)
+196ms ║║Comparison (integer) 60 is_inside_of_range (integer) 40 .. (integer) 59 = false (2ms)
+197ms ║║Condition #12 evaluated false (13ms)
+198ms ║║Condition group #11 evaluated false (state did not change) (14ms)
+213ms ║║Comparison (integer) 60 is_inside_of_range (integer) 20 .. (integer) 39 = false (2ms)
+215ms ║║Condition #16 evaluated false (14ms)
+216ms ║║Condition group #15 evaluated false (state did not change) (15ms)
+231ms ║║Comparison (integer) 60 is_inside_of_range (integer) 1 .. (integer) 19 = false (2ms)
+232ms ║║Condition #20 evaluated false (14ms)
+233ms ║║Condition group #19 evaluated false (state did not change) (15ms)
+236ms ║╚Execution stage complete. (155ms)
+237ms ╚Event processed successfully (237ms)
04/04/2020, 22:40:19 +745ms
+1ms ╔Received event [Room Switch].button = pushed with a delay of 56ms
+10073ms ║RunTime Analysis CS > 16ms > PS > 10041ms > PE > 15ms > CE
+10074ms ║Piston waited at a semaphore for 10012ms
+10076ms ║Runtime (42234 bytes) successfully initialized in 10041ms (v0.3.110.20191009) (10075ms)
+10077ms ║╔Execution stage started
+10084ms ║║Comparison (enum) pushed gets (string) pushed = false (1ms)
+10086ms ║║Condition #2 evaluated false (4ms)
+10087ms ║║Condition group #1 evaluated false (state did not change) (5ms)
+10088ms ║╚Execution stage complete. (12ms)
+10089ms ╚Event processed successfully (10089ms)
04/04/2020, 22:40:19 +704ms
+1ms ╔Received event [Room Switch].button = pushed with a delay of 77ms
+78ms ║RunTime Analysis CS > 17ms > PS > 45ms > PE > 16ms > CE
+80ms ║Runtime (42153 bytes) successfully initialized in 45ms (v0.3.110.20191009) (78ms)
+81ms ║╔Execution stage started
+88ms ║║Comparison (enum) pushed gets (string) pushed = false (1ms)
+89ms ║║Condition #2 evaluated false (4ms)
+90ms ║║Condition group #1 evaluated false (state did not change) (6ms)
+92ms ║╚Execution stage complete. (10ms)
+93ms ╚Event processed successfully (92ms)
04/04/2020, 22:40:19 +312ms
+1ms ╔Received event [Room Switch].button = pushed with a delay of 73ms
+61ms ║RunTime Analysis CS > 16ms > PS > 30ms > PE > 16ms > CE
+64ms ║Runtime (42148 bytes) successfully initialized in 30ms (v0.3.110.20191009) (63ms)
+65ms ║╔Execution stage started
+74ms ║║Comparison (enum) pushed gets (string) pushed = false (3ms)
+75ms ║║Cancelling condition #2's schedules...
+76ms ║║Condition #2 evaluated false (7ms)
+77ms ║║Cancelling condition #1's schedules...
+78ms ║║Condition group #1 evaluated false (state changed) (10ms)
+80ms ║╚Execution stage complete. (16ms)
+81ms ╚Event processed successfully (81ms)

#2

The logs show three button pushed events being received for every button push, so the piston seems to behaving as expected. The question is why there are three and whether anything can be done about it at source, or whether you’ll have to debounce the button in the pistons.


#3

There’s nothing that I can do on the source end. It’s an Eria AudroSmart dimmer switch and the ST integration is fairly new. I have to fix it in the piston code to get it to react to only one press event. I have been working on it and was able to add a variable that counts the number of events it’s received so it will only run once. However, the problem now lies in the fact that in order to reset the variable so it can run again, I have to wait at least 10 seconds because when there’s a third button press the piston usually runs it 10 seconds later. But having to wait 10 seconds for it to do so is not ideal given that it’s meant to be a quick way to in/decrease the brightness at the wall.


#4

So plot twist, I have figured it out. I enabled parallelism and reduced the wait time for resetting the variable to 1 second and now it works very smoothly.

Dimming Up:

Dimming Down:


#5

I just came onto the forum to suggest trying that, so it is good know it works.