Skip to content

Commit

Permalink
v5.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
seydx committed Sep 20, 2021
1 parent 4259e2e commit d80778b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 12 deletions.
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

# v5.0.3 - 2021-09-20

## Other Changes
- Refactored `volume selector`: IRCC instead of API calls

## Bugfixes
- Minor Bugfixes

# v5.0.2 - 2021-09-20

## Other Changes
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-bravia-tvos",
"version": "5.0.2",
"version": "5.0.3",
"description": "Homebridge plugin for Sony Bravia Android TVs",
"main": "index.js",
"repository": {
Expand Down Expand Up @@ -50,7 +50,7 @@
},
"dependencies": {
"@homebridge/plugin-ui-utils": "^0.0.19",
"@seydx/bravia": "^2.0.0-beta.12",
"@seydx/bravia": "^2.0.0-beta.14",
"fs-extra": "^10.0.0"
},
"devDependencies": {
Expand Down
43 changes: 37 additions & 6 deletions src/accessories/accessory.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,9 @@ class Handler {
}

const target =
this.accessory.context.config.speaker.output === 'other'
? 'speaker'
: this.accessory.context.config.speaker.output;
this.accessory.context.config.speaker.output === 'other' ? '' : this.accessory.context.config.speaker.output;

logger.info(`Volume: ${state} (${target})`);
logger.info(`Volume: ${state} (${this.accessory.context.config.speaker.output})`);

this.accessory.context.busy = true;

Expand Down Expand Up @@ -481,26 +479,59 @@ class Handler {
return;
}

// Volume Control through IRCC

const target =
this.accessory.context.config.speaker.output === 'other'
? 'speaker'
: this.accessory.context.config.speaker.output;

const volumeLevel = state
? `-${this.accessory.context.config.speaker.reduceBy}`
: `+${this.accessory.context.config.speaker.increaseBy}`;
? this.accessory.context.config.speaker.reduceBy
: this.accessory.context.config.speaker.increaseBy;

const volumeCommand = state
? this.accessory.context.config.remote.VOLUME_DOWN
: this.accessory.context.config.remote.VOLUME_UP;

const irccCommands = [];

for (let i = 0; i < volumeLevel; i++) {
irccCommands.push(volumeCommand);
}

logger.info(
`${state ? 'Reducing' : 'Increasing'} volume by ${volumeLevel} (${target})`,
this.accessory.displayName
);

logger.debug(`Execute Command: ${volumeCommand}`, this.accessory.displayName);

this.accessory.context.busy = true;

await this.bravia.execCommand(irccCommands);

/*
//Volume control through API
const target =
this.accessory.context.config.speaker.output === 'other'
? 'speaker'
: this.accessory.context.config.speaker.output;
const volumeLevel = state
? `-${this.accessory.context.config.speaker.reduceBy}`
: `+${this.accessory.context.config.speaker.increaseBy}`;
this.accessory.context.busy = true;
await this.bravia.exec('audio', 'setAudioVolume', '1.0', {
target: '',
volume: volumeLevel,
});
*/
} catch (err) {
logger.warn('An error occured during setting volume (selector)!', this.accessory.displayName);
logger.error(err, this.accessory.displayName);
Expand Down

0 comments on commit d80778b

Please sign in to comment.