Hi @jimtng,
may I ask for your help again how to parse and persist a JSON timeseries using a JRuby rule? I already get an error with a very simple rule I’ve created so far.
I’m pulling the JSON through the http binding using the Open-Meteo API.
My rule looks like this:
configuration: {}
triggers:
- id: "1"
configuration:
itemName: OpenMeteo_SSO
type: core.ItemStateUpdateTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
type: application/x-ruby
script: |
require "json"
#time_series = TimeSeries.new
data = JSON.parse(event.to_s)
logger.info "parsed data: #{data}"
type: script.ScriptAction
The Item OpenMeteo_SSO is containing the JSON string from this URL.
When executing that rule I get the following error:
2024-12-27 10:26:39.298 [ERROR] [.handler.AbstractScriptModuleHandler] - Script execution of rule with UID '10be2fb372' failed: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
My goal is to extract the timestamps and values into a timeseries Item.
Thanks!