From c63877d55070ca5a181696de33c221886f3ec5d0 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sun, 19 May 2024 11:37:37 +0200 Subject: [PATCH] Update index.js --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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;