Global Variable across 2 webCORE instances


#1

1) Give a description of the problem
Are global variables, ie. the one starting with “@”, really global to ST and/or webCORE

2) What is the expected behavior?
A value assigned to a global variable to be the same value across 2 or more webCore install instances

3) What is happening/not happening?
The above doesn’t appear to be true, at least not for me…

I have 2 instances of webCore installed. In my case they are

  • actions
  • notifications

In ACTIONS I set the global variable @HumidityTrigger each day at 5AM; it gets updated OK

In NOTIFICATIONS (where I basically just use the global variable) it shows a completely different value!!

[Both values / images are from my settings at 5AM today - so current]

Is my understanding of global variables incorrect?
I am doing something wrong?

Thanks in advance
J


#2

@Gopack2 didn’t you just accomplish something like this?


#3

Yes I did. I set a local variable to whatever you want it to be then pass it to another piston using arguments. In piston being passed to reference the variable with $args.{variable name}

See this post

It has 4 pistons that work together.

Hope that helps.

Gopack2


#4

Hi

Thanks for the reply, I read your link, but I’m not so sure it applies.
I do NOT want to pass parameters.
This is a GLOBAL variable.

The question is if GLOBAL variables are only accessible to all pistons of a given instance…
So if you install a 2nd copy of webCore you can no longer access the global vars in the earlier instance??

@ady624, may I impose on your schedule & ask for some clarification please. Reading between the lines it doesn’t appear possible currently. What are the chances of getting a “super” global var accessible form any installed webCore instance?

@Gopack2, if Adrian’s answer is as I suspect, I may very well have to investigate the passing of args. ARRRRGGGG!!! I’ll post here with my own findings this weekend.

J


#5

From my experience global variables are native to the webcore instance you are working with. Sorry, time to brush up on $args. :nerd_face:


#6

I don’t remember if I implemented same-location super globals. They start with @@. I know for sure the multi-location super globals do not work because they require intercomms that don’t yet exist. Try and see, just name the variable starting with @@ and see if it reflects in all instances of the SAME location.


#7

Not on my end it doesn’t :upside_down_face:


#8

I can confirm:

  • @ global variables do not natively exist for separate webCore instances in the same location
  • @@ super global variables do not natively exist for separate webCore instances in the same location
    (@Gopack2 also confirmed this)

I also created a super @@ global variable with same name in both my instances hoping they would “inherit” - no such luck!

@ady624 Adrian consider this an official request please - @@ super globals for all instances at the same location

Next to test: Passing of ARRRRGGGGGS; I’v used it in some of my pistons for the same instance, not across instances…

J


#9

Moved to feature suggestions. I know this was on the roadmap at some point already. Now it’s just a bump!


#10

@GatVlieg can you please try updating

v0.2.0fb.20171026 - BETA M2 - Partial support for super global variables - works within same location - no inter-location comms yet

Once updated, please visit the ST app and open each involved instance and tap Done - this will kickstart the subscription mechanism. I also changed global variable event name to insulate between instances - same @ variable name in two different instances might have been overlapping before. So if you rely on pistons expecting @ variable changes (subscribing to global var events), please pause and resume those pistons to allow them to subscribe correctly. To use super global variables, simply use two @ signs, i.e. @@name, @@test, @@superglobal, @@etc.


#11

Hi @ady624

Just implemented it. Seems to working like a charm. Special thanks for the super quick turn around time!
[Your time management is far superior to mine :blush: ]

For those wishing to use / test it, I have 2 sample pistons I created to verify it:

  • Global Vars - Sender - import code t7ov
  • Global Vars - Receiver - import code k9ub

Thanks
J


#12

@ady624 When/will it ever be possible for super global variables to work across two locations/instances, so 2 different signed in accounts? Or is it just not feasible?