Skip to content

Commit

Permalink
Merge pull request #514 from johannrichard/alpha
Browse files Browse the repository at this point in the history
Prepare new 3.2.0-beta
  • Loading branch information
johannrichard authored Oct 24, 2022
2 parents 19ab2f5 + c6422e2 commit f5d07bf
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/dingzAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export class DingzAccessory extends DingzDaBaseAccessory {
.then((callBackUrl) => {
// Set the callback URL
const endpoints = ['generic'];
const platformCallbackUrl = this.platform.getCallbackUrl();

// Add PIR callbacks, depending on dingz Firmware version
if (this.hw.has_pir) {
Expand All @@ -246,9 +247,9 @@ export class DingzAccessory extends DingzDaBaseAccessory {
} else if (
// FIXME: because of #511
(semver.lt(this.hw.fw_version, '1.4.0') &&
!callBackUrl?.url?.includes(this.platform.getCallbackUrl())) ||
!callBackUrl?.url?.includes(platformCallbackUrl)) ||
(semver.gte(this.hw.fw_version, '1.4.0') &&
!callBackUrl?.generic?.includes(this.platform.getCallbackUrl()))
!callBackUrl?.generic?.includes(platformCallbackUrl))
) {
this.log.warn('Update existing callback URL ->', callBackUrl);

Expand Down Expand Up @@ -943,7 +944,7 @@ export class DingzAccessory extends DingzDaBaseAccessory {
await this.setWindowCovering({
id: id,
blind: position as number,
lamella: windowCovering.lamella,
lamella: (windowCovering.lamella / 90) * 100, // FIXES #419, we must convert ° to %
callback: callback,
});
}
Expand Down Expand Up @@ -979,14 +980,14 @@ export class DingzAccessory extends DingzDaBaseAccessory {
'Set Characteristic TargetHorizontalTiltAngle on ',
index,
'->',
angle,
`${angle}°`,
);
const id = this.getWindowCoveringId(index);
if (this.dingzStates.WindowCovers[id]) {
await this.setWindowCovering({
id: id,
blind: this.dingzStates.WindowCovers[id].position,
lamella: angle as number,
lamella: ((angle as number) / 90) * 100, // FIXES #419, we must convert ° to %
callback: callback,
});
}
Expand Down Expand Up @@ -1494,6 +1495,9 @@ export class DingzAccessory extends DingzDaBaseAccessory {
lamella: number;
callback: CharacteristicSetCallback;
}) {
this.log.debug(
`Setting WindowCovering ${id} to position ${blind} and angle ${lamella}°`,
);
// The API says the parameters can be omitted. This is not true
// {{ip}}/api/v1/shade/0?blind=<value>&lamella=<value>
const setWindowCoveringEndpoint = `${this.baseUrl}/api/v1/shade/${id}`;
Expand Down

0 comments on commit f5d07bf

Please sign in to comment.