SuperGlobal Variable Problem?


#1

I have a boolean global variable that is used between 2 instances of Webcore. Once instance sets the variable and the other reads it. When I look at the variable in both instances, one says True and the other says False. How can that happen? I checked, I have the 20191009 version of Webcore in both instances. Is there something I have to do to get the global variables in both instances to sync to each other?

BTW, my variable name is: @@HouseActivity


#2

im confused why you would want two different installs of webcore, why not just use one with both locations added to it


#3

This thread explains my observations on this…


By the way:
Global variables with @@ at the beginning are called superglobal variables


#4

Right. They’re the only ones that are common between different instances of Webcore.


#5

I stopped relying on “supers” for changing data… but they still work well for static data.


#6

:point_up:Good to know…


#7

I just read the thread that you pointed me to. Sounds like this has been an issue for a while. If I eliminate superglobals, then I will need to replicate the same or similar pistons in each Webcore instance that sets that variable, although that would create other problems. For me the whole point of using the super was to decrease network traffic from different pistons doing the same thing, and to only have 1 piston that controlled that task, so that I needn’t worry about updating multiple pistons when something needed to change.

As a workaround, did you ever try temporarily changing the variable to some dummy value, waiting a short time, then writing the real value to it? Although that would be a bad idea since it would reek havoc in any piston if you were monitoring that global for any changes.


#8

Changing the superglobal to a different dataPoint, and then back works… (about 85% of the time) For me, there is still about a 15% failure rate when updating Superglobals…


If my superglobal is a boolean that changes often, I now use Simulated Switches to perfectly pass data between instances. (on=true, off=false)


#9

Any one instance of Webcore can get bogged down with doing intensive tasks that would cause problems with other pistons. For example, some people have 1 instance just to control the icons on their dashboard. I have that, and also one other instance to control a critical house component. And I have a 3rd instance for all the other pistons that I have.


#10

Thanks, that’s a really good idea that I will steal! :slight_smile:


#11

It’s not stealing if I’m offering as a gift… :grin:


#12

Then, thanks for the gift.