Skip to content

Commit

Permalink
expose: allow setting the label for Lock()
Browse files Browse the repository at this point in the history
For devices with multiple locks or for devices that have a lock function, allow setting of a label.
e.g. for TRV's with a keypad_lockout it is now called keypad_lockout instead of state which is confusing if there are multiple switches/locks all called 'state'
  • Loading branch information
sjorge committed Mar 14, 2021
1 parent 16dbb48 commit 9a7ef82
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/exposes.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ class Lock extends Base {

withState(property, valueOn, valueOff, description, access=a.ALL) {
assert(!this.endpoint, 'Cannot add feature after adding endpoint');
this.features.push(new Binary('state', access, valueOn, valueOff).withProperty(property).withDescription(description));
this.features.push(new Binary(property, access, valueOn, valueOff).withProperty(property).withDescription(description));
return this;
}

withLockState(property, description) {
assert(!this.endpoint, 'Cannot add feature after adding endpoint');
this.features.push(new Enum('lock_state', access.STATE, ['not_fully_locked', 'locked', 'unlocked']).withProperty(property).withDescription(description));
this.features.push(new Enum(property, access.STATE, ['not_fully_locked', 'locked', 'unlocked']).withProperty(property).withDescription(description));
return this;
}
}
Expand Down

0 comments on commit 9a7ef82

Please sign in to comment.