- Platform information:
- Hardware: x86_64 Intel/8GB/14TB
- OS: Ubuntu 14.04
- openHAB version:Latest (apt-get)
I seem to be having a hard time getting my mind around httpget/postrequest and JSONPATH.
I am trying to update an item in Openhab from a URL that sends back json values.
information sent from aircon controller:
{
"AirStreamDeviceUId": "CB_ID",
"DeviceType": "ASH",
"SysOn": "on",
"SysMode": "cool",
"SysFan": "auto",
"SleepTimer": 0,
"UnitType": "Mitsubishi Electric",
"Supply": "21.9",
"Setpoint": "21.0",
"Temp": "21.9",
"RAS": "master",
"CtrlZone": 13,
"Tag1": "iZone Control Systems",
"Tag2": "",
"Warnings": "none",
"ACError": " OK",
"Id": 0,
"EcoLock": "true",
"EcoMax": "30.0",
"EcoMin": "15.0",
"NoOfConst": 1,
"NoOfZones": 8,
"SysType": "310",
"AirflowLock": "on",
"UnitLocked": "false",
"FreeAir": "disabled",
"FanAuto": "3-speed"
}
I need to use SysOn as the on/off state of my item.
I am using JSONPATH to get the info I need.
JSONPATH online evaluator shows “$…SysOn” (only 2 “.” it keeps showing as 3 for some reason) as the tranform I need.
I have tried this in rules but to no luck. I have also tried it as part of the item itself but again no luck.
I think the issue is that it returns “on” as a string not “ON” as a state.
Help very much appreciated.
EDIT:
Code in rule
rule "Aircon Polling"
when
Time cron "10 0 0 ? * * *"
then
var String json = sendHttpGetRequest("http://192.168.0.253/SystemSettings")
var String temp = transform("JSONPATH", "$..SysOn", json)
airconSystemOn.postUpdate(temp)
end