EDIT: so yeah, i can’t get webcore to see the ‘held’ state even though the ST IDE sees it as ‘held’ and the ST app see it as ‘held’ but the log always says ‘received push’ so I am thinking that is the source of the problem but I have no idea how to fix it.
1) Give a description of the problem
The on/off functionality works just fine in my piston, and I would assume that the double press state is working as well as I just use it to flip a UP/DOWN state for dimming. The default at this point is just to ensure that the variable dimDirection gets a value since I did not assign a value at the beginning.
When I hold the button down I get no change in lighting, i have changed the + and - values to 20 to make sure it wasn’t just switching back and forth in an barely visible way and nothing changed. I am not sure why it doesn’t work because the code is fairly straight forward, I am thinking that it has something to do with the dimDirection variable not being initialized with a value but if I read the docs correctly you only want to set the variable initially if you want it to change back to that value on each run through the piston and I want it to kind of ‘float’ if that makes sense, to carry over the last value from the last run, maybe i don’t understand how to do that correctly.
2) What is the expected behaviour?
For the light to increase in brightness until getting to 100% then setting the dimDirection variable to DOWN so the next held state will decrease the light to 20% or less then switch back.
3) What is happening/not happening?
light switches on/off with ‘pushed’, not sure if double is working, and held is definitely not working.
The logs are such that I do a single press which turns the light on, I do a double press which seems to set the dimDirection variable for me but when I ‘hold’ the button it seems to just execute the single press stuff even though I hold it for at least 2 seconds. I will keep trying to find out whats going on but I need to know if that variable getting set in the logs will stay that way as long as the piston is running or is it getting reset after the piston runs through. If it is being reset do I need to make a global variable or how do I get one that keeps its value? Also why would the ‘held’ state activate the pushed state, they are both natively handled, I didn’t have to make my own device handler or anything, maybe thats needed?
**4) Post a Green Snapshot of the piston!
5) Attach logs after turning logging level to Full
9/8/2019, 4:51:19 PM +363ms
+1ms ╔Received event [Button].button = held with a delay of 104ms
+64ms ║RunTime Analysis CS > 13ms > PS > 31ms > PE > 20ms > CE
+67ms ║Runtime (45871 bytes) successfully initialized in 31ms (v0.3.10f.20190822) (66ms)
+68ms ║╔Execution stage started
+77ms ║║Comparison (enum) held gets (string) pushed = false (0ms)
+78ms ║║Condition #5 evaluated false (4ms)
+79ms ║║Condition group #2 evaluated false (state did not change) (6ms)
+83ms ║║Comparison (enum) held gets (string) double = false (1ms)
+85ms ║║Cancelling condition #6’s schedules…
+85ms ║║Condition #6 evaluated false (5ms)
+86ms ║║Cancelling condition #3’s schedules…
+87ms ║║Condition group #3 evaluated false (state changed) (7ms)
+92ms ║║Comparison (enum) held gets (string) held = true (1ms)
+93ms ║║Condition #22 evaluated true (5ms)
+94ms ║║Condition group #4 evaluated true (state did not change) (6ms)
+97ms ║║Evaluating switch with values [[i:23:null:0, v:[t:string, v:, vt:string]]]
+100ms ║║Comparison (string) is (string) UP = false (1ms)
+103ms ║║Comparison (string) is (string) DOWN = false (1ms)
+106ms ║╚Execution stage complete. (38ms)
+107ms ╚Event processed successfully (107ms)
9/8/2019, 4:51:15 PM +311ms
+2ms ╔Received event [Button].button = double with a delay of 104ms
+93ms ║RunTime Analysis CS > 21ms > PS > 44ms > PE > 27ms > CE
+181ms ║Runtime (45873 bytes) successfully initialized in 44ms (v0.3.10f.20190822) (177ms)
+182ms ║╔Execution stage started
+192ms ║║Comparison (enum) double gets (string) pushed = false (1ms)
+194ms ║║Cancelling condition #5’s schedules…
+195ms ║║Condition #5 evaluated false (6ms)
+196ms ║║Cancelling condition #2’s schedules…
+197ms ║║Condition group #2 evaluated false (state changed) (9ms)
+201ms ║║Comparison (enum) double gets (string) double = true (1ms)
+203ms ║║Cancelling condition #6’s schedules…
+204ms ║║Condition #6 evaluated true (6ms)
+205ms ║║Cancelling condition #3’s schedules…
+206ms ║║Condition group #3 evaluated true (state changed) (8ms)
+209ms ║║Evaluating switch with values [[i:7:null:0, v:[t:string, v:, vt:string]]]
+212ms ║║Comparison (string) is (string) UP = false (2ms)
+215ms ║║Comparison (string) is (string) DOWN = false (2ms)
+217ms ║║Cancelling statement #59’s schedules…
+221ms ║║Executed virtual command setVariable (1ms)
+224ms ║╚Execution stage complete. (42ms)
+225ms ╚Event processed successfully (225ms)
9/8/2019, 4:51:10 PM +492ms
+2ms ╔Received event [Button].button = pushed with a delay of 122ms
+86ms ║RunTime Analysis CS > 21ms > PS > 44ms > PE > 22ms > CE
+89ms ║Runtime (45872 bytes) successfully initialized in 44ms (v0.3.10f.20190822) (86ms)
+90ms ║╔Execution stage started
+100ms ║║Comparison (enum) pushed gets (string) pushed = true (3ms)
+102ms ║║Condition #5 evaluated true (6ms)
+102ms ║║Condition group #2 evaluated true (state did not change) (8ms)
+109ms ║║Evaluating switch with values [[i::6d6c440c3e060bb0c498be099189f911::switch, v:[t:enum, v:off, d::6d6c440c3e060bb0c498be099189f911:, a:switch, i:null, x:false, vt:string, p:a]]]
+112ms ║║Comparison (enum) off is (string) on = false (1ms)
+114ms ║║Cancelling statement #33’s schedules…
+132ms ║║Executed physical command [Smart Bulb 2].on() (15ms)
+133ms ║║Executed [Smart Bulb 2].on (17ms)
+135ms ║╚Execution stage complete. (46ms)
+136ms ╚Event processed successfully (136ms)