mirror of
https://github.com/skydiver/ewelink-api.git
synced 2025-12-26 07:13:36 +01:00
setDevicePowerState: improved error handling
This commit is contained in:
@@ -14,12 +14,6 @@ module.exports = {
|
||||
async setDevicePowerState(deviceId, state, channel = 1) {
|
||||
const device = await this.getDevice(deviceId);
|
||||
|
||||
/** Check for errors */
|
||||
const error = _get(device, 'error', false);
|
||||
if (error) {
|
||||
throw new Error(`[${error}] ${errors[error]}`);
|
||||
}
|
||||
|
||||
let status = _get(device, 'params.switch', false);
|
||||
const switches = _get(device, 'params.switches', false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user