diff --git a/src/services/rendering-control.service.extension.ts b/src/services/rendering-control.service.extension.ts index 769c61d..68e2554 100644 --- a/src/services/rendering-control.service.extension.ts +++ b/src/services/rendering-control.service.extension.ts @@ -21,4 +21,48 @@ export class RenderingControlService extends RenderingControlServiceBase { } return super.ResolveEventPropertyValue(name, originalValue, type); } + + /** + * Get nightmode status of playbar. + * + * @returns {Promise} + * @memberof RenderingControlService + */ + public async GetNightMode(): Promise { + return (await this.GetEQ({ InstanceID: 0, EQType: 'NightMode' })).CurrentValue === 1; + } + + /** + * Turn on/off night mode, on your playbar. + * shortcut to .RenderingControlService.SetEQ({ InstanceID: 0, EQType: 'NightMode', DesiredValue: dialogLevel === true ? 1 : 0 }) + * + * @param {boolean} nightmode + * @returns {Promise} + * @memberof RenderingControlService + */ + public SetNightMode(nightmode: boolean): Promise { + return this.SetEQ({ InstanceID: 0, EQType: 'NightMode', DesiredValue: nightmode === true ? 1 : 0 }); + } + + /** + * Get Speech Enhancement status of playbar + * + * @returns {Promise} + * @memberof RenderingControlService + */ + public async GetSpeechEnhancement(): Promise { + return (await this.GetEQ({ InstanceID: 0, EQType: 'DialogLevel' })).CurrentValue === 1; + } + + /** + * Turn on/off speech enhancement, on your playbar, + * shortcut to .RenderingControlService.SetEQ({ InstanceID: 0, EQType: 'DialogLevel', DesiredValue: dialogLevel === true ? 1 : 0 }) + * + * @param {boolean} dialogLevel + * @returns {Promise} + * @memberof RenderingControlService + */ + public SetSpeechEnhancement(dialogLevel: boolean): Promise { + return this.SetEQ({ InstanceID: 0, EQType: 'DialogLevel', DesiredValue: dialogLevel === true ? 1 : 0 }); + } } diff --git a/src/sonos-device.ts b/src/sonos-device.ts index b13b36b..2b25ba3 100644 --- a/src/sonos-device.ts +++ b/src/sonos-device.ts @@ -1131,8 +1131,8 @@ export default class SonosDevice extends SonosDeviceBase { * @returns {Promise} * @memberof SonosDevice */ - public async GetNightMode(): Promise { - return (await this.RenderingControlService.GetEQ({ InstanceID: 0, EQType: 'NightMode' })).CurrentValue === 1; + public GetNightMode(): Promise { + return this.RenderingControlService.GetNightMode(); } /** @@ -1165,8 +1165,8 @@ export default class SonosDevice extends SonosDeviceBase { * @returns {Promise} * @memberof SonosDevice */ - public async GetSpeechEnhancement(): Promise { - return (await this.RenderingControlService.GetEQ({ InstanceID: 0, EQType: 'DialogLevel' })).CurrentValue === 1; + public GetSpeechEnhancement(): Promise { + return this.RenderingControlService.GetSpeechEnhancement(); } /** @@ -1254,9 +1254,8 @@ export default class SonosDevice extends SonosDeviceBase { * @returns {Promise} * @memberof SonosDevice */ - public async SetNightMode(nightmode: boolean): Promise { - return await this.RenderingControlService - .SetEQ({ InstanceID: 0, EQType: 'NightMode', DesiredValue: nightmode === true ? 1 : 0 }); + public SetNightMode(nightmode: boolean): Promise { + return this.RenderingControlService.SetNightMode(nightmode); } /** @@ -1319,9 +1318,8 @@ export default class SonosDevice extends SonosDeviceBase { * @returns {Promise} * @memberof SonosDevice */ - public async SetSpeechEnhancement(dialogLevel: boolean): Promise { - return await this.RenderingControlService - .SetEQ({ InstanceID: 0, EQType: 'DialogLevel', DesiredValue: dialogLevel === true ? 1 : 0 }); + public SetSpeechEnhancement(dialogLevel: boolean): Promise { + return this.RenderingControlService.SetSpeechEnhancement(dialogLevel); } /**