Keeping Virtual Switches in Sync


#1

1) Give a description of the problem
I have a NAS and a PC as part of my media setup, both have their own virtual switch in ST and are working as required. I’d like to introduce a 3rd virtual switch called Media Server which controls both PC and NAS so I can turn when both on with on Alexa command.

Seems trivial and the sort of thing I have done multiple times before but for whatever reason the Media Server switch isn’t triggering.

2) What is the expected behaviour?
When PC AND NAS switches are on and Media Server is off then Turn on Media Server (and send some notifications).

3) What is happening/not happening?
The Media Server switch is not turning on unless I test the piston within webcore. I guess it’s something to do with how WebCore watches the state of PC and NAS as without me triggering it to check them, nothing is happening.

**4) Post a Green Snapshot of the piston![image|45x37]

nb. Switch 13 = Media Server / Switch 14 = NAS / Switch 17 = PC

5) Attach logs after turning logging level to Full
|+0ms|╔Received event [Home].time = 1624618383413 with a delay of -1247ms|
| — | — |
|+48ms|║RunTime Analysis CS > 19ms > PS > 6ms > PE > 22ms > CE|
|+50ms|║Runtime (40087 bytes) successfully initialized in 6ms (v0.3.110.20191009) (49ms)|
|+51ms|║╔Execution stage started|
|+58ms|║║Cancelling condition #7’s schedules…|
|+59ms|║║Condition #7 evaluated true (2ms)|
|+60ms|║║Cancelling condition #6’s schedules…|
|+61ms|║║Condition group #6 evaluated true (state changed) (5ms)|
|+64ms|║║Cancelling statement #12’s schedules…|
|+78ms|║║Executed physical command [Media Server].on() (10ms)|
|+80ms|║║Executed virtual command [Media Server].setSwitch (12ms)|
|+87ms|║║Sending external web request to: api.voicemonkey.io/trigger?access_token=xxxx;secret_token=xxxx&monkey=xxxx
|+411ms|║║Executed virtual command [Media Server].httpRequest (324ms)|
|+430ms|║║Executed virtual command [Media Server].sendPushNotification (15ms)|
|+433ms|║╚Execution stage complete. (381ms)|
|+434ms|╚Event processed successfully (434ms)|
|25/06/2021, 11:52:53 +292ms|
|+0ms|╔Received event [Home].test = 1624618373288 with a delay of 3ms|
|+69ms|║RunTime Analysis CS > 23ms > PS > 7ms > PE > 39ms > CE|
|+72ms|║Runtime (40078 bytes) successfully initialized in 7ms (v0.3.110.20191009) (70ms)|
|+73ms|║╔Execution stage started|
|+88ms|║║Comparison (enum) off is (string) off = true (1ms)|
|+90ms|║║Condition #20 evaluated true (10ms)|
|+104ms|║║Comparison (enum) on stays (string) on = true (2ms)|
|+108ms|║║Comparison (enum) on stays (string) on = true (3ms)|
|+120ms|║║Adding a timed trigger schedule for condition 7|
|+126ms|║║Cancelling condition #7’s schedules…|
|+127ms|║║Condition #7 evaluated false (36ms)|
|+129ms|║║Cancelling condition #6’s schedules…|
|+130ms|║║Condition group #6 evaluated false (state changed) (52ms)|
|+147ms|║║Comparison (enum) on stays (string) off = false (2ms)|
|+151ms|║║Comparison (enum) on stays (string) off = false (2ms)|
|+154ms|║║Cancelling any timed trigger schedules for condition 19|
|+156ms|║║Cancelling statement #19’s schedules…|
|+157ms|║║Condition #19 evaluated false (22ms)|
|+159ms|║║Condition group #18 evaluated false (state did not change) (24ms)|
|+190ms|║╚Execution stage complete. (117ms)|
|+199ms|║Setting up scheduled job for Fri, Jun 25 2021 @ 11:53:03 AM BST (in 9.923s)|
|+207ms|╚Event processed successfully (208ms)|


#2

I’d recommend try changing Conditions and Triggers position.
For a healthy piston, always triggers first, conditions later.

Switch the following lines,
21 X 19

One other suggestion is,
using “Stay on for 10 seconds” for both switch may cause a problem for triggering the piston.


#3

Swapping the lines worked, cheers!


#4

you are welcome…
if you click on SOLVED that would help others in the future…