Skip to content

Commit

Permalink
Merge pull request #515 from johannrichard/alpha
Browse files Browse the repository at this point in the history
Prepare 3.2.0-beta 
- fixing #511, #419 and refactoring code and reducing noise as well.
  • Loading branch information
johannrichard authored Oct 24, 2022
2 parents f5d07bf + 1ae53f8 commit f486b7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ web_modules/
.yarn/plugins
.yarn/sdks
.yarn/unplugged
.yarn/releases
.yarnrc.yml
.pnp.*

# Github templates and actions, own stuff
Expand Down
13 changes: 11 additions & 2 deletions src/dingzAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -1495,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}°`,
);
Expand Down

0 comments on commit f486b7b

Please sign in to comment.