Dominevo
Develop

Device identity

Declare what a device is (MAC, serial, vendor id, machine uuid) so Dominevo can recognise the same object across integrations, and decide when a machine is a Host and when a Gateway.

Two integrations can see the same physical object: a camera on a UniFi PoE port and the same camera adopted by its own vendor addon, or a server seen by both a hypervisor integration and a monitoring one. Dominevo can only tell they are one object if each provider declares what it read from the hardware, in a typed and normalised form.

What you declare

KeyStored formStrength
macaa:bb:cc:dd:ee:ff (several allowed)strong
serial<manufacturer>:<serial>strong
machine-uuidSMBIOS, VM or container uuidstrong
vendor-uid<vendor>:<id>strong
hostnamelower case, no domainweak
ipIPv4 or IPv6weak

Strength belongs to the key. A weak key never links two devices on its own. Identifiers are separate from the free-form metadata blob: an operator can edit metadata, but identifiers are written only by the provider that owns the device, and the operator reads them (Device info, Hardware) without editing.

Declare from a device class

BaseDevice has a protected declareIdentifiers. Pass the values as the driver read them, in whatever spelling the device used. The helper normaliseIdentifiers (also exported from @dominevo/types) lowercases, de-duplicates, prefixes and refuses placeholders (unknown, 00:00:00:00:00:00, loopback addresses). A refused value is logged with the device tag, never stored.

protected async onProbed(info: ProbeInfo): Promise<void> {
  await this.declareIdentifiers(
    {
      mac: info.macAddresses,                              // string | string[]
      serial: { manufacturer: 'acme', serial: info.sn },
      vendorUid: { vendor: 'acme', id: info.cloudUid },
      host: this.config.host,                              // lands on ip OR hostname
    },
    { unread: info.networkReadFailed ? ['mac', 'ip'] : [] },
  )
}

The rule: unread is not absent

Each call is merged kind by kind:

  • A kind you pass replaces the stored one.
  • A kind you leave out means "I read it and the device has none": it is removed.
  • A kind listed in unread means "I tried and the read failed": the stored value is kept.

The pitfall is a probe that fails halfway. If the network read threw and you declare with no mac, you have told Dominevo the device has no MAC and the stored one is erased. List every kind the failed read would have produced in unread. Never list a kind you read and found absent: that is what removes a stale value. A declaration where every kind is unread writes nothing.

Declaring the same values on every boot is free: an unchanged entry keeps its first readAt and writes and emits nothing.

A call is accepted only from the addon that owns the device. An operator session or another addon is refused. To describe the device at the far end of a physical link (a PoE port's wired client), use declareAttachedIdentifiers with the same shape. It never makes the two devices the same device; it only feeds suggested links.

Host or Gateway

Two different things were once both called a gateway, so choose by what the box is.

  • A machine your integration talks to (a server, a console, a NAS) is a Host: one device of type Workload with role host. It carries the workload data (CPU, memory, temperature, disks), the admin link, the identifiers, and workload.restart when the machine can restart. Declare workload.getOptions truthfully: the interface draws only the controls you declared, enabled by the current state. A value you could not read is null, never 0.
  • A Gateway (DeviceType.Gateway) exists only when necessary: a physical box that bridges a radio or serial protocol, or an account-only integration with no machine to stand for. It is a sibling of the devices it brings, never their parent, and it carries the integration id.

Do not adopt the same machine twice, once as a Gateway and once as a Host. A LAN scan that finds a machine proposes it as a Workload candidate with setupIntegration: true, meaning "set the integration up", not "adopt a device". The same flag marks a gateway or controller candidate.

Then