node-shellies
Handles communication with the first generation Shelly devices, using both CoAP and HTTP.
For the next generation devices, see node-shellies-ng.
Features
- Automatically detects Shelly devices (on the same network and subnet).
- Automatically detects when the status of a device changes, such as when a relay is turned on or off.
- Keeps track of devices and if they go offline (because no status update has been received in a given amount of time).
Supported devices
The following Shelly devices are supported:
- Shelly 1
- Shelly 1L
- Shelly 1PM
- Shelly 1AddOn
- Shelly 2
- Shelly 2.5
- Shelly 2LED
- Shelly 3EM
- Shelly 4Pro
- Shelly Air
- Shelly Bulb
- Shelly Button 1
- Shelly Color
- Shelly Dimmer
- Shelly Dimmer 2
- Shelly Dimmer W1
- Shelly Door/Window
- Shelly Door/Window 2
- Shelly Duo
- Shelly EM
- Shelly Flood
- Shelly Gas
- Shelly HD
- Shelly H&T
- Shelly i3
- Shelly Motion 1
- Shelly Plug
- Shelly Plug S
- Shelly Plug US
- Shelly RGBW
- Shelly RGBW2
- Shelly Sense
- Shelly Smoke
- Shelly Smoke 2
- Shelly TRV
- Shelly Uni
- Shelly Vintage
Notes
1 Requires setting the Internet & Security -> CoIoT -> Remote address
option on the Shelly device to the IP address of your device running
node-shellies.
Basic usage example
const shellies = require('shellies')
shellies.on('discover', device => {
// a new device has been discovered
console.log('Discovered device with ID', device.id, 'and type', device.type)
device.on('change', (prop, newValue, oldValue) => {
// a property on the device has changed
console.log(prop, 'changed from', oldValue, 'to', newValue)
})
device.on('offline', () => {
// the device went offline
console.log('Device with ID', device.id, 'went offline')
})
})
// start discovering devices and listening for status updates
shellies.start()