I am Lazy, WebCore Global Vars editing

Is there a way or an improvement to editing the global variables in WebCore?
I always have to edit a random Piston just to change/add/remove a global variable.
First world problem I know.
@ipaterson

3 Likes

Agreed. It sucks you have to edit a piston to get access to globals.

You can use the Hub variables instead, and they automatically populate in Webcore like any other Webcore global variable, but they are marked with @@. They can be set in the Hub Variables outside of webcore.

I ended up just writing my own data drivers so that I store my global variables in a device, which is basically what a Hub Variable device is, but it only stores one state called variable. I make a custom driver with many state attributes for each global variable I want to store, and a set command method to set them.

This is a good starting example, but instead of attribute names like "stringVariable" you make as many variables as you need, called the name of the global variable you had in Webcore.

Then you can also add logic to work on your data. This is my current Front Sensor Data storage driver, it has progressed to also controlling all the logic for motion timeouts.

3 Likes