diff --git a/index.js b/index.js index 9f7b3ff..d5e9fe7 100755 --- a/index.js +++ b/index.js @@ -4618,7 +4618,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) } - if(Math.abs(returnValue - service.TargetValue) <= 1) {service.Moving=Characteristic.PositionState.STOPPED;} + if(returnValue === service.TargetValue) {service.Moving=Characteristic.PositionState.STOPPED;} else if (service.TargetValue !== undefined && service.Moving===Characteristic.PositionState.STOPPED) {service.TargetValue=undefined;} this.log('debug','---------update Blinds Value(refresh):',returnValue,'% soit',cmd.currentValue,' / ',service.maxValue,' : ',positionStateLabel(service.Moving)); break; @@ -4632,7 +4632,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i } returnValue = 100-returnValue; // invert percentage - if(Math.abs(returnValue - service.TargetValue) <= 1) {service.Moving=Characteristic.PositionState.STOPPED;} + if(returnValue === service.TargetValue) {service.Moving=Characteristic.PositionState.STOPPED;} else if (service.TargetValue !== undefined && service.Moving===Characteristic.PositionState.STOPPED) {service.TargetValue=undefined;} this.log('debug','---------update Inverted Blinds Value(refresh):',returnValue,'% soit',cmd.currentValue,' / ',service.maxValue,' : ',positionStateLabel(service.Moving)); break; @@ -4641,7 +4641,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i returnValue = parseInt(cmd.currentValue); returnValue = rangeToPercentage(returnValue, service.minValue, service.maxValue); - if(Math.abs(returnValue - service.TargetValue) <= 1) {service.Moving=Characteristic.PositionState.STOPPED;} + if(returnValue === service.TargetValue) {service.Moving=Characteristic.PositionState.STOPPED;} else if (service.TargetValue !== undefined && service.Moving===Characteristic.PositionState.STOPPED) {service.TargetValue=undefined;} this.log('debug','---------update WindowMoto Value(refresh):',returnValue,'% soit',cmd.currentValue,' / ',service.maxValue,' : ',positionStateLabel(service.Moving)); break;