api-sonoff
v1.2.1
Published
Promise based Sonoff API for node.js
Downloads
1
Maintainers
Readme
Sonoff
Promise based Sonoff API for node.js
Table of Contents
Features
- Startup
- Wifi Configuration
- Wifi Signal
- Interrupter
- Automatic Interrupter
- Info Device
Installing
Using npm:
$ npm install api-sonoff
Example
import sonoff from 'api-sonoff'
const {
startup,
wifiConfiguration,
wifiSignal,
interrupter,
automaticInterrupter,
infoDevice
} = sonoff('http://10.0.0.170', 8082, '1003564a2a')
startup('stay')
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
wifiConfiguration('home-5G', '123456')
.then(() => {
console.log('ok')
})
.catch(error => {
console.log(error)
})
wifiSignal()
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
interrupter(true)
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
automaticInterrupter()
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
infoDevice()
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})