From 6174a7482ce79a7b632a9fa0fe873c099409fd43 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Thu, 19 Sep 2019 20:32:33 +0200 Subject: [PATCH] Resolve power change to standby when device status is "unknown" --- index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 4ebe80c..00180e6 100644 --- a/index.js +++ b/index.js @@ -511,8 +511,14 @@ module.exports = class Client { this.getStatus(deviceId).then(value => { - if(value !== powerStatus && !timedOut) + if(powerStatus === 'standby' && value === 'unknown') + { + ctl_debug(`Could not detect ${deviceId} powerStatus!`); + } + else if(value !== powerStatus && !timedOut) + { return waitPower(); + } clearTimeout(actionTimeout); this.togglingPower = false; @@ -524,8 +530,8 @@ module.exports = class Client } else { - ctl_debug(`${deviceId} powerStatus changed to: ${powerStatus}`); - resolve(powerStatus); + ctl_debug(`${deviceId} powerStatus changed to: ${value}`); + resolve(value); } }); }