Virtual device type for prev/next loop?


#1

1) Give a description of the problem
Bare (bear?) with me. This is day 2 of using WebCoRE. FWIW, I’m a software engineer by trade.

Ultimately, I’m trying to get a Prev & Next button on an ActionTiles dashboard that cycle through Hue color schemes (using Hue B Smart scenes) in a particular room. If you were at the first scene and hit Prev, you’d end up at the last & vice-versa. I’m struggling with the virtual device types. Because switches retain their On (Next) state and I can’t get them to accept another On (Next) command to trigger the piston. When I attemped to reset the button states, the piston got stuck in a loop and kept firing until I paused it.

2) What is the expected behavior?
Next -> Next -> Next … or On -> On -> On if a virtual switch… should work & fire subsequent events.

3) What is happening/not happening?
Once a virtual switch is in the On state, it refuses to fire another On command. I tried a different button type to no avail.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
This is me clicking On On On On, Off Off Off Off … Only 1 On and 1 Off event fire.
2/22/2018, 9:34:11 AM +207ms
+1ms ╔Received event [Office Lights Toggle].switch = off with a delay of 61ms
+121ms ║RunTime Analysis CS > 17ms > PS > 60ms > PE > 45ms > CE
+124ms ║Runtime (41318 bytes) successfully initialized in 60ms (v0.2.102.20180116) (122ms)
+125ms ║╔Execution stage started
+145ms ║║Comparison (enum) off is (string) off = true (2ms)
+147ms ║║Cancelling condition #3’s schedules…
+149ms ║║Cancelling statement #4’s schedules…
+154ms ║║Executed virtual command setVariable (2ms)
+156ms ║║Condition #3 evaluated true (15ms)
+157ms ║║Cancelling condition #2’s schedules…
+157ms ║║Condition group #2 evaluated true (state changed) (17ms)
+160ms ║║Cancelling statement #11’s schedules…
+175ms ║║Calculating (integer) 7 + (integer) -1 >> (integer) 6
+177ms ║║Calculating (integer) 6 < (integer) 0 >> (boolean) false
+183ms ║║Calculating (integer) 7 + (integer) -1 >> (integer) 6
+189ms ║║Executed virtual command setVariable (3ms)
+192ms ║║Cancelling statement #6’s schedules…
+217ms ║║Executed virtual command setVariable (4ms)
+220ms ║║Cancelling statement #8’s schedules…
+252ms ║║Executed virtual command [Office - Lightroom].sendPushNotification (16ms)
+1546ms ║║Executed physical command [Office - Lightroom].push() (1293ms)
+1547ms ║║Executed [Office - Lightroom].push (1293ms)
+1550ms ║╚Execution stage complete. (1424ms)
+1551ms ╚Event processed successfully (1551ms)
2/22/2018, 9:33:57 AM +380ms
+1ms ╔Received event [Office Lights Toggle].switch = on with a delay of 55ms
+78ms ║RunTime Analysis CS > 13ms > PS > 38ms > PE > 28ms > CE
+81ms ║Runtime (41315 bytes) successfully initialized in 38ms (v0.2.102.20180116) (78ms)
+82ms ║╔Execution stage started
+99ms ║║Comparison (enum) on is (string) off = false (2ms)
+101ms ║║Cancelling condition #3’s schedules…
+102ms ║║Condition #3 evaluated false (8ms)
+103ms ║║Cancelling condition #2’s schedules…
+104ms ║║Condition group #2 evaluated false (state changed) (10ms)
+107ms ║║Cancelling statement #11’s schedules…
+317ms ║║Calculating (integer) 6 + (integer) 1 >> (integer) 7
+322ms ║║Calculating (integer) 7 < (integer) 0 >> (boolean) false
+329ms ║║Calculating (integer) 6 + (integer) 1 >> (integer) 7
+334ms ║║Executed virtual command setVariable (3ms)
+337ms ║║Cancelling statement #6’s schedules…
+360ms ║║Executed virtual command setVariable (3ms)
+364ms ║║Cancelling statement #8’s schedules…
+387ms ║║Executed virtual command [Office - Nightlight].sendPushNotification (11ms)
+714ms ║║Executed physical command [Office - Nightlight].push() (326ms)
+715ms ║║Executed [Office - Nightlight].push (327ms)
+718ms ║╚Execution stage complete. (637ms)
+719ms ╚Event processed successfully (719ms)


#2

If I’m understanding you correctly, you just want a button that you can hit to go to the next scene, and another button that will go to the previous scene? Instead of using an on/off switch, I would use the “Momentary Button Tile” in the ST IDE for your virtual button.

Then you can set up your piston for each button without worrying whether it is in the “on” or “off” state.


#3

Thanks @acd37. I’m pretty new to SmartThings altogether. I was under the impression that the only virtual devices I could create/that WebCoRE would support were a subset of the ones that started with ‘Simulated’.

Any ideas why my events might be firing multiple times? When I click a button, the lighting changes and then a few seconds later changes again. Almost as if there is like a keydown / keyup effect on the momentary buttons.


#4

Sorry for the delay. Today has been crazy hectic at work. I’ll take a look at your green snapshot tomorrow!