Hi there,
I'm working with Airzone local API, and I need to write every item into LogicMachine group objects.
This is my script:
And this is the response I get:
I'm a newbie at json stuff. Please, can you help me with writing every item (systemID, zoneID, name, etc) into LogicMachine group objects? Thanks in advance!
I'm working with Airzone local API, and I need to write every item into LogicMachine group objects.
This is my script:
Code:
require 'ltn12'
require 'socket.http'
json = require("json")
local request_url = "http://192.168.1.111:3000/api/v1/hvac?systemid=01&zoneid=15"
local response_body = {}
local body, code, hdrs, stat = socket.http.request
{
url = request_url;
sink = ltn12.sink.table(response_body);
}
log (response_body)
And this is the response I get:
Code:
* table:
[1]
* string: {
"data": [{
"systemID": 1,
"zoneID": 15,
"name": "ZONA 15",
"thermos_type": 2,
"thermos_firmware": "4.53",
"thermos_radio": 0,
"on": 1,
"double_sp": 0,
"coolsetpoint": 22,
"coolmaxtemp": 30,
"coolmintemp": 15,
"heatsetpoint": 22,
"heatmaxtemp": 30,
"heatmintemp": 15,
"maxTemp": 30,
"minTemp": 15,
"setpoint": 22,
"roomTemp": 22.9,
"sleep": 0,
"temp_step": 0.5,
"mode": 3,
"speed": 0,
"coldStage": 2,
"heatStage": 2,
"coldStages": 2,
"heatStages": 2,
"humidity": 22,
"units": 0,
"errors": [],
"air_demand": 0,
"floor_demand": 0,
"cold_demand": 0,
"heat_demand": 0,
"heatangle": 0,
"coldangle": 0,
"master_zoneID": 15,
"eco_adapt": "off",
"antifreeze": 0
}]
}
I'm a newbie at json stuff. Please, can you help me with writing every item (systemID, zoneID, name, etc) into LogicMachine group objects? Thanks in advance!