/nightvision

Lenbrook Service Discovery Protocol implementation for Node.js

Primary LanguageTypeScriptMIT LicenseMIT

Nightvision

Nightvision CI

Lenbrook Service Discovery Protocol implementation for Node.js. See specification.

This library provides you with a client and server implementation for the protocol that allows you to send and receive messages to discover supported devices and their capabilities as well as announce and delete services.

As mentioned in the specification, the guideline is to send startup messages 7 times within certain time interval and delays. This is considered out of scope for this library.

Also note that many BluOS devices might send the same UDP broadcast every n seconds in addition to query responses.

Example

import { createConnection } from "nightvision"
const conn = await createConnection()

conn.onData((err, result) => {
  if (err) {
    console.error(err)
    return
  }
  console.log(JSON.stringify(result, null, 2))
})

await conn.sendMessage({
  type: "query",
  messageType: "standard",
  classIds: ["0001"],
})