Commit 455f778f authored by Samuel Elliott's avatar Samuel Elliott

Add incrementing/decrementing volume

parent c89148ea
......@@ -807,8 +807,21 @@ class TVAccessory {
speaker_service.setCharacteristic(this.constructor.hap.Characteristic.VolumeControlType,
this.constructor.hap.Characteristic.VolumeControlType.ABSOLUTE);
speaker_service.getCharacteristic(this.constructor.hap.Characteristic.VolumeSelector)
.on('set', (select, callback) => select === this.constructor.hap.Characteristic.VolumeSelector.INCREMENT ?
this.incrementVolume().then(data => callback(null, data)).catch(callback) :
this.decrementVolume().then(data => callback(null, data)).catch(callback));
return Object.defineProperty(this, 'tv_speaker_service', {configurable: true, value: speaker_service}).tv_speaker_service;
}
async incrementVolume() {
await this.remote.send('VOLUME_UP');
}
async decrementVolume() {
await this.remote.send('VOLUME_DOWN');
}
}
module.exports.TVPlatform = TVPlatform;
......
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