Skip to content

Commit

Permalink
fix(dingz): 🐛 further fixes for new callback-url scheme
Browse files Browse the repository at this point in the history
- fixes new callback url scheme for FW v1.4.x

fixes #511
  • Loading branch information
johannrichard committed Oct 24, 2022
1 parent d218c53 commit b7588ee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/dingzAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,13 @@ export class DingzAccessory extends DingzDaBaseAccessory {
token: this.device.token,
endpoints: endpoints,
});
} else if (!callBackUrl?.url.includes(this.platform.getCallbackUrl())) {
} else if (
// FIXME: because of #511
(semver.lt(this.hw.fw_version, '1.4.0') &&
!callBackUrl?.url?.includes(this.platform.getCallbackUrl())) ||
(semver.gte(this.hw.fw_version, '1.4.0') &&
!callBackUrl?.generic?.includes(this.platform.getCallbackUrl()))
) {
this.log.warn('Update existing callback URL ->', callBackUrl);

this.platform.setButtonCallbackUrl({
Expand Down
4 changes: 3 additions & 1 deletion src/lib/commonTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export interface AccessoryTypes {
[key: string]: AccessoryType;
}

// FIXME: Needed because of #511
export interface AccessoryActionUrl {
url: string;
url?: string;
generic?: string;
}
5 changes: 4 additions & 1 deletion src/myStromPIRAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ export class MyStromPIRAccessory extends DingzDaBaseAccessory {
token: this.device.token,
endpoints: ['pir/generic'],
});
} else if (!callBackUrl?.url.includes(this.platform.getCallbackUrl())) {
} else if (
// FIXME: Needed because of #511
!callBackUrl?.url?.includes(this.platform.getCallbackUrl())
) {
this.log.warn('Update existing callback URL ->', callBackUrl);
// Set the callback URL (Override!)
this.platform.setButtonCallbackUrl({
Expand Down

0 comments on commit b7588ee

Please sign in to comment.