From fbab4218557aa161e6270326d896c2ca985fe011 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:19:33 +0000 Subject: [PATCH 01/20] Bump eslint from 8.57.0 to 9.0.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.57.0 to 9.0.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.57.0...v9.0.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5f1fb9f..0d97bde 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "devDependencies": { "@babel/core": ">=7.23.9", "@babel/eslint-parser": "^7.23.10", - "eslint": "^8.56.0" + "eslint": "^9.0.0" }, "author": "Nebz ", "license": "GPL-2.0", From 98e24f076ca224816237a9471058ea820143f680 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:05:32 +0000 Subject: [PATCH 02/20] Update @babel/core requirement from >=7.23.9 to >=7.24.4 (#214) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0d97bde..571d210 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "fakegato-history": "NebzHB/fakegato-history#master" }, "devDependencies": { - "@babel/core": ">=7.23.9", + "@babel/core": ">=7.24.4", "@babel/eslint-parser": "^7.23.10", "eslint": "^9.0.0" }, From 7de3b9673f0c8338d8d5b6cf4c57476dba6074ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:05:59 +0000 Subject: [PATCH 03/20] Bump express from 4.18.2 to 4.19.2 (#213) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 571d210..719ccd1 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "dependencies": { "async": "3.2.5", "axios": "1.6.7", - "express": "4.18.2", + "express": "4.19.2", "fakegato-history": "NebzHB/fakegato-history#master" }, "devDependencies": { From f1e04a1c63055670e40cbba4a7ef483bd68f923f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:06:19 +0000 Subject: [PATCH 04/20] Update @babel/eslint-parser requirement from ^7.23.10 to ^7.24.1 Updates the requirements on [@babel/eslint-parser](https://github.com/babel/babel/tree/HEAD/eslint/babel-eslint-parser) to permit the latest version. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.1/eslint/babel-eslint-parser) --- updated-dependencies: - dependency-name: "@babel/eslint-parser" dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 719ccd1..f579b95 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "devDependencies": { "@babel/core": ">=7.24.4", - "@babel/eslint-parser": "^7.23.10", + "@babel/eslint-parser": "^7.24.1", "eslint": "^9.0.0" }, "author": "Nebz ", From d2f1570f1f6a64a670995d899c6ef1b10bb681e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:06:34 +0000 Subject: [PATCH 05/20] Bump axios from 1.6.7 to 1.6.8 Bumps [axios](https://github.com/axios/axios) from 1.6.7 to 1.6.8. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v1.6.7...v1.6.8) --- updated-dependencies: - dependency-name: axios dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 719ccd1..21bb0ca 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "dependencies": { "async": "3.2.5", - "axios": "1.6.7", + "axios": "1.6.8", "express": "4.19.2", "fakegato-history": "NebzHB/fakegato-history#master" }, From f305fea0bb2ad9319052e41ba64eb0c8b6bc7d6b Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Thu, 11 Apr 2024 08:34:35 +0200 Subject: [PATCH 06/20] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5d46bf..e89db45 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "devDependencies": { "@babel/core": ">=7.24.4", "@babel/eslint-parser": "^7.24.1", - "eslint": "^9.0.0" + "eslint": "^8.0.0" }, "author": "Nebz ", "license": "GPL-2.0", From 54a2c34612ace4dddee0f862a1e1ce578fe75688 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Thu, 11 Apr 2024 08:36:46 +0200 Subject: [PATCH 07/20] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e89db45..6687559 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "devDependencies": { "@babel/core": ">=7.24.4", "@babel/eslint-parser": "^7.24.1", - "eslint": "^8.0.0" + "eslint": "^8.57.0" }, "author": "Nebz ", "license": "GPL-2.0", From 0515c9ef7e6379f3ed791061161a2dac1f921e91 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Thu, 11 Apr 2024 09:01:38 +0200 Subject: [PATCH 08/20] Update package.json --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 6687559..c2a34e6 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,7 @@ "fakegato-history": "NebzHB/fakegato-history#master" }, "devDependencies": { - "@babel/core": ">=7.24.4", - "@babel/eslint-parser": "^7.24.1", + "eslint": "^8.57.0" }, "author": "Nebz ", From 35355bcd9f536bb1b6926261c47e3b03e41dd7a9 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Thu, 11 Apr 2024 09:06:17 +0200 Subject: [PATCH 09/20] Update package.json --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c2a34e6..6687559 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "fakegato-history": "NebzHB/fakegato-history#master" }, "devDependencies": { - + "@babel/core": ">=7.24.4", + "@babel/eslint-parser": "^7.24.1", "eslint": "^8.57.0" }, "author": "Nebz ", From 20b5d95f4da85d7558427b468ee9238df80a6465 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 29 Apr 2024 09:11:46 +0200 Subject: [PATCH 10/20] Update index.js --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 4bc848e..997283c 100755 --- a/index.js +++ b/index.js @@ -4612,7 +4612,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i for (const cmd of cmdList) { if (cmd.generic_type == 'FLAP_STATE' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) @@ -4625,7 +4625,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i } if (cmd.generic_type == 'FLAP_STATE_CLOSING' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) @@ -4639,7 +4639,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i } if (cmd.generic_type == 'WINDOW_STATE' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(returnValue === service.TargetValue) {service.Moving=Characteristic.PositionState.STOPPED;} else if (service.TargetValue !== undefined && service.Moving===Characteristic.PositionState.STOPPED) {service.TargetValue=undefined;} @@ -4651,7 +4651,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i case Characteristic.TargetPosition.UUID : if(service.TargetValue === undefined) { returnValue = parseInt(service.infos.state.currentValue); - returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) From 32a283a5bbec334ec69f240950d251214278fba2 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 29 Apr 2024 09:12:06 +0200 Subject: [PATCH 11/20] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6687559..a3d3019 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nebz/homebridge-jeedom", "version": "v1.7.0", - "cust_serial": "0024", + "cust_serial": "0025", "description": "Homebridge plugin for Jeedom ", "main": "index.js", "private":true, From 8b20e139c1f381c4daae57e4866966a94fee9933 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:43:33 +0200 Subject: [PATCH 12/20] Update index.js --- index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 997283c..cd2f839 100755 --- a/index.js +++ b/index.js @@ -4612,36 +4612,36 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i for (const cmd of cmdList) { if (cmd.generic_type == 'FLAP_STATE' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) } - if(returnValue === service.TargetValue) {service.Moving=Characteristic.PositionState.STOPPED;} + if(Math.abs(returnValue - service.TargetValue) <= 1) {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; } if (cmd.generic_type == 'FLAP_STATE_CLOSING' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) } returnValue = 100-returnValue; // invert percentage - if(returnValue === service.TargetValue) {service.Moving=Characteristic.PositionState.STOPPED;} + if(Math.abs(returnValue - service.TargetValue) <= 1) {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; } if (cmd.generic_type == 'WINDOW_STATE' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); - if(returnValue === service.TargetValue) {service.Moving=Characteristic.PositionState.STOPPED;} + if(Math.abs(returnValue - service.TargetValue) <= 1) {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; @@ -4651,7 +4651,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i case Characteristic.TargetPosition.UUID : if(service.TargetValue === undefined) { returnValue = parseInt(service.infos.state.currentValue); - returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) From 454aafe016301a8e467227a0ce085af25aaebbb6 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:43:44 +0200 Subject: [PATCH 13/20] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a3d3019..364157b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nebz/homebridge-jeedom", "version": "v1.7.0", - "cust_serial": "0025", + "cust_serial": "0026", "description": "Homebridge plugin for Jeedom ", "main": "index.js", "private":true, From 46bdc986283571de9b4b61ead396ce1f18e24e8e Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Fri, 17 May 2024 15:40:47 +0200 Subject: [PATCH 14/20] Update index.js --- index.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index cd2f839..69c2017 100755 --- a/index.js +++ b/index.js @@ -3276,7 +3276,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser action = 'setValue'; const oldValue = value; value = 100 - value;// invert percentage - value = Math.round(((value / 100)*(service.maxValue-service.minValue))+service.minValue); // transform from percentage to scale + value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue); // transform from percentage to scale if(value > service.infos.state.currentValue) { service.Moving=Characteristic.PositionState.DECREASING; } else if (value != service.infos.state.currentValue) { @@ -3304,7 +3304,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser action = 'setValue'; const oldValue = value; value = 100 - value;// invert percentage - value = Math.round(((value / 100)*(service.maxValue-service.minValue))+service.minValue); // transform from percentage to scale + value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue); // transform from percentage to scale if(value > service.infos.state.currentValue) { service.Moving=Characteristic.PositionState.DECREASING; } else if (value != service.infos.state.currentValue) { @@ -3331,7 +3331,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } else { action = 'setValue'; const oldValue = value; - value = Math.round(((value / 100)*(service.maxValue-service.minValue))+service.minValue);// transform from percentage to scale + value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue);// transform from percentage to scale if(value > service.infos.state.currentValue) { service.Moving=Characteristic.PositionState.INCREASING; } else if (value != service.infos.state.currentValue) { @@ -3358,7 +3358,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser else if (service.actions.slider) { action = 'setValue'; const oldValue = value; - value = Math.round(((value / 100)*(service.maxValue-service.minValue))+service.minValue);// transform from percentage to scale + value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue);// transform from percentage to scale if(value > service.infos.state.currentValue) { service.Moving=Characteristic.PositionState.INCREASING; } else if (value != service.infos.state.currentValue) { @@ -3390,7 +3390,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } else { action = 'setValue'; const oldValue = value; - value = Math.round(((value / 100)*(service.maxValue-service.minValue))+service.minValue); + value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue); if(value > service.infos.state) { service.Moving=Characteristic.PositionState.INCREASING; } else if (value != service.infos.state) { @@ -3415,7 +3415,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser else if (service.actions.slider) { action = 'setValue'; const oldValue = value; - value = Math.round(((value / 100)*(service.maxValue-service.minValue))+service.minValue); + value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue); if(value > service.infos.state) { service.Moving=Characteristic.PositionState.INCREASING; } else if (value != service.infos.state) { @@ -4612,7 +4612,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i for (const cmd of cmdList) { if (cmd.generic_type == 'FLAP_STATE' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.ceil(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) @@ -4625,7 +4625,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i } if (cmd.generic_type == 'FLAP_STATE_CLOSING' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.ceil(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) @@ -4639,7 +4639,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i } if (cmd.generic_type == 'WINDOW_STATE' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.ceil(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(Math.abs(returnValue - service.TargetValue) <= 1) {service.Moving=Characteristic.PositionState.STOPPED;} else if (service.TargetValue !== undefined && service.Moving===Characteristic.PositionState.STOPPED) {service.TargetValue=undefined;} @@ -4651,7 +4651,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i case Characteristic.TargetPosition.UUID : if(service.TargetValue === undefined) { returnValue = parseInt(service.infos.state.currentValue); - returnValue = Math.round(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.ceil(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) From ada8d8e7249e2b90cf3b9d96b66fb9e10e7078b9 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sun, 19 May 2024 10:47:59 +0200 Subject: [PATCH 15/20] Update index.js --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 69c2017..6f925bf 100755 --- a/index.js +++ b/index.js @@ -4612,7 +4612,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i for (const cmd of cmdList) { if (cmd.generic_type == 'FLAP_STATE' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.ceil(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) @@ -4625,7 +4625,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i } if (cmd.generic_type == 'FLAP_STATE_CLOSING' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.ceil(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) @@ -4639,7 +4639,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i } if (cmd.generic_type == 'WINDOW_STATE' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.ceil(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(Math.abs(returnValue - service.TargetValue) <= 1) {service.Moving=Characteristic.PositionState.STOPPED;} else if (service.TargetValue !== undefined && service.Moving===Characteristic.PositionState.STOPPED) {service.TargetValue=undefined;} @@ -4651,7 +4651,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i case Characteristic.TargetPosition.UUID : if(service.TargetValue === undefined) { returnValue = parseInt(service.infos.state.currentValue); - returnValue = Math.ceil(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) From dc066d65d0f2fa897d1cfb823b1bb14c8299f209 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sun, 19 May 2024 10:54:14 +0200 Subject: [PATCH 16/20] Update index.js --- index.js | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 6f925bf..9f7b3ff 100755 --- a/index.js +++ b/index.js @@ -3276,7 +3276,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser action = 'setValue'; const oldValue = value; value = 100 - value;// invert percentage - value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue); // transform from percentage to scale + value = percentageToRange(value, service.minValue, service.maxValue); // transform from percentage to scale if(value > service.infos.state.currentValue) { service.Moving=Characteristic.PositionState.DECREASING; } else if (value != service.infos.state.currentValue) { @@ -3304,7 +3304,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser action = 'setValue'; const oldValue = value; value = 100 - value;// invert percentage - value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue); // transform from percentage to scale + value = percentageToRange(value, service.minValue, service.maxValue); // transform from percentage to scale if(value > service.infos.state.currentValue) { service.Moving=Characteristic.PositionState.DECREASING; } else if (value != service.infos.state.currentValue) { @@ -3331,7 +3331,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } else { action = 'setValue'; const oldValue = value; - value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue);// transform from percentage to scale + value = percentageToRange(value, service.minValue, service.maxValue); // transform from percentage to scale if(value > service.infos.state.currentValue) { service.Moving=Characteristic.PositionState.INCREASING; } else if (value != service.infos.state.currentValue) { @@ -3358,7 +3358,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser else if (service.actions.slider) { action = 'setValue'; const oldValue = value; - value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue);// transform from percentage to scale + value = percentageToRange(value, service.minValue, service.maxValue); // transform from percentage to scale if(value > service.infos.state.currentValue) { service.Moving=Characteristic.PositionState.INCREASING; } else if (value != service.infos.state.currentValue) { @@ -3390,7 +3390,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } else { action = 'setValue'; const oldValue = value; - value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue); + value = percentageToRange(value, service.minValue, service.maxValue); // transform from percentage to scale if(value > service.infos.state) { service.Moving=Characteristic.PositionState.INCREASING; } else if (value != service.infos.state) { @@ -3415,7 +3415,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser else if (service.actions.slider) { action = 'setValue'; const oldValue = value; - value = Math.ceil(((value / 100)*(service.maxValue-service.minValue))+service.minValue); + value = percentageToRange(value, service.minValue, service.maxValue); // transform from percentage to scale if(value > service.infos.state) { service.Moving=Characteristic.PositionState.INCREASING; } else if (value != service.infos.state) { @@ -4612,7 +4612,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i for (const cmd of cmdList) { if (cmd.generic_type == 'FLAP_STATE' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = rangeToPercentage(returnValue, service.minValue, service.maxValue); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) @@ -4625,7 +4625,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i } if (cmd.generic_type == 'FLAP_STATE_CLOSING' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = rangeToPercentage(returnValue, service.minValue, service.maxValue); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) @@ -4639,7 +4639,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i } if (cmd.generic_type == 'WINDOW_STATE' && cmd.id == service.cmd_id) { returnValue = parseInt(cmd.currentValue); - returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = rangeToPercentage(returnValue, service.minValue, service.maxValue); if(Math.abs(returnValue - service.TargetValue) <= 1) {service.Moving=Characteristic.PositionState.STOPPED;} else if (service.TargetValue !== undefined && service.Moving===Characteristic.PositionState.STOPPED) {service.TargetValue=undefined;} @@ -4651,7 +4651,7 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i case Characteristic.TargetPosition.UUID : if(service.TargetValue === undefined) { returnValue = parseInt(service.infos.state.currentValue); - returnValue = Math.floor(((returnValue-service.minValue) / (service.maxValue-service.minValue))*100); + returnValue = rangeToPercentage(returnValue, service.minValue, service.maxValue); if(service.maxValue == 100) { returnValue = returnValue > (service.maxValue-5) ? service.maxValue : returnValue; // >95% is 100% in home (flaps need yearly tunning) @@ -6435,6 +6435,16 @@ JeedomBridgedAccessory.prototype.delServices = function(accessory) { } }; +// convert range to percentage +function rangeToPercentage(value, min, max) { + return Math.floor(((value - min) / (max - min)) * 100); +} + +// convert percentage to range +function percentageToRange(percentage, min, max) { + return Math.ceil((percentage / 100) * (max - min) + min); +} + // -- hexToR // -- Desc : take the R value in a html color string // -- Params -- From 80fc1f8b1d713a5bf19db4b2b82ee927ce347975 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sun, 19 May 2024 10:54:23 +0200 Subject: [PATCH 17/20] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 364157b..fc0e30c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nebz/homebridge-jeedom", "version": "v1.7.0", - "cust_serial": "0026", + "cust_serial": "0027", "description": "Homebridge plugin for Jeedom ", "main": "index.js", "private":true, From b749a2d35b6d4cd7308c86dcdd92349fb197d1ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 19 May 2024 09:35:01 +0000 Subject: [PATCH 18/20] Update @babel/eslint-parser requirement from ^7.24.1 to ^7.24.5 (#221) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc0e30c..6501bd2 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "devDependencies": { "@babel/core": ">=7.24.4", - "@babel/eslint-parser": "^7.24.1", + "@babel/eslint-parser": "^7.24.5", "eslint": "^8.57.0" }, "author": "Nebz ", 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 19/20] 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; From f4a1899be743472e65adb1ba03d8d77e28be3ab9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 19 May 2024 09:38:43 +0000 Subject: [PATCH 20/20] Update @babel/core requirement from >=7.24.4 to >=7.24.5 (#219) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6501bd2..b20b27a 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "fakegato-history": "NebzHB/fakegato-history#master" }, "devDependencies": { - "@babel/core": ">=7.24.4", + "@babel/core": ">=7.24.5", "@babel/eslint-parser": "^7.24.5", "eslint": "^8.57.0" },