Skip to content

Commit

Permalink
fix: Don't allow groupID 0 (#961)
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Mar 9, 2024
1 parent 2bf09e4 commit f5270fe
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/controller/model/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class Group extends Entity {

public static create(groupID: number): Group {
assert(typeof groupID === 'number', 'GroupID must be a number');
// Don't allow groupID 0, from the spec:
// "Scene identifier 0x00, along with group identifier 0x0000, is reserved for the global scene used by the OnOff cluster"
assert(groupID >= 1, 'GroupID must be at least 1');
Group.loadFromDatabaseIfNecessary();
if (Group.groups[groupID]) {
throw new Error(`Group with groupID '${groupID}' already exists`);
Expand Down

0 comments on commit f5270fe

Please sign in to comment.