In use

Your own source

The object is the same whatever feeds it. A host adapter hands it systems and readings and runs its actions; everything else, the rings, the layers, the alerts, the detail, is the core's. Hosts built so far: a home through Home Assistant; a machine through a small collector; the world's calamities from public feeds, with no server at all; a boat over Signal K; a fleet of trams over MQTT, one object per dimension and one per vehicle; a fleet of hosts over Prometheus, by configuration; a swarm of drones over MAVLink; the sky from the ADS-B networks, the emergencies on a globe; the space station from NASA's telemetry; a city's roads with their cameras. The demo in this repository uses simulated readings for a home, a car, a pet and a server.

A car as a Pulse object: the battery in front, the tires behind
The demo app: a car, from simulated data. Same object, same rules.

What a system is

A system is a title and a few channels. A channel reads the host's state and returns a reading, or nothing when there is nothing for it. A reading is one of three rings, a big value, one line, the things it depends on, and sometimes an alert with its actions. That is the whole contract between a host and the object.

{
  kind: 'p',                  // a band ('p'), switches ('s') or a choice ('c')
  v: 0.74,                    // the band's progress
  dial: { min: 0, max: 100, step: 1, unit: '%', label: 'charge', value: 74, id: 'battery', set: (v) => action },
  big: '74%', label: '310 km',
  ids: ['battery'],
  alert: { level: 1, big: '12%', label: 'battery', why: 'Not enough charge for tomorrow', verb: 'Schedule charging', acts: [action] },
}

Two to four channels that compete for attention, ordered front to back, make a good system. More than that is usually two systems.

What a host is

A host hands the board its systems, tells it when a thing changes, runs the actions the board hands back, and names the things. In the core it is one interface, PulseHost. A host is made out of whatever the source speaks: a WebSocket of states, a collector polled every few seconds, public feeds on their own clocks, a stream of a vessel's paths, vehicles over MQTT with the vehicles as the board's second axis, a configuration where every channel is a query with its thresholds, a MAVLink stream with commands back.

The host givesSo that
systems, and a change eventthe object repaints only what changed
act(action)a control on the ring does something, and the object waits for the confirmation
a name and a state for each thingthe log and the detail say what they are reading
groups, and a way to read the systems within onethe board can filter by room, and be one object per room
the viewer's languagenumbers and times read as the viewer expects
optionally: a history, a day of changes, a picture, a stream, statisticsa detail can show a day, a timeline, a camera, a month

Where it runs

The core is a plain module that mounts on an element and draws with CSS and a little SVG. It works inside a shadow root, which is what a Home Assistant card is, and on a round screen, which is what a boat's helm or a wall panel may be. This repository carries the core and the demo; each host above is an app in its own repository, Pulse for Home Assistant the first to be published. The steps, from the imports to the theme: In your project.

Open

Pulse is MIT. The hosts so far show what the object can take: a source with nothing to command (the world's feeds), many of one thing (a fleet, a swarm), a host built from configuration (Prometheus), real commands with a code or a word (a home), the globe and the map (the sky, a city). Next on the list: Moonraker for 3D printers.