Sum of Data Points in a Data Source
-
Hey all,
I'm sure there's a simple solution to this, but my head is spinning trying to figure out everything going on with this software. Haven't had to mess with HTML/Javascript in about 15 years.
I just want to sum all the points on a data source. I have a modbus meter monitoring amperage on 42 circuits. Amps are the only points on the device. It can either be something in the page itself or an actual data point that I'm referencing.
-
@Trevor I would suggest setting up a meta data point on a meta data source that looks some thing like this -
You need to give every point a unique key but it doesn't matter what it is, also set them all to "Updates context".
-
Script for convenience
var total = 0; for (var key in CONTEXT_POINTS) { if (key != 'my') { total += this[key].value; } } return total;
-
Hey Jared,
Thanks! This is perfect.
Sorry to bother you with what are pretty basic questions, but I have a couple more.
Is there a way to import/export Menu Items and Custom Pages as JSON files? Or is there a way to find them in the file structure so I can build them outside of the app? This is going to end up being a fairly sizeable installation and I'm hoping to avoid adding/sorting/copying them by hand one at a time.
-
@trevor said in Sum of Data Points in a Data Source:
Is there a way to import/export Menu Items and Custom Pages as JSON files? Or is there a way to find them in the file structure so I can build them outside of the app? This is going to end up being a fairly sizeable installation and I'm hoping to avoid adding/sorting/copying them by hand one at a time.
The pages and menu items are stored in the JSON store. So if you go to the Configuration Import/Export page you can export the JSON store items there.
Another option is to add a user module that registers menu items and loads the pages from the file store.