Skip to content

Commit

Permalink
[2.8.4] minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Martvvliet committed Jun 21, 2020
1 parent 8c84bcf commit 494a376
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
42 changes: 18 additions & 24 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const discover = require('./lib/discover');

const pluginName = 'homebridge-denon-heos';
const platformName = 'DenonAVR';
const pluginVersion = '2.8.3';
const pluginVersion = '2.8.4';

const defaultPollingInterval = 3;
const infoRetDelay = 250;
const defaultTrace = true;
const defaultTrace = false;
const autoDiscoverTime = 3000;
const setAVRState = false;
/* Setup settings button and info button */
Expand Down Expand Up @@ -1259,12 +1259,16 @@ class tvClient {

switch (remoteKey) {
case Characteristic.RemoteKey.REWIND:
ctrlString = 'MN9E';
break;
case Characteristic.RemoteKey.FAST_FORWARD:
ctrlString = 'MN9D';
break;
case Characteristic.RemoteKey.NEXT_TRACK:
ctrlString = 'MN9F';
break;
case Characteristic.RemoteKey.PREVIOUS_TRACK:
ctrlString = 'MN9G';
break;
case Characteristic.RemoteKey.ARROW_UP:
ctrlString = 'MNCUP';
Expand All @@ -1285,8 +1289,10 @@ class tvClient {
ctrlString = 'MNRTN';
break;
case Characteristic.RemoteKey.EXIT:
ctrlString = 'MNRTN';
break;
case Characteristic.RemoteKey.PLAY_PAUSE:
ctrlString = 'NS94';
break;
case Characteristic.RemoteKey.INFORMATION:
ctrlString = this.infoButton;
Expand Down Expand Up @@ -1363,11 +1369,6 @@ class legacyClient {

this.accessory.reachable = true;

this.accessory.context.subtype = 'legacyInput';
this.accessory.context.name = this.name;
this.accessory.context.ip = this.ip;
this.accessory.context.inputID = this.inputID;
this.accessory.context.pollAllInput = this.pollAllInput;

let isCached = this.testCachedAccessories();
if (!isCached) {
Expand All @@ -1393,6 +1394,7 @@ class legacyClient {
g_log.error("ERROR: Could not register switch with name: %s", this.accessory.context.name);
}
} else {
g_log("Configured switch found: " + this.name);
this.accessory
.getService(Service.Switch)
.getCharacteristic(Characteristic.On)
Expand Down Expand Up @@ -1658,12 +1660,10 @@ class legacyClient {

testCachedAccessories() {
for (let i in cachedAccessories) {
if (cachedAccessories[i].context.subtype == 'legacyInput') {
if (this.uuid == cachedAccessories[i].UUID) {
this.accessory = cachedAccessories[i];
cachedAccessories.splice(i,1);
return true;
}
if (this.uuid == cachedAccessories[i].UUID) {
this.accessory = cachedAccessories[i];
cachedAccessories.splice(i,1);
return true;
}
}
return false;
Expand Down Expand Up @@ -1724,11 +1724,6 @@ class volumeClient {

this.accessory.reachable = true;

this.accessory.context.subtype = 'volumeInput';
this.accessory.context.name = this.name;
this.accessory.context.ip = this.ip;
this.accessory.context.volumeLimit = this.volumeLimit;

let isCached = this.testCachedAccessories();
if (!isCached) {
g_log("New volumeControl configured: " + this.name);
Expand Down Expand Up @@ -1769,6 +1764,7 @@ class volumeClient {
g_log.error("ERROR: Could not register volume control with name: %s", this.accessory.context.name);
}
} else {
g_log("Configured volumeControl found: " + this.name);
if (this.volumeAsFan){
this.accessory
.getService(Service.Fanv2)
Expand Down Expand Up @@ -1973,12 +1969,10 @@ class volumeClient {

testCachedAccessories() {
for (let i in cachedAccessories) {
if (cachedAccessories[i].context.subtype == 'volumeInput') {
if (this.uuid == cachedAccessories[i].UUID) {
this.accessory = cachedAccessories[i];
cachedAccessories.splice(i,1);
return true;
}
if (this.uuid == cachedAccessories[i].UUID) {
this.accessory = cachedAccessories[i];
cachedAccessories.splice(i,1);
return true;
}
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-denon-heos",
"version": "2.8.3",
"version": "2.8.4",
"description": "Denon and possibly Marantz (some are tested with positive results) AVR support for Homebridge: https://github.com/nfarina/homebridge with support for newer version of receiver. This plugin uses the http commands to control the receivers. It is also possible to add a receiver as a tv to your homekit. This way, you can control the receiver with the remote. Set the volume with the remote and change the input, all in one block.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 494a376

Please sign in to comment.