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

@yosnightfly/electra-smart-js-client

v1.0.5

Published

Electra Smart JS Client

Readme

Electra Smart JS Client

npm

Lightweight JavaScript/TypeScript client for interacting with Electra Smart devices and the Electra backend. This project is a JS port inspired by yonatanp/electrasmart and provides a convenient programmatic API for authentication, listing devices, reading telemetry, and sending commands.

Highlights

  • Minimal, promise-based API that works in Node.js and bundlers.
  • TypeScript definitions included in lib/ and src/ for first-class DX.
  • Exposes a Client class for common device operations.

Install

Install from npm:

npm install @yosnightfly/electra-smart-js-client

Or use npx for a quick auth helper:

npx electra-smart-js-client
# prints: { "imei": "<imei>", "token": "<token>" }

Quick Start (Node)

Programmatic usage with Node.js / TypeScript:

import { Client } from 'electra-smart-js-client';

async function main() {
  // Create a client with previously obtained credentials
  const client = new Client({ imei: '<imei>', token: '<token>' });

  // List devices
  const devices = await client.getDevices();
  console.log('devices', devices);

  // Read combined telemetry for a device
  const telemetry = await client.getTelemetry(devices[0].id);
  console.log('telemetry', telemetry);

  // Convenience helpers (examples)
  await client.setMode(devices[0].id, 'HEAT');
  await client.setTemperature(devices[0].id, 22);
}

main().catch(console.error);

Examples (individual methods)

Below are short, copy-pasteable examples demonstrating the primary Client methods.

// 1) Instantiate
const client = new Client({ imei: '<imei>', token: '<token>' });

// 2) List devices
const devices = await client.getDevices();

// 3) Get full telemetry (OPER, DIAG_L2, HB)
const telemetry = await client.getTelemetry(devices[0].id);
console.log(telemetry.OPER, telemetry.DIAG_L2, telemetry.HB);

// 4) Get only operational telemetry (OPER)
const oper = await client.getOperationalTelemetry(devices[0].id);
console.log('OPER', oper);

// 5) Send a low-level command (override operational fields)
await client.sendCommand(devices[0].id, { SPT: '22', AC_MODE: 'HEAT' });

// 6) High-level helpers
await client.setTemperature(devices[0].id, 24); // sets SPT
await client.setMode(devices[0].id, 'COOL');
await client.setTimer(devices[0].id, true);
await client.setShabbatMode(devices[0].id, false);
await client.setFanSpeed(devices[0].id, '3');
await client.setIFeel(devices[0].id, true);
await client.setSleep(devices[0].id, false);

Replace the example method names above with the exact APIs available on Client in your installed version — autocomplete and type hints are available when using TypeScript.

API (overview)

  • new Client({ imei, token }) — instantiate with credentials.
  • client.getDevices() — returns a list of known devices.
  • client.getDeviceTelemetry(deviceId) — fetch latest telemetry for a device.
  • client.sendCommand(deviceId, payload) — send a command to a device.
  • Additional server helpers are available under lib/electra/server-types for lower-level interactions (OTP, token validation, etc.).

See the lib/ directory for built JS and the src/ directory for TypeScript source and types.

Development

Clone and install dependencies:

git clone https://github.com/rluvaton/electra-smart-js-client.git
cd electra-smart-js-client
npm install

Build and run examples:

npm run build
node ./lib/index.js

Run TypeScript checks:

npm run build:types
npm run lint

Contributing

Contributions, bug reports and pull requests are welcome. When opening issues or PRs, please include:

  • Node/npm versions you tested with
  • Repro steps and minimal code sample

License

This project is provided under the terms in LICENSE.md.

Contact

For questions or support, open an issue on the repository.