@rlkoshak
Rich,
Sorry to bump an old thread but I’ve tried to replicate your work but I keep getting the same error show up. Can you help me out please?
The JSON Response:
{
"status":"success",
"time":0.01,
"flags":{
},
"data":{
"device_type":"light",
"id":42349,
"label":"Ceiling Light",
"device_id":5164,
"power_state":0,
"startup_mode":0,
"aggregated_hourly_at":"2017-01-14T12:05:59.000Z",
"aggregated_daily_at":"2017-01-14T12:05:59.000Z",
"remote_id":1,
"timer1_enabled":null,
"timer1_on_time":null,
"timer1_off_time":null,
"timer1_monday":null,
"timer1_tuesday":null,
"timer1_wednesday":null,
"timer1_thursday":null,
"timer1_friday":null,
"timer1_saturday":null,
"timer1_sunday":null,
"timer2_enabled":null,
"timer2_on_time":null,
"timer2_off_time":null,
"timer2_monday":null,
"timer2_tuesday":null,
"timer2_wednesday":null,
"timer2_thursday":null,
"timer2_friday":null,
"timer2_saturday":null,
"timer2_sunday":null,
"timer3_enabled":null,
"timer3_on_time":null,
"timer3_off_time":null,
"timer3_monday":null,
"timer3_tuesday":null,
"timer3_wednesday":null,
"timer3_thursday":null,
"timer3_friday":null,
"timer3_saturday":null,
"timer3_sunday":null,
"extra_data":null,
"target_temperature":null,
"voltage":null,
"voltage_reported_at":null,
"frequency":null,
"real_power":null,
"reactive_power":null,
"created_at":"2017-01-14T12:05:59.000Z",
"updated_at":"2017-01-14T12:15:07.000Z",
"nest_thermostat_id":null,
"rate_limit_tokens_used":10,
"rate_limit_tokens_updated_at":"2017-04-14T18:59:23.000Z",
"device_groups":[
{
"id":38337,
"name":"Nathan \u0026 Jess Room",
"user_id":30732
}
],
"today_wh":0,
"today_wh_range":"low",
"last_data_instant":0,
"unknown_state?":true,
"unknown_state":true
}
}
The Rule:
rule "Parse Json"
when
Item PowerStateBedroomLight_Output received update
then
val power = transform("JSONPATH", "$[0].power_state", PowerStateBedroomLight_Output.state.toString)
logInfo("Parse Json result = " + power)
powerState.postUpdate(power)
end
The Error:
2017-04-18 11:55:48.931 [ERROR] [ore.transform.actions.Transformation] - Error executing the transformation 'JSONPATH': An error occured while transforming JSON expression.
2017-04-18 11:55:48.937 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Parse Json': An error occured during the script execution: index=1, size=1
If there is anything else you need please let me know.
Thanks