Skip to content

Commit

Permalink
Resolve power change to standby when device status is "unknown"
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafostar committed Sep 19, 2019
1 parent 6962aba commit 6174a74
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
});
}
Expand Down

0 comments on commit 6174a74

Please sign in to comment.