You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core-concepts.md
+56-20Lines changed: 56 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,37 +8,73 @@ A server describes where the API calls go. A gateway is the physical hub in your
8
8
9
9
The setup describes the current gateway configuration and device inventory. Devices expose metadata like `uiClass` and `widget`, plus a list of current `states`.
10
10
11
-
## Actions, action groups, and commands
11
+
## Commands, actions, and action groups
12
12
13
-
Commands are sent as `Action` objects, grouped into an action group. Each action targets a device URL and a set of commands with parameters.
13
+
The Overkiz API uses a three-level hierarchy to control devices:
14
+
15
+
-**Command** — A single instruction for a device, like `open`, `close`, or `setClosure(50)`. A command has a name and optional parameters.
16
+
-**Action** — One or more commands targeting a **single device** (identified by its device URL). The gateway allows at most one action per device in each action group.
17
+
-**Action group** — A batch of actions submitted to the gateway as a single execution. An action group can target multiple devices at once.
18
+
19
+
```
20
+
ActionGroup
21
+
├── Action (device A)
22
+
│ ├── Command("open")
23
+
│ └── Command("setClosure", [50])
24
+
└── Action (device B)
25
+
└── Command("close")
26
+
```
27
+
28
+
Action groups come in two flavors:
29
+
30
+
-**Ad-hoc** — Built on the fly from `Action` and `Command` objects and executed via `execute_action_group()`.
31
+
-**Persisted** — Stored on the server (like saved scenes). Retrieved with `get_action_groups()` and executed by OID via `execute_persisted_action_group()`, or scheduled for a future timestamp via `schedule_persisted_action_group()`.
32
+
33
+
## Executions
34
+
35
+
When an action group is submitted, the server returns an `exec_id` identifying the **execution**. An execution tracks the lifecycle of a submitted action group — from queued, to running, to completed or failed.
36
+
37
+
-**Track** running executions with `get_current_executions()` or `get_current_execution(exec_id)`.
38
+
-**Cancel** a running execution with `cancel_execution(exec_id)`.
39
+
-**Review** past results with `get_execution_history()`.
40
+
41
+
Executions run asynchronously on the gateway. State changes are delivered through events, so you typically combine execution with an event listener to know when commands finish.
42
+
43
+
## Execution modes
44
+
45
+
An optional `ExecutionMode` can be passed when executing an action group:
46
+
47
+
-`HIGH_PRIORITY` — Bypasses the normal execution queue.
48
+
-`GEOLOCATED` — Triggered by geolocation rules.
49
+
-`INTERNAL` — Used for internal/system executions.
14
50
15
51
## States
16
52
17
53
States are name/value pairs that represent the current device status, such as closure position or temperature.
18
54
19
55
## Events and listeners
20
56
21
-
The API uses an event listener that you register once per session. Fetching events drains the server-side buffer.
22
-
23
-
## Execution model
24
-
25
-
Commands are executed asynchronously by the platform. You can poll execution state via events or refresh device states after a delay.
57
+
The API uses an event listener that you register once per session. Fetching events drains the server-side buffer. Events include execution state changes, device state updates, and other notifications.
Create an `Action` with the target device URL and one or more `Command` objects, then wrap it in an action group. The method returns an `exec_id` you can use to track or cancel the execution.
Gateways impose limits on how many executions can run or be queued simultaneously. If the execution queue is full, the API will raise an `ExecutionQueueFullError`. Most gateways allow up to 10 concurrent executions.
0 commit comments