From 8df89afa0e1f11b0716d43577ea44079d17be882 Mon Sep 17 00:00:00 2001 From: Johann Richard <189003+johannrichard@users.noreply.github.com> Date: Mon, 24 Oct 2022 21:50:59 +0200 Subject: [PATCH 1/3] build(dingz): :package: improve packaging for npm - remove unnecessary files from package --- .npmignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.npmignore b/.npmignore index b919c84..d1f451c 100644 --- a/.npmignore +++ b/.npmignore @@ -131,6 +131,8 @@ web_modules/ .yarn/plugins .yarn/sdks .yarn/unplugged +.yarn/releases +.yarnrc.yml .pnp.* # Github templates and actions, own stuff From 156514152bbbcd9357b66eddbb75ee51dab26a32 Mon Sep 17 00:00:00 2001 From: Johann Richard <189003+johannrichard@users.noreply.github.com> Date: Mon, 24 Oct 2022 22:06:51 +0200 Subject: [PATCH 2/3] fix(dingz): :bug: also fix PIR callback endpoints - PIR endpoints on dingz are doubled, requiring changes to the plugin - fixes #511 --- src/dingzAccessory.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dingzAccessory.ts b/src/dingzAccessory.ts index 0eb8831..bcd301f 100644 --- a/src/dingzAccessory.ts +++ b/src/dingzAccessory.ts @@ -231,8 +231,11 @@ export class DingzAccessory extends DingzDaBaseAccessory { if (this.hw.has_pir) { if (semver.lt(this.hw.fw_version, '1.2.0')) { endpoints.push('pir/single'); - } else { + } else if (semver.lt(this.hw.fw_version, '1.4.0')) { endpoints.push('pir/generic', 'pir/rise', 'pir/fall'); + } else { + // FIXES #511: Newer FW have (yet!) other endpoint for PIR callbacks + endpoints.push('pir1/rise', 'pir1/fall'); } } @@ -260,7 +263,7 @@ export class DingzAccessory extends DingzDaBaseAccessory { endpoints: endpoints, }); } else { - this.log.debug('Callback URL already set ->', callBackUrl?.url); + this.log.debug('Callback URL already set ->', callBackUrl); } }) .catch(this.handleRequestErrors.bind(this)); From 1ae53f8fc7a39662c9794f917123049b2924d1ab Mon Sep 17 00:00:00 2001 From: Johann Richard <189003+johannrichard@users.noreply.github.com> Date: Mon, 24 Oct 2022 22:18:11 +0200 Subject: [PATCH 3/3] fix(dingz): :bug: lamella API only accepts integer values - position and angle must be integer values --- src/dingzAccessory.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dingzAccessory.ts b/src/dingzAccessory.ts index bcd301f..873835e 100644 --- a/src/dingzAccessory.ts +++ b/src/dingzAccessory.ts @@ -1498,6 +1498,12 @@ export class DingzAccessory extends DingzDaBaseAccessory { lamella: number; callback: CharacteristicSetCallback; }) { + // The API only accepts integer numbers. + // As we juggle with ° vs %, we must round + // the values for blind and lamella to the nearest integer + blind = Math.round(blind); + lamella = Math.round(lamella); + this.log.debug( `Setting WindowCovering ${id} to position ${blind} and angle ${lamella}°`, );