Docs

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

MessageCauseFix
subscribe(): target, filter and handler are requiredan input was empty (undefined entity)guard inputs in initialize
filter rejected at subscribe (unknown key)a key other than from / to / state / attributesee Subscription filter
ReferenceError: setTimeout is not definedbrowser / Node API in the sandboxrunIn and friends
ReferenceError: <inputKey> is not definedthe input type is not hydrated (mode, app, accountUser*, object) or the key is misspelledread settings.<key>
handler never firesarrow function or nested function used as a handlertop-level function name() {}
filter never matchesa state spelled as a label the device does not use ('Open' on a motion sensor), or a label on an older hubcheck the device's labels on its capability page; raw tokens work everywhere
fires at the wrong hourlocal-time Date gettersformatDateParts(new Date(), getHomeTimeZone())
sunset fired once, never againone-shot sun timersre-arm in the handler
Script execution timed outmore than 10 s of synchronous worksplit the work, avoid busy loops
code rejected on registrationsize, banned API, or filter shapeValidation 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.

On this page