Logging and debugging
Reading the live log, common errors and what they mean, and how to test an instance.
The log
console.log, console.warn and console.error (plus info / debug) are forwarded to the
instance's log view in the Novon app (open the instance) and in the admin console. Lines are
batched and rate-limited per app; when the limit trips, the next line carries a "dropped" count
instead of silently losing output. Everything you log is visible to every admin of the location, so
keep personal data out.
A pattern the built-ins use: a logging boolean preference that gates verbose output, read at call
time so toggling it takes effect on the next handler without re-registering code.
function logInfo(...args) { if (logging === true) console.log(...args); }Testing an instance
- Run (the button on the instance) calls your
run()if you define one — a convenient place for "do the thing now". - Save the preferences again to re-run
updated. - Pause stops handlers without losing anything; Resume picks up where it left off.
- The instance shows its exception count; a rising count means a handler is throwing. The error text is in the log.
Errors you will meet
| Message | Cause | Fix |
|---|---|---|
subscribe(): target, filter and handler are required | an input was empty (undefined entity) | guard inputs in initialize |
filter rejected at subscribe (unknown key) | a key other than from / to / state / attribute | see Subscription filter |
ReferenceError: setTimeout is not defined | browser / Node API in the sandbox | runIn and friends |
ReferenceError: <inputKey> is not defined | the input type is not hydrated (mode, app, accountUser*, object) or the key is misspelled | read settings.<key> |
| handler never fires | arrow function or nested function used as a handler | top-level function name() {} |
| filter never matches | a state spelled as a label the device does not use ('Open' on a motion sensor), or a label on an older hub | check the device's labels on its capability page; raw tokens work everywhere |
| fires at the wrong hour | local-time Date getters | formatDateParts(new Date(), getHomeTimeZone()) |
| sunset fired once, never again | one-shot sun timers | re-arm in the handler |
Script execution timed out | more than 10 s of synchronous work | split the work, avoid busy loops |
| code rejected on registration | size, banned API, or filter shape | Validation rules |
Inspecting what the hub gave you
function installed() {
console.log('settings', JSON.stringify(settings));
console.log('location', JSON.stringify(location));
console.log('state', JSON.stringify(state));
}Run history
Each instance also appears in the location's automation run history alongside Flows, with the trigger and handler name per run. Use it to confirm that an event actually reached your app before suspecting the handler.