I am developing an application for energy management , currently in my application every 15 minutes I receive a variable with the value of energy consumed I would like to know if it is possible to create another variable that stores the value of energy per day and from this new variable to store in some kind of table that I can consult in the future how much was spent on a specific day or even a specific month
You can directly query these aggregations without having to store anything separately. For example, if you’d like to request a specific day’s worth of energy consumption using a workflow, you can use the Data: Gauge Query Node.
When you choose the Custom
time range, you can specify the range duration, range end, and aggregation. The range end is specified in milliseconds since epoch. The duration is specified in milliseconds.
The example screenshot below returns 24 hours of data corresponding to 1/1/2023 (the range end is set to 1/2/2023 at 00:00:00, so the range stops at the beginning of 1/2). The aggregation Sum
will add every data point over that range, which will result in the total energy consumed over the 24 hours.
I understand, but would it be possible to store this value in a table with the first column containing the day in the format 02/01/2023 for example and another column containing the total energy spent on that day?
Yes, you can. You’d have to periodically calculate these values using a workflow and then store the resulting value using a Table: Insert Row Node.
I would likely recommend a Resource Job that runs daily.