https://github.com/dresende/node-sr201
NodeJS SR-201 Network Relay control
https://github.com/dresende/node-sr201
Last synced: 11 months ago
JSON representation
NodeJS SR-201 Network Relay control
- Host: GitHub
- URL: https://github.com/dresende/node-sr201
- Owner: dresende
- Created: 2018-10-03T21:44:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-04T10:29:59.000Z (over 7 years ago)
- Last Synced: 2025-01-02T02:44:29.402Z (about 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## SR-201 Network Relay
NodeJS SR-201 network relay protocol.
### Install
```sh
npm i sr201
```
### Usage
```js
const sr201 = require("sr201");
sr201.connect("192.168.1.100").then(async (client) => {
await client.on(2);
await client.delay(2000);
await client.off(2);
console.log(client.status(2));
await client.end();
}, (err) => {
console.log(err);
});
```
### Reconfigure
```js
const sr201 = require("sr201");
sr201.connect("192.168.1.100").then(async (client) => {
await client.reconfigure(
"192.168.10.123", // ip
"255.255.255.0", // mask
"192.168.10.1", // gateway
"192.168.10.1", // dns
);
// in the end, settings are saved and device restarts
}, (err) => {
console.log(err);
});
```