Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ For the first generation, see [node-shellies](https://github.com/alexryd/node-sh
- [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 Plus RGBW PM](https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPlusRGBWPM)
- [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)
Expand All @@ -46,12 +47,12 @@ import {
MdnsDeviceDiscoverer,
Shellies,
ShellyPlus1,
} from "shellies-ds9";
} from 'shellies-ds9';

const shellies = new Shellies();

// handle discovered devices
shellies.on("add", async (device: Device) => {
shellies.on('add', async (device: Device) => {
console.log(`${device.modelName} discovered`);
console.log(`ID: ${device.id}`);

Expand All @@ -65,8 +66,8 @@ shellies.on("add", async (device: Device) => {
});

// handle asynchronous errors
shellies.on("error", (deviceId: DeviceId, error: Error) => {
console.error("An error occured:", error.message);
shellies.on('error', (deviceId: DeviceId, error: Error) => {
console.error('An error occured:', error.message);
});

// create an mDNS device discoverer
Expand Down
43 changes: 22 additions & 21 deletions src/devices/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
export * from "./base";
export * from './base';

export * from "./shelly-plus-1";
export * from "./shelly-plus-pm";
export * from "./shelly-plus-1-pm";
export * from "./shelly-plus-2-pm";
export * from "./shelly-plus-ht";
export * from "./shelly-plus-i4";
export * from "./shelly-plus-plug";
export * from "./shelly-pro-1";
export * from "./shelly-pro-1-pm";
export * from "./shelly-pro-2";
export * from "./shelly-pro-2-pm";
export * from "./shelly-pro-3";
export * from "./shelly-pro-4-pm";
export * from "./shelly-pro-dimmer-1-pm";
export * from "./shelly-pro-dimmer-2-pm";
export * from "./shelly-pro-dimmer-2-pm";
export * from "./shelly-pro-dual-cover-pm";
export * from "./shelly-plus-dimmer-pm";
export * from "./shelly-plus-dimmer";
export * from "./shelly-gen3-2-pm";
export * from './shelly-plus-1';
export * from './shelly-plus-pm';
export * from './shelly-plus-1-pm';
export * from './shelly-plus-2-pm';
export * from './shelly-plus-ht';
export * from './shelly-plus-i4';
export * from './shelly-plus-plug';
export * from './shelly-plus-rgbw-pm';
export * from './shelly-pro-1';
export * from './shelly-pro-1-pm';
export * from './shelly-pro-2';
export * from './shelly-pro-2-pm';
export * from './shelly-pro-3';
export * from './shelly-pro-4-pm';
export * from './shelly-pro-dimmer-1-pm';
export * from './shelly-pro-dimmer-2-pm';
export * from './shelly-pro-dimmer-2-pm';
export * from './shelly-pro-dual-cover-pm';
export * from './shelly-plus-dimmer-pm';
export * from './shelly-plus-dimmer';
export * from './shelly-gen3-2-pm';
64 changes: 64 additions & 0 deletions src/devices/shelly-plus-rgbw-pm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { component, Device, MultiProfileDevice } from './base';
import {
BluetoothLowEnergy,
Cloud,
Input,
Light,
Mqtt,
OutboundWebSocket,
Script,
Ui,
WiFi,
} from '../components';

export class ShellyPlusRGBWPM extends MultiProfileDevice {
static readonly model: string = 'SNDC-0D4P10WW';
static readonly modelName: string = 'Shelly Plus RGBW PM';

@component
readonly wifi = new WiFi(this);

@component
readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);

@component
readonly cloud = new Cloud(this);

@component
readonly mqtt = new Mqtt(this);

@component
readonly outboundWebSocket = new OutboundWebSocket(this);

@component
readonly input0 = new Input(this, 0);

@component
readonly input1 = new Input(this, 1);

@component
readonly input2 = new Input(this, 2);

@component
readonly input3 = new Input(this, 3);

@component
readonly light0 = new Light(this, 0);

@component
readonly light1 = new Light(this, 1);

@component
readonly light2 = new Light(this, 2);

@component
readonly light3 = new Light(this, 3);

@component
readonly script = new Script(this);

@component
readonly ui = new Ui(this);
}

Device.registerClass(ShellyPlusRGBWPM);