homebridge-denon-tv 3.22.0 → 3.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +10 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -860,7 +860,7 @@ class denonTvDevice {
860
860
  const writeNewCustomName = nameIdentifier ? await fsPromises.writeFile(this.inputsNamesFile, newCustomName) : false;
861
861
  const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'} name saved successful, name: ${name}, reference: ${inputReference}`);
862
862
  } catch (error) {
863
- this.log.error(`Device: ${this.host} ${accessoryName}, new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'} name saved failed, Error: ${error}`);
863
+ this.log.error(`Device: ${this.host} ${accessoryName}, new Input name saved failed, error: ${error}`);
864
864
  }
865
865
  });
866
866
 
@@ -873,10 +873,10 @@ class denonTvDevice {
873
873
  const newTargetVisibility = JSON.stringify(savedInputsTargetVisibility, null, 2);
874
874
 
875
875
  const writeNewTargetVisibility = targetVisibilityIdentifier ? await fsPromises.writeFile(this.inputsTargetVisibilityFile, newTargetVisibility) : false;
876
- const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'}, Target Visibility saved successful, name: ${name}, state: ${state ? 'HIDEN' : 'SHOWN'}`);
876
+ const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'}: ${inputName}, saved target visibility state: ${state ? 'HIDEN' : 'SHOWN'}`);
877
877
  inputService.setCharacteristic(Characteristic.CurrentVisibilityState, state);
878
878
  } catch (error) {
879
- this.log.error(`Device: ${this.host} ${accessoryName}, saved ${zoneControl <= 2 ? 'Input' : 'Sound Mode'} Target Visibility state error: ${error}`);
879
+ this.log.error(`Device: ${this.host} ${accessoryName}, saved target visibility state error: ${error}`);
880
880
  }
881
881
  });
882
882
 
@@ -892,14 +892,14 @@ class denonTvDevice {
892
892
  };
893
893
 
894
894
  //prepare inputs switch button ervices
895
+ this.inputSwitchButtonServices = [];
895
896
  const inputsSwitchesButtons = this.inputsSwitchesButtons;
896
897
  const inputsSwitchesButtonsCount = inputsSwitchesButtons.length;
897
- const availableInputsSwitchesButtonsCount = 80 - maxInputsCount;
898
+ const availableInputsSwitchesButtonsCount = 80 - this.inputsReference.length;
898
899
  const maxInputsSwitchesButtonsCount = availableInputsSwitchesButtonsCount > 0 ? (availableInputsSwitchesButtonsCount > inputsSwitchesButtonsCount ? inputsSwitchesButtonsCount : availableInputsSwitchesButtonsCount) : 0;
899
900
  if (!this.getInputsFromDevice) {
900
901
  if (maxInputsSwitchesButtonsCount > 0) {
901
902
  this.log.debug('prepareSwitchsService');
902
- this.inputSwitchButtonServices = [];
903
903
  for (let i = 0; i < maxInputsSwitchesButtonsCount; i++) {
904
904
  //get input index
905
905
  const index = inputsSwitchesButtons[i];
@@ -930,7 +930,7 @@ class denonTvDevice {
930
930
  const reference = zone + inputReference;
931
931
 
932
932
  const setSwitchInput = (state && this.power) ? await this.denon.send(CONSTANS.ApiUrls.iPhoneDirect + reference) : false;
933
- const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'}, Input successful, name: ${name}, reference: ${inputReference}`);
933
+ const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, set new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'} successful, name: ${inputName}, reference: ${inputReference}`);
934
934
  } catch (error) {
935
935
  this.log.error(`Device: ${this.host} ${accessoryName}, can not set new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'}. Might be due to a wrong settings in config, error: ${error}`);
936
936
  };
@@ -943,14 +943,14 @@ class denonTvDevice {
943
943
  };
944
944
 
945
945
  //prepare sonsor services
946
+ this.sensorInputsServices = [];
946
947
  const sensorInputs = this.sensorInputs;
947
948
  const sensorInputsCount = sensorInputs.length;
948
- const availableSensorInputsCount = 80 - maxInputsCount;
949
+ const availableSensorInputsCount = 80 - this.inputsReference.length;
949
950
  const maxSensorInputsCount = availableSensorInputsCount > 0 ? (availableSensorInputsCount > sensorInputsCount ? sensorInputsCount : availableSensorInputsCount) : 0;
950
951
  if (this.getInputsFromDevice) {
951
952
  if (maxSensorInputsCount > 0) {
952
953
  this.log.debug('prepareInputSensorServices');
953
- this.sensorInputsServices = [];
954
954
  for (let i = 0; i < maxSensorInputsCount; i++) {
955
955
  //get sensor
956
956
  const sensorInput = sensorInputs[i];
@@ -988,7 +988,7 @@ class denonTvDevice {
988
988
  //check available buttons and possible count (max 80)
989
989
  const buttons = this.buttons;
990
990
  const buttonsCount = buttons.length;
991
- const maxbuttonsCount = this.getInputsFromDevice ? this.sensorInputsServices : this.inputSwitchButtonServices;
991
+ const maxbuttonsCount = this.getInputsFromDevice ? this.inputsReference.length + this.sensorInputsServices.length : this.inputsReference.length + this.inputSwitchButtonServices.length;
992
992
  const availableButtonsCount = 80 - (maxInputsCount + maxbuttonsCount);
993
993
  const maxButtonsCount = availableButtonsCount > 0 ? (availableButtonsCount > buttonsCount ? buttonsCount : availableButtonsCount) : 0;
994
994
  if (maxButtonsCount > 0) {
@@ -1014,7 +1014,7 @@ class denonTvDevice {
1014
1014
  .onSet(async (state) => {
1015
1015
  try {
1016
1016
  const setFunction = (state && this.power) ? await this.denon.send(CONSTANS.ApiUrls.iPhoneDirect + buttonReference) : false;
1017
- const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, set new Input successful, name: ${name}, reference: ${buttonReference}`);
1017
+ const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, set Input successful, name: ${buttonName}, reference: ${buttonReference}`);
1018
1018
 
1019
1019
  await new Promise(resolve => setTimeout(resolve, 300));
1020
1020
  const setChar = (state && this.power) ? buttonService.updateCharacteristic(Characteristic.On, false) : false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Denon TV",
3
3
  "name": "homebridge-denon-tv",
4
- "version": "3.22.0",
4
+ "version": "3.22.2",
5
5
  "description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Denon/Marantz AV Receivers.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",