# shellies-ds9

> Handles communication with the next generation of Shelly devices

Latest version **1.1.9** (published 2025-02-26) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install shellies-ds9
pnpm add shellies-ds9
yarn add shellies-ds9
bun add shellies-ds9
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.9 |
| Published | 2025-02-26 |
| First published | 2023-11-16 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 417.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Alexander Rydén/ David S. |
| Maintainers | cubi1337 |
| Keywords | shelly |

## Links

- npm: https://www.npmjs.com/package/shellies-ds9
- Repository: https://github.com/cubi1337/node-shellies-ds9
- Homepage: https://github.com/cubi1337/node-shellies-ds9#readme
- Issues: https://github.com/cubi1337/node-shellies-ds9/issues
- Funding: https://ko-fi.com/cubi1337
- npm.io page: https://npm.io/package/shellies-ds9

## Dependencies (6)

- [ws](https://npm.io/package/ws.md) ^8.14.2
- [json-rpc-2.0](https://npm.io/package/json-rpc-2.0.md) ^1.7.0
- [eventemitter3](https://npm.io/package/eventemitter3.md) ^5.0.1
- [multicast-dns](https://npm.io/package/multicast-dns.md) ^7.2.5
- [fast-deep-equal](https://npm.io/package/fast-deep-equal.md) ^3.1.3
- [@types/multicast-dns](https://npm.io/package/@types/multicast-dns.md) ^7.2.4

## Recent versions

- 1.1.9 (latest) — 2025-02-26
- 1.1.8 — 2025-02-26
- 1.1.7 — 2024-12-19
- 1.1.6 — 2024-09-17
- 1.1.4 — 2024-09-17
- 1.1.3 — 2024-08-23
- 1.1.2 — 2024-07-19
- 1.1.0 — 2024-07-19
- 1.0.9 — 2024-07-17
- 1.0.8 — 2024-07-17
- 1.0.7 — 2024-05-21
- 1.0.6 — 2024-05-13
- 1.0.5 — 2024-02-27
- 1.0.4 — 2023-12-22
- 1.0.3 — 2023-12-08
- … 13 more at https://npm.io/package/shellies-ds9/versions

## README

# node-shellies-ds9

[![npm-version](https://badgen.net/npm/v/shellies-ds9)](https://www.npmjs.com/package/shellies-ds9)

Handles communication with the next generation of Shelly devices. This Package is only to pimp up the existing package https://badgen.net/npm/v/shellies-ng. Because I'm lost if my Minis don't run in the Homebridge.
If Alex creates a new version of his package that supports the Mini devices, I will delete this package again. thx@sw-koenig...

For the first generation, see [node-shellies](https://github.com/alexryd/node-shellies).

## Supported devices

- [Shelly Plus 1 + V3](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlus1)
- [Shelly Plus 1 PM + V3](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlus1PM)
- [Shelly Plus 1 Mini + V3](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlus1)
- [Shelly Plus 1 PM Mini + V3](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlus1PM)
- [Shelly Plus PM Mini + V3](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlusPMMini)
- [Shelly Plus 2 PM](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlus2PM)
- [Shelly Plus I4 +V3](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlusI4)
- [Shelly Plus Plug S](https://kb.shelly.cloud/knowledge-base/shelly-plus-plug-s-1)
- [Shelly Plus Plug US](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlugUS)
- [Shelly Plus Plug UK](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlusPlugUK)
- [Shelly Plus Plug IT](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlusPlugIT)
- [Shelly Plus H&T +V3](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlusHT)
- [Shelly Plus 0-10V Dimmer](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlus10V)
- [Shelly Dimmer 0/1-10V PM](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen3/ShellyDimmer0110VPMG3)
- [Shelly Dimmer](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen3/ShellyDimmerG3)
- [Shelly Pro 1](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPro1)
- [Shelly Pro 1 PM](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPro1PM)
- [Shelly Pro 2](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPro2)
- [Shelly Pro 2 PM](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPro2PM)
- [Shelly Pro 3](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPro3)
- [Shelly Pro 4 PM](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPro4PM)
- [Shelly Pro Dual Cover PM](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyProDualCoverPM)
- [Shelly Pro Dimmer 1PM](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyProDimmer1PM)
- [Shelly Pro Dimmer 0/1-10V PM](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyProDimmer0110VPM)
- [Shelly Pro Dimmer 2PM](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyProDimmer2PM)

<sup>1</sup> Support for outbound websockets is a work in progress.

## Basic usage example

```typescript
import {
  Device,
  DeviceId,
  MdnsDeviceDiscoverer,
  Shellies,
  ShellyPlus1,
} from "shellies-ds9";

const shellies = new Shellies();

// handle discovered devices
shellies.on("add", async (device: Device) => {
  console.log(`${device.modelName} discovered`);
  console.log(`ID: ${device.id}`);

  // use instanceof to determine the device model
  if (device instanceof ShellyPlus1) {
    const plus1 = device as ShellyPlus1;

    // toggle the switch
    await plus1.switch0.toggle();
  }
});

// handle asynchronous errors
shellies.on("error", (deviceId: DeviceId, error: Error) => {
  console.error("An error occured:", error.message);
});

// create an mDNS device discoverer
const discoverer = new MdnsDeviceDiscoverer();
// register it
shellies.registerDiscoverer(discoverer);
// start discovering devices
discoverer.start();
```

See [homebridge-shelly-ng]() for a real-world example.

---
_Source: https://npm.io/package/shellies-ds9 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
