| Line 4: |
Line 4: |
| | API2 works via WebSocket connection, so you can interact with your Larnitech server from a browser using extensions (such as WebSocket Test Client).<br> | | API2 works via WebSocket connection, so you can interact with your Larnitech server from a browser using extensions (such as WebSocket Test Client).<br> |
| | To get started, you should:<br><br> | | To get started, you should:<br><br> |
| − | 1. Establish a web socket connection.<br> | + | 1. Establish a web socket connection.<br> Locally |
| | <syntaxhighlight lang="xml"> | | <syntaxhighlight lang="xml"> |
| | ws://IPADDR:PORT/api | | ws://IPADDR:PORT/api |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | Where: IPADDR – ip address of your metaforsa or DE-MG;<br> | | Where: IPADDR – ip address of your metaforsa or DE-MG;<br> |
| − | PORT – port for API2 (you can get it from LT_Setup => General => API => Websocket port (2041 by default);<br><br> | + | PORT – port for API2 (you can get it from LT_Setup => General => API => Websocket port (2041 by default); <br> |
| | + | Or use next for remote: |
| | + | <syntaxhighlight lang="xml"> |
| | + | wss://SERIAL.in.larnitech.com:8443/api |
| | + | </syntaxhighlight> |
| | + | Where: SERIAL is serial number of your server, you can find it in LT_Setup => General <br><br> |
| | 2. Authorize | | 2. Authorize |
| | <syntaxhighlight lang="json"> | | <syntaxhighlight lang="json"> |
| Line 63: |
Line 68: |
| | "state":"undefined" | | "state":"undefined" |
| | } | | } |
| − | } | + | }, |
| | + | { |
| | + | "addr":"33:200", |
| | + | "type":"climate-control", |
| | + | "name":"climate", |
| | + | "area":"Living room", |
| | + | "status":{ |
| | + | "state":"on", |
| | + | "setpoint":23.0, |
| | + | "setpoint-heat":21.0, |
| | + | "setpoint-cool":25.0, |
| | + | "current-temperature":0.0, |
| | + | "pid-temperature":100, |
| | + | "current-humidity":0.0, |
| | + | "current-co2":0, |
| | + | "automation":"Comfort", |
| | + | "mode":"auto", |
| | + | "time-interval":0 |
| | + | }, |
| | + | "automations":[ |
| | + | "Comfort" |
| | + | ], |
| | + | "automation":"Comfort", |
| | + | "modes":[ |
| | + | "heat", |
| | + | "cool" |
| | + | ] |
| | + | }, |
| | ], | | ], |
| − | "found":2 | + | "found":3 |
| | } | | } |
| | | | |
| Line 125: |
Line 157: |
| | ] | | ] |
| | } | | } |
| | + | |
| | + | request (set status for climate-control): |
| | + | {"request":"status-set","addr":"33:200", "status":{"state":"on","setpoint-heat":21.0}} |
| | + | |
| | + | response: |
| | + | { |
| | + | "response":"status-set", |
| | + | "devices":[ |
| | + | { |
| | + | "addr":"33:200", |
| | + | "success":true |
| | + | } |
| | + | ] |
| | + | } |
| | + | |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | | | |