Skip to content

Commit

Permalink
set back timer to guarantee correct countdown when app is close
Browse files Browse the repository at this point in the history
  • Loading branch information
simont77 committed Apr 15, 2018
1 parent b990c27 commit 9906312
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,14 @@ class LegrandMyHome {
if (accessory.power)
{
accessory.RemDuration = _value;
accessory.timerHandle = setInterval(function() {
accessory.IrrigationService.setCharacteristic(Characteristic.RemainingDuration,accessory.RemDuration);
accessory.RemDuration--;
if (accessory.RemDuration == 0)
clearInterval(accessory.timerHandle);
}.bind(this),1000);
}


}
}.bind(this));
Expand Down Expand Up @@ -1792,6 +1798,7 @@ class MHIrrigation {
}
else
{
clearInterval(this.timerHandle);
this.RemDuration = 0;
this.IrrigationService.setCharacteristic(Characteristic.RemainingDuration,this.RemDuration);
}
Expand Down

0 comments on commit 9906312

Please sign in to comment.