Groovy and values with timestamps

Hi all,
from Groovy and HttpRequest I’m getting the list of energy prices for the next day, 24 values, and I need to store them in an attribute. It seems that with assets.dispatch() I can’t include the timestamp, is it possible to do it from Groovy?

Thanks
paco

1 Like

Does anyone know if it’s possible to do this with Groovy? I was expecting not to have to create an agent in Java and have to stop and recompile the application again.

Hi Paco,

As these are forecast data, you can store them in the asset_predicted_datapoint table in the database. In Groovy, this can be done using:

import org.openremote.model.rules.PredictedDatapoints

PredictedDatapoints predictedDatapoints = binding.predictedDatapoints

Additionally, you can write a rule to update the attribute with the current forecast value at a desired interval, automatically storing the values with the Store data points configuration item.