mirror of
https://github.com/skydiver/ewelink-api.git
synced 2025-12-21 21:33:11 +01:00
removed demos, added link to docs
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Check `demo/` directory for examples.
|
Check docs at https://ewelink-api.now.sh.
|
||||||
|
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
const ewelink = require('../main');
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
const conn = new ewelink({
|
|
||||||
email: '<your ewelink email>',
|
|
||||||
password: '<your ewelink password>',
|
|
||||||
});
|
|
||||||
|
|
||||||
/* get all devices */
|
|
||||||
const devices = await conn.getDevices();
|
|
||||||
console.log(devices);
|
|
||||||
|
|
||||||
/* get specific devide info */
|
|
||||||
const device = await conn.getDevice('<your device id>');
|
|
||||||
console.log(device);
|
|
||||||
|
|
||||||
/* toggle device */
|
|
||||||
await conn.toggleDevice('<your device id>');
|
|
||||||
})();
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
const ewelink = require('../main');
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
/* first request: get access token and api key */
|
|
||||||
const conn1 = new ewelink({
|
|
||||||
email: '<your ewelink email>',
|
|
||||||
password: '<your ewelink password>',
|
|
||||||
});
|
|
||||||
const login = await conn1.login();
|
|
||||||
const accessToken = login.at;
|
|
||||||
|
|
||||||
/* second request: use access token to request devices */
|
|
||||||
const conn2 = new ewelink({ at: accessToken });
|
|
||||||
const devices = await conn2.getDevices();
|
|
||||||
console.log(devices);
|
|
||||||
|
|
||||||
/* third request: use access token to request specific device info */
|
|
||||||
const conn3 = new ewelink({ at: accessToken });
|
|
||||||
const device = await conn3.getDevice('<your device id>');
|
|
||||||
console.log(device);
|
|
||||||
|
|
||||||
/* fourth request: use access token to toggle specific device info */
|
|
||||||
const conn4 = new ewelink({ at: accessToken });
|
|
||||||
await conn4.toggleDevice('<your device id>');
|
|
||||||
})();
|
|
||||||
Reference in New Issue
Block a user