setDevicePowerState: improved error handling

This commit is contained in:
Martín M
2020-10-21 21:19:01 -03:00
parent e5242589f8
commit ad2d72f4ce

View File

@@ -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);