The AI driver runs AI assistants on the device itself, without anyone in front of the web interface. One gateway is one assistant, with its own mission, model, budget and permissions. Its addresses are its conversations: writing a message to a conversation address starts a turn, and the answer comes back on an output address. Any protocol can therefore talk to the assistant through a simple route: an SMS or WhatsApp message via the IM driver or SMS driver, an MQTT topic, an alarm, a cron tick.
Typical uses:
The AI driver requires the AI Connect or FULL licence. It consumes the device's credits or a dedicated API key, see section 4.
%ai:enabled and a first conversation named after the gateway, with its four output addresses.%ai:<conversation> from the grid or a route: the answer appears on %ai:<conversation>/out.
| Label | JSON Key | Description |
|---|---|---|
| Name | name | Name of the assistant. Also used for its first conversation. |
| Description | description | Optional description. |
| Installation context | json.context | What is true for the whole installation: building, equipment, hard limits. Shared wording you can copy to every assistant on the site. |
| Mission | json.mission | This assistant's role, tone and limits. Appended to the context and applied to all its conversations. |
| Connection | json.connection | Who pays this assistant's turns, including tests from the panel. "" Built-in (box credits): the device's credits. "key" API key: the key below. Independent from the personal choice of the user opening the panel. |
| API key | json.apiKey | Anthropic, OpenAI or DeepSeek key, used when Connection is API key. Without a key in that mode, nothing runs, not even on credits. The ⟳ button copies one of your saved personal keys. Never shown to the assistant. |
| Model | json.model | Model id, loaded with the ⟳ button. When no model is saved, the service default is preselected and saving the form stores it. In key mode the list is limited to the key's provider. |
| Memory | json.memory | Default for the conversations: Conversation (it remembers the thread) or None (each message stands alone). Every turn is journalled either way. |
| Target filter (JS) | json.filter | Body of a JavaScript function receiving call and returning true to allow the call. Restricts what the assistant may touch, on top of permissions. Anything other than true, including an error, a missing return or a timeout, denies. See section 5.1. |
| (managed by the device) | json.aiPermissions | The assistant's permanent permissions, written when you click Always on a card or from the Roles page. Do not edit by hand. |
Like the credentials of other drivers, the gateway's API key is stored in the gateway configuration on the device. Prefer the device's credits, or a key with a spending limit at the provider.
{
"context": "Office building, 3 floors. BACnet HVAC on gateway 'bacnet-hvac', Modbus meters on 'modbus-meters'. Never change setpoints outside 18-24 °C.",
"mission": "You are the maintenance assistant. Answer in two sentences maximum, in the language of the question. Ask before any write.",
"connection": "",
"model": "haiku",
"memory": "conversation",
"filter": "if (/^delete/.test(call.method)) return false; if (/^(get|read|list|query|search|count|find)/.test(call.method)) return true; return !!(call.address && call.address.name.indexOf('%bac:') === 0);"
}
Startup checks. A configuration that cannot work stops the gateway at start-up, in error, with
invalid configuration: …in its log: API key connection without a key; a key that does not belong to the model's provider (keyssk-ant-…are Anthropic,sk-proj-…OpenAI; with no model set, the default is a Claude model); a context or mission that is not text; a target filter that does not compile. Fix the field and save: the gateway restarts.
| Address | Direction | Role |
|---|---|---|
%ai:enabled |
write | Circuit breaker of the whole gateway: 1 enabled, 0 all assistants refuse turns. Created automatically. |
%ai:<conversation> |
write | Talk to the assistant in this thread. One thread per sender, room or topic; each keeps its own context. |
%ai:<conversation>/dry |
write | Dry run: the assistant explains what it would do, without doing it. |
%ai:<conversation>/out |
read | The last answer. Route it to SMS, WhatsApp, MQTT, e-mail or a display. |
%ai:<conversation>/status |
read | idle, running, error or disabled. |
%ai:<conversation>/event |
read | JSON journal of the last turn: conversation id, tokens, awaiting_permission with the blocked function if any, no_credits, timestamp, or the error. |
Conversation names use letters, digits, _, . and -. The four output addresses are created automatically for every conversation. The grid shows each conversation as a node with its outputs underneath.
| Label | JSON Key | Description |
|---|---|---|
| Address | name | %ai:<conversation>. |
| Description | description | Optional description. |
| Memory | json.memory | Memory of this conversation: conversation or none. Takes precedence over the gateway's Memory. |
| Log | log | Logging mode of the address, set in the Log column of the address grid. |
A conversation added from the address form of the gateways page starts with Memory = Conversation, whatever the gateway setting. Conversations created automatically with the gateway, or with the + button of the AI panel, have no Memory value and follow the gateway setting. Set Memory on each conversation that must behave differently, for example None on report or alarm threads.
| Property | Value |
|---|---|
| Readable | No — outputs are pushed by the driver at the end of each turn |
| Writable | %ai:enabled, %ai:<conversation> and /dry |
| Routable | Yes — write into a conversation from any route, route /out, /status and /event anywhere |
| Loggable | Yes |
The gateway pays for its turns. With Connection = Built-in, every turn, including keyboard tests in the panel, is charged to the device's credits. With API key, turns go to the gateway's key, never to the personal key of the user who opens the panel. Without an AI Connect or FULL licence the driver does not start.
The Model chosen in the assistant's thread in the panel is saved into the gateway. A model chosen in the main assistant never changes a gateway assistant.
A gateway assistant is its own principal on the device: it borrows no human account. It starts with no permission. You grant rights in two ways:
You can only grant functions that your own role holds. Permissions are re-evaluated at every turn, so a revocation takes effect immediately. The assistant bar of the panel shows what the assistant may do without asking.
Permissions say what the assistant may do; the target filter says on what. It is the body of a JavaScript function called before every API call, with a call object:
| Field | Content |
|---|---|
call.module, call.method |
The API module and method about to be called. |
call.args |
Its arguments. |
call.address, call.addresses |
The resolved target address(es), only for calls on one address: writeValue, writeValueString, readValue, getLastValue, acceptsWrite, acceptsRead, getAddress, updateAddress, deleteAddress, refreshRoute. For every other call (listing gateways or addresses, alarms, loggers, routes…) call.address is null. |
call.assistant, call.gateway |
This assistant and its gateway. |
Return true to allow. Anything else denies: no return value, an exception, an unresolved address, or more than 50 ms of execution. A filter that does not compile stops the gateway at start-up (see Startup checks in section 2); any runtime error of the filter denies the call. End the filter with a denial, never with an unconditional return true.
The filter sees every call, reads included. A filter that only tests
call.addressalso blocks the reads the assistant needs to find addresses. Address names start with the prefix of their driver: BACnet addresses start with%bac:.
// Reads anywhere, writes only on BACnet addresses, never delete
if (/^delete/.test(call.method)) return false;
if (/^(get|read|list|query|search|count|find)/.test(call.method)) return true;
if (call.address && call.address.name.indexOf('%bac:') === 0) return true;
return false;
The robot button (AI driver assistants) in the panel header, shown when the device has AI gateways, lists the device's assistants and their conversations. + creates a conversation: its name becomes the address %ai:<name>. The bar shows what the assistant may do without asking. In an assistant thread, the permissions panel offers Allow everything permanently: it grants every group except Accounts to the assistant, for good, including for turns triggered at night when nobody can refuse: keep it for test assistants, and grant production assistants only the groups they need. While the gateway is disabled, its thread cannot be used.
%ai:<conversation> or /dry, by a route, the API or the grid. The write is acknowledged immediately; the turn runs in the background./status becomes running. One turn runs at a time per conversation; a second message during a turn is refused with a turn is already running./out, /status returns to idle or error, and /event receives the journal of the turn. If the assistant needed a permission it does not have, /event carries awaiting_permission with the function name, and the answer says so.When %ai:enabled is 0, turns are refused and /status shows disabled.
Gateway im (IM driver) receives messages; gateway ai is the assistant.
| Route | From | To |
|---|---|---|
| Incoming message | %im:whatsapp/+41791234567/#lastMessage |
%ai:tech-41791234567 |
| Answer | %ai:tech-41791234567/out |
%im:whatsapp/+41791234567 |
The recipient must have Allow reply enabled in the IM gateway. One conversation per phone number keeps each technician's context separate. Grant the assistant Read and Write values permanently, and restrict its writes with a target filter to the gateways technicians may touch, while letting reads through as in the example of section 5.1.
A cron address fires at 18:00 and a route writes the fixed text "Summarise the alarms of the last 24 hours and list the ones still active" to %ai:daily. A second route sends %ai:daily/out to an SMTP address. Set Memory = None on %ai:daily so each report stands alone.
While building a new automation, route the trigger to %ai:ops/dry first and read %ai:ops/out: the assistant explains what it would do without doing it. Switch the route to %ai:ops once satisfied.
| Symptom | Cause | Fix |
|---|---|---|
Gateway in error, missing license in its log |
No AI Connect or FULL licence | Activate the licence |
Gateway in error, invalid configuration |
See Startup checks in section 2 | Fix the field and save |
| 🔑 API key mode with no key saved | Connection = API key, no key | Save a key or switch to Built-in |
| 🔑 key does not belong to the chosen model's provider | Key and model mismatch | Pick a model of the key's provider |
| A turn is already running | One turn per conversation | Retry when /status is idle |
/event shows awaiting_permission |
The assistant lacks a right | Open the thread and grant it |
For problems of the assistant itself (credits, keys, models, permissions), see AI assistant troubleshooting.