API works through HTTP GET request, so you can work with your Larnitech server from browser, just sending requests from address string.
Request:
http://IPADDR:PORT/JSON_REQUEST, where
IPADDR – ip address of your metaforsa or DE-MG;
PORT – port for API plugin (you can get it from LT Setup=>Plugins=>API=>Configure button);
JSON_REQUEST – request to server in json format.
Fields of JSON_REQUEST:
- “requestType” – Type of request:
- “getDevicesList” – request for getting the list of all devices;
- “getDeviceStatus” – request for getting device status;
- “setDeviceStatus” – request for setting device status;
- “setDeviceStatusRaw” – request for setting device status (status in hex format);
- “getAllDevicesStatus” – request for getting all devices status.
- “key” – key for API plugin (you can get it from LT Setup=>Plugins=>API=>Configure button).
- “addr” – address of device.
- “status” – status of device.
Examples of requests and responses:
request: {"requestType":"getDevicesList","key":"0000000000000000"} response: { "requestType":"devicesList", "devices": [ { "type": "lamp", "name": "Ceiling", "addr":"401:1" }, { "type": "conditioner", "name": "AC", "addr":"158:200", "t-min":"16", "t-delta":"16" } ] } request: {"requestType":"getDeviceStatus","addr":"310:1","key":"0000000000000000"} response: { "requestType" : "deviceStatus", "status" : { "addr" : "310:1", "state" : "middle", "type" : "jalousie" } } request: {"requestType":"setDeviceStatus","addr":"310:1","key":"0000000000000000","status":{"state": "on"}} response: { "requestType":"setDeviceStatus", "addr":"410:1", "status":{ "state": "on" } } request: {"requestType":"getAllDevicesStatus","key":"0000000000000000"} response: { "requestType":"allDevicesStatus", "statuses": [ { "addr":"401:1", "state": "off", }, { "addr":"158:200", "state": "on", "temp":"25", "mode":"cool", "fan":"low", "vane-ver":"1", "vane-hor":"4" } ] } request: {"requestType":"setDeviceStatusRaw","addr":"310:1","key":"0","status":{"state":"ff00"}} response: { "addr" : "310:1", "key" : "0", "requestType" : "setDeviceStatusRaw", "status" : { "state" : "ff00" }