Changes

2,789 bytes added ,  08:42, 16 January 2022
Created page with "API"
<languages/>
API works through HTTP GET request, so you can work with your Larnitech server from browser, just sending requests from address string.
Request:
<syntaxhighlight lang="xml" line>
http://IPADDR:PORT/JSON_REQUEST
</syntaxhighlight>
Where:
IPADDR – ip address of your metaforsa or DE-MG;
PORT – port for API plugin (you can get it from LT Setup=&gt;Plugins=&gt;API=&gt;Configure button);
JSON_REQUEST – request to server in json format.
Fields of JSON_REQUEST:
<ul>
<li>"requestType" - Type of request:
<ul>
<li>“getDevicesList” – request for getting the list of all devices;</li>
<li>“getDeviceStatus” – request for getting device status;</li>
<li>“setDeviceStatus” – request for setting device status;</li>
<li>“setDeviceStatusRaw” – request for setting device status (status in hex format);</li>
<li>“getAllDevicesStatus” – request for getting all devices status.</li>

</ul>
</li>
<li>“key” – key for API plugin (you can get it from LT Setup=&gt;Plugins=&gt;API=&gt;Configure button).</li>
<li>“addr” – address of device.</li>
<li>“status” – status of device.</li>
</ul>
Examples of requests and responses:

<syntaxhighlight lang="json" line>
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"
}
</syntaxhighlight>
editor, translation-admin, translator
4,754

edits