API - control interface ======================= API online ---------- Service call syntax ~~~~~~~~~~~~~~~~~~~~~~~~~ Calling the API online by sending an HTTP request has the following syntax: .. code-block:: none https://vektiva.online/api//// Each physical device (SMARWI) has its unique DEVICE ID. You will obtain REMOTE ID and API KEY, after signing up at |online|_ (under the "API" menu). IDs are common to all devices under your account. :code:`` is one of following commands - :code:`open` Open window action. It is possible to use another optional parameter (percentage opening size). To do that add to the URL :code:`/` - :code:`close` Close window action - :code:`stop` Stop movement action - :code:`fix` Window fixation action - :code:`prio` Activity trigering with priority for specific time *(since firmware 203.2.0)* .. note:: Activity is a "program" (set of conditions & actions), which determines device behavior during its run. full syntax :code:`prio///[/param1[/[param2[/param3]]]` * `delay_seconds` is the number of seconds to run the activity * `duration_seconds` is the activity time in seconds * `ActivityName` activity name as defined in the device * `param1..param3` respective activity parameters | This activity is then performed "in priority" at the given interval, ie if the same activity is running at the same time according the plan it will be overwriten with its parameters. - :code:`queue` Triger action with time delay *(since firmware 203.2.0)* .. note:: The action is one activity the device can perform - for example, close the window full syntaxe :code:`queue//[/param1[/[param2[/param3]]]` * `delay_seconds` number of seconds until action execution. * `ActionName` name of action supported by device, except prio a queue. (open, close, stop, fix...) * `param1..param3` optional activity parameters API over local network ---------------------- API call within your internal network by sending http request has following syntax: .. code-block:: none http://IP/cmd/ Where IP is IP address of given SMARWI. Examples ~~~~~~~~ .. admonition:: Example 1 - local network, close SMARWI at IP address 1.2.3.4 :class: note :code:`https://1.2.3.4/cmd/close` .. admonition:: Example 2 - online, close SMARWI with ID 1111111111 :class: note :code:`https://vektiva.online/api/dndptketzd/12abc34def/1111111111/close` .. admonition:: Example 3 – online, open SMARWI with ID 1111111111 on 30% :class: note :code:`https://vektiva.online/api/dndptketzd/12abc34def/1111111111/open/30` .. admonition:: Example 4 - local network, activity planning :class: note :code:`http://1.2.3.4/cmd/prio/10/20/ventilate/50` *Runs activity "ventilate" from "now"+10 seconds unitl "now"+30 seconds, activity parameter is 50 -- in this example 50% opening, but parametr meaning depends on activity definition* .. admonition:: Example 5 - online, activity planning :class: note :code:`https://vektiva.online/api/dndptketzd/12abc34def/1111111111/prio/10/20/ventilate/50` *Runs activity "ventilate" from "now"+10 seconds unitl "now"+30 seconds, activity parameter is 50 -- in this example 50% opening, but parametr meaning depends on activity definition* .. admonition:: Example 6 - online, action planning :class: note :code:`https://vektiva.online/api/dndptketzd/12abc34def/1111111111/queue/20/open/50` *In 20 seconds run action 'open' with parameter 50 -- open window on 50%* You can easily test the API call function by typing a request to your URL browser. After sending, the desired action is performed.