Webcore Global Variables and Virtual Switch Toggle

Hello all,

Sorry If this sounds stupid. To put it simply, I have multiple Boolean Global variables in Webcore that function well. I have also setup some Virtual switch toggles that sync with the variable to show me the status of the variable in my Smarthings app and allow me to manually toggle.

However, I have noticed there appears to be a lag in the update of a global variable.

For Example: I have a @EnableMotionSensor Boolean Variable that before I run a routine which the lights might trigger a motion sensor I turn the @EnableMotionSensor = False. it sometimes it doesn’t seem to work so perfectly. Additionally, It My Variable/virtual switch Sync is not the most efficient. Although it works as expected, It may be running twice.

then It dawned on me, I could get rid of the Global Variable and my Virtual switch syncing pistons and just use the Virtual switch as my Global variable. This would allow me to still See and toggle my variables within the smartthings app and the switches would work as the global variable.

Would anyone advise against this? Would the Lag be greater using the Switch as my variable?

I stopped using Boolean a while ago because of the issue you described. I have found that setting up your own boolean argument to be more reliable.

For Example:
Define Variable
Dynamic=name_of_variable

Rule:
If blah blah blah
Then using name_of_variable
Value=true

If blah blah blah
Then using name_of_variable
Value=false

Works the same as boolean but for me, it’s more reliable

Now for the second part. I love using Virtual Switches in webCoRE because, just like you stated, it give me control and can also be automated.

For Example
Virtual Switch=HVAC Automation
Virtual Switch=HVAC

If
HVAC changes to on
And
HVAC Automation is on
Then using thermostats
Set to Cool

If HVAC changes to off
And
HVAC Automation is on
Then using thermostats
Set to Off

The beauty for me, is that I can automate the HVAC Automation and HVAC Virtual Switches totally separate from any Piston.

For Example,

If in Guest Mode
Then turn HVAC Automation Off

If outside temperature if above 90
Then turn HVAC Automation Off

If HVAC Automation stays off for 1 day
Then turn on

Alexa, turn HVAC Automation on

Etc…

YMMV

Global variable seem to be a sore point. I found concurrency with setting globals can “override” globals that are set from other pistons. I had to re-write all my room automation using locals as rontalley outlined. Also where I do need a “global” I now use a virtual switch for binary indicators.

1 Like

Webcore has its own forum. You’ll probably find existing discussion there on this topic. :sunglasses:

https://community.smartthings.com/t/introducing-the-new-webcore-community-forum/96259