Skip to content

Sandbox constraints

Drivers run inside a sandboxed Node.js context. The sandbox deliberately hides most of Node.

  • Globals: D (the Domotz API root), console, standard JavaScript (Math, Date, JSON, Promise, Array, Object, …).
  • Anything under the D namespace — 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).
  • require() / import of arbitrary Node modules. You cannot load fs, http, child_process, or any npm package. Everything must go through the D namespace.
  • File-system access. The sandbox does not expose read or write to disk.
  • Global timers (setTimeout, setInterval) — use D.device scheduling instead.
  • Environment variables (process.env).
  • Execution timeout — each driver invocation has a wall-clock limit enforced by the collector. A driver that never calls D.success / D.failure is 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.