Docs

Overview

What a smart app is, what it is made of, and how one gets onto a hub.

A smart app is a small JavaScript program that the Novon hub runs for you, next to your devices. It reacts to things that happen in the home (a sensor trips, a door unlocks, the sun sets, a timer elapses) and acts on devices and people (turn lights on, lock up, send a push notification).

Smart apps run on the hub, so they keep working when the internet does not. Only the notification channels (push, email, SMS) go through the Novon cloud.

Anatomy

Every smart app has three parts:

PartWhat it isWhere to read more
definitionName, namespace and description. The hub identifies the app by namespace + name.Definition
preferencesThe form a person fills in when installing the app: which devices, which times, which options. Each input becomes a variable in your code.Preferences
HandlersTop-level functions. The hub calls installed, updated and uninstalled at lifecycle moments, and whichever functions you register for device events, schedules and timers.Lifecycle
The shape of every smart app
const definition = { name: 'Porch Light', namespace: 'com.example', description: 'Light the porch at dusk.' };

const preferences = {
  pages: [{ id: 'main', title: 'Porch Light', inputs: [
    { key: 'porch', label: 'Porch light', type: 'entity', domainFilter: 'light', required: true },
  ]}],
};

function installed() { initialize(); }
function updated()   { unsubscribe(); unschedule(); initialize(); }

function initialize() { scheduleAtSunset(onSunset, -15); }

function onSunset() {
  porch.turnOn();
  scheduleAtSunset(onSunset, -15); // sunrise/sunset timers are one-shot: re-arm for tomorrow
}

How an app reaches a hub

Register the code

In the Novon admin console open Smart apps → Register a smart app and paste the source. The hub validates it (size, banned APIs, filter shapes) and stores it as a definition.

Install an instance

In the Novon app go to Automations → Smart apps, pick the definition and walk through its preferences. Each install is an instance with its own settings and state; you can install the same definition several times.

Watch it run

Every instance has a live log (your console.log output), a Run button, and pause / resume. See Logging and debugging.

The Examples section has ten small, complete apps to copy from, one per common pattern. The hub also ships a set of built-in apps written against the same API.

Where to go next

On this page