Commit 0e1e8c4b authored by Samuel Elliott's avatar Samuel Elliott

Update alternate power state characteristics if both the switch service and...

Update alternate power state characteristics if both the switch service and the television service are enabled
parent a26b3109
......@@ -277,7 +277,14 @@ class TVAccessory {
power_service.getCharacteristic(this.constructor.hap.Characteristic.On)
.on('get', callback => this.getPowerState().then(data => callback(undefined, data)).catch(callback))
.on('set', (on, callback) => this.setPowerState(on).then(data => callback(undefined, data)).catch(callback));
.on('set', (on, callback) => this.setPowerState(on).then(data => {
if (this.expose_television_service) {
this.tv_service.getCharacteristic(this.constructor.hap.Characteristic.Active)
.updateValue(on ? this.constructor.hap.Characteristic.Active.ACTIVE :
this.constructor.hap.Characteristic.Active.INACTIVE);
}
callback(undefined, data);
}).catch(callback));
return Object.defineProperty(this, 'power_service', {configurable: true, value: power_service}).power_service;
}
......@@ -441,7 +448,13 @@ class TVAccessory {
this.constructor.hap.Characteristic.Active.ACTIVE :
this.constructor.hap.Characteristic.Active.INACTIVE)).catch(callback))
.on('set', (on, callback) => this.setPowerState(on === this.constructor.hap.Characteristic.Active.ACTIVE ?
true : false).then(data => callback(undefined, data)).catch(callback));
true : false).then(data => {
if (this.expose_power_service) {
this.power_service.getCharacteristic(this.constructor.hap.Characteristic.On)
.updateValue(on === this.constructor.hap.Characteristic.Active.ACTIVE);
}
callback(undefined, data);
}).catch(callback));
tv_service.getCharacteristic(this.constructor.hap.Characteristic.ActiveIdentifier)
.on('get', callback => this.getInputIdentifier().then(data => callback(undefined, data)).catch(callback))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment