Skip to content

Commit

Permalink
fixed edge case crash on button updates
Browse files Browse the repository at this point in the history
  • Loading branch information
foxriver76 committed Jul 30, 2023
1 parent 2557204 commit a0dd3be
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ In den Adapter-Settings muss die IP der Hue Bridge sowie ein Username konfigurie
Placeholder for the next version (at the beginning of the line):
### __WORK IN PROGRESS__
-->

### __WORK IN PROGRESS__
* (foxriver76) fixed edge case crash on button updates

### 3.9.3 (2023-06-14)
* (foxriver76) fix crash cases on unknown push updates (closes #417)

Expand Down
3 changes: 1 addition & 2 deletions build/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/main.js.map

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ interface BridgeUpdate {
power_state?: { battery_level: number; battery_state: string };
/** For type button */
button: {
button_report: { event: ButtonEventType; updated: string };
button_report?: { event: ButtonEventType; updated: string };
last_event: ButtonEventType;
};
}
Expand Down Expand Up @@ -1157,8 +1157,7 @@ class Hue extends utils.Adapter {
this.setState(`${channelName}.battery`, update.power_state.battery_level, true);
}

if (update.button) {
// TODO: implement encoding for buttonevent
if (update.button.button_report) {
this.setState(`${channelName}.lastupdated`, update.button.button_report.updated, true);
this.setState(
`${channelName}.buttonevent`,
Expand Down

0 comments on commit a0dd3be

Please sign in to comment.