fix: properly implement setValue
This commit is contained in:
parent
0f899d93b8
commit
aef438e4d6
5
index.js
5
index.js
|
@ -148,6 +148,9 @@ const CONTROL_CODE = {
|
|||
|
||||
class IRUSBProperty extends Property {
|
||||
async setValue(value) {
|
||||
if(typeof value !== 'boolean') {
|
||||
throw new Error(`Invalid value type ${typeof value}. Expecting boolean.`);
|
||||
}
|
||||
if(this.name === 'power') {
|
||||
if(value) {
|
||||
return this.device.sendCommand('WAKE');
|
||||
|
@ -160,6 +163,8 @@ class IRUSBProperty extends Property {
|
|||
}
|
||||
return this.device.sendKey('PAUSE');
|
||||
}
|
||||
this.setCachedValueAndNotify(value);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue