Sandbox constraints
Drivers run inside a sandboxed Node.js context. The sandbox deliberately hides most of Node.
What you can use
Section titled “What you can use”- Globals:
D(the Domotz API root),console, standard JavaScript (Math,Date,JSON,Promise,Array,Object, …). - Anything under the
Dnamespace — see the API reference. This is the only way to make network calls, run crypto, schedule timers, or build tables. - Utility namespaces:
D.math,D.q(promise library),D._(lodash-like helpers),D.crypto,D._unsafe(explicitly marked unsafe helpers — use with care).
What you cannot use
Section titled “What you cannot use”require()/importof arbitrary Node modules. You cannot loadfs,http,child_process, or any npm package. Everything must go through theDnamespace.- File-system access. The sandbox does not expose read or write to disk.
- Global timers (
setTimeout,setInterval) — useD.devicescheduling instead. - Environment variables (
process.env).
Other limits
Section titled “Other limits”- Execution timeout — each driver invocation has a wall-clock limit enforced by the collector. A driver that never calls
D.success/D.failureis killed. - Memory — the sandbox enforces a memory cap. Large parses (multi-megabyte JSON or text) can exceed it.
- Credentials — if your driver needs credentials, get them from
D.device.username()/D.device.password()rather than hard-coding. These are the Custom Driver Management credentials configured in the Domotz portal.
If you discover a constraint not listed here, it is a doc bug — open an issue.