npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-red-contrib-sok

v1.0.4

Published

Simple Node-RED BLE reader for SOK smart batteries.

Readme

node-red-contrib-sok

Strict TypeScript Node.js library, CLI, and Node-RED nodes for SOK smart batteries over BLE.

The current implementation targets the BLE protocol seen in captures/SOK Batterie SK12V324PH00057.pklg:

  • advertised name: SK12V314XXXXXXX
  • service UUID: fff0
  • notify characteristic: fff1
  • write characteristic: fff2
  • payload protocol: Modbus RTU read-holding-register frames over BLE notifications

Library

The package exports a typed ESM API from dist/index.js:

  • discoverBatteries(options) returns matching BLE devices
  • readBatteries(options) discovers and reads zero, one, or many devices
  • readBatteryDevice(device, options) reads one discovered device
  • connectBatteryReaders(options) discovers and connects once, then returns persistent readers with read() and disconnect()
  • shutdownBluetooth() stops active BLE sessions

Read output is always an array at the CLI and Node-RED layer. Each reading contains compact device metadata, a timestamp, and decoded data. Raw register maps and Modbus frames are not included in public JSON output.

For repeated reads, keep the BLE session open and only issue new register requests:

import { connectBatteryReaders } from 'node-red-contrib-sok';

const readers = await connectBatteryReaders({
  deviceName: 'SK12V314XXXXXXX',
  reads: 'telemetry'
});

try {
  const reading = await readers[0].read();
  console.log(reading.decoded);
} finally {
  await Promise.all(readers.map((reader) => reader.disconnect()));
}

Nodes

  • sok-battery-device: config node for the battery BLE target
  • sok-battery-get: input node that reads telemetry, limits, and status

Use the config node's search button to discover SOK batteries from the Node-RED editor. Select one exact advertised device name, or keep "All discovered devices".

The output is placed in msg.payload as an array with zero, one, or multiple readings.

CLI

npm install
npm run build
npm run discover
npm run get

Useful options:

node ./bin/sok-battery.js discover --name-prefix SK
node ./bin/sok-battery.js get --reads telemetry
node ./bin/sok-battery.js get SK12V314XXXXXXX
node ./bin/sok-battery.js get SK12V314XXXXXXX --interval 5
node ./bin/sok-battery.js get --bluetooth bluez --debug

get --interval 5 keeps the BLE session open and reads every five seconds until stopped.

Bluetooth backends:

  • auto: uses BlueZ on Linux when available, otherwise noble
  • bluez: uses Linux BlueZ over D-Bus, useful on devices where noble would require extra privileges
  • noble: uses @abandonware/noble, useful for macOS smoke tests

Development

npm run build
npm run lint
npm test
npm run check