mirror of
https://github.com/skydiver/ewelink-api.git
synced 2025-12-21 13:23:05 +01:00
781 B
781 B
node script
Default region of this library is
us. If your are in a different one, you must specify region parameter or error 400/401 will be returned.
const ewelink = require('ewelink-api');
(async () => {
const connection = new ewelink({
email: '<your ewelink email>',
password: '<your ewelink password>',
region: '<your ewelink region>',
});
/* get all devices */
const devices = await connection.getDevices();
console.log(devices);
/* get specific devide info */
const device = await connection.getDevice('<your device id>');
console.log(device);
/* toggle device */
await connection.toggleDevice('<your device id>');
})();
If you don't know your region, use getRegion method