homebridge-denon-tv 3.25.0 → 3.25.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 +14 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -886,33 +886,39 @@ class denonTvDevice {
886
886
  const inputService = new Service.InputSource(inputName, service + i);
887
887
  inputService
888
888
  .setCharacteristic(Characteristic.Identifier, i)
889
- .setCharacteristic(Characteristic.ConfiguredName, inputName)
890
889
  .setCharacteristic(Characteristic.IsConfigured, isConfigured)
891
890
  .setCharacteristic(Characteristic.InputSourceType, inputType)
892
891
  .setCharacteristic(Characteristic.CurrentVisibilityState, currentVisibility)
893
- .setCharacteristic(Characteristic.TargetVisibilityState, targetVisibility);
894
892
 
895
893
  inputService.getCharacteristic(Characteristic.ConfiguredName)
894
+ .onGet(async () => {
895
+ const value = inputName;
896
+ return value;
897
+ })
896
898
  .onSet(async (name) => {
897
899
  try {
898
900
  savedInputsNames[inputReference] = name;
899
901
  const newCustomName = JSON.stringify(savedInputsNames, null, 2);
900
902
 
901
- fs.writeFileSync(this.inputsNamesFile, newCustomName);
902
- const logInfo = this.debugLog ? false : this.log(`Device: ${this.host} ${accessoryName}, saved new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'} name: ${name}, reference: ${inputReference}`);
903
+ await fsPromises.writeFile(this.inputsNamesFile, newCustomName);
904
+ const logDebug = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, saved new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'} name: ${name}, reference: ${inputReference}`) : false;
903
905
  } catch (error) {
904
906
  this.log.error(`Device: ${this.host} ${accessoryName}, new Input name save error: ${error}`);
905
907
  }
906
908
  });
907
909
 
908
910
  inputService.getCharacteristic(Characteristic.TargetVisibilityState)
911
+ .onGet(async () => {
912
+ const state = targetVisibility;
913
+ return state;
914
+ })
909
915
  .onSet(async (state) => {
910
916
  try {
911
917
  savedInputsTargetVisibility[inputReference] = state;
912
918
  const newTargetVisibility = JSON.stringify(savedInputsTargetVisibility, null, 2);
913
919
 
914
- fs.writeFileSync(this.inputsTargetVisibilityFile, newTargetVisibility);
915
- const logInfo = this.debugLog ? false : this.log(`Device: ${this.host} ${accessoryName}, saved new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'}: ${inputName}, target visibility state: ${state ? 'HIDEN' : 'SHOWN'}`);
920
+ await fsPromises.writeFile(this.inputsTargetVisibilityFile, newTargetVisibility);
921
+ const logDebug = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, saved new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'}: ${inputName}, target visibility state: ${state ? 'HIDEN' : 'SHOWN'}`) : false;
916
922
  inputService.setCharacteristic(Characteristic.CurrentVisibilityState, state);
917
923
  } catch (error) {
918
924
  this.log.error(`Device: ${this.host} ${accessoryName}, new target visibility state save error: ${error}`);
@@ -969,7 +975,7 @@ class denonTvDevice {
969
975
  const reference = zone + inputReference;
970
976
 
971
977
  const setSwitchInput = state && this.power ? await this.denon.send(CONSTANS.ApiUrls.iPhoneDirect + reference) : false;
972
- const logInfo = this.debugLog ? false : this.log(`Device: ${this.host} ${accessoryName}, set new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'} successful, name: ${inputName}, reference: ${inputReference}`);
978
+ const logDebug = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, set new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'} successful, name: ${inputName}, reference: ${inputReference}`) : false;
973
979
  } catch (error) {
974
980
  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}`);
975
981
  };
@@ -1057,7 +1063,7 @@ class denonTvDevice {
1057
1063
  .onSet(async (state) => {
1058
1064
  try {
1059
1065
  const setFunction = state && this.power ? await this.denon.send(CONSTANS.ApiUrls.iPhoneDirect + buttonReference) : false;
1060
- const logInfo = this.debugLog ? false : this.log(`Device: ${this.host} ${accessoryName}, set Input successful, name: ${buttonName}, reference: ${buttonReference}`);
1066
+ const logDebug = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, set Input successful, name: ${buttonName}, reference: ${buttonReference}`) : false;
1061
1067
 
1062
1068
  await new Promise(resolve => setTimeout(resolve, 300));
1063
1069
  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.25.0",
4
+ "version": "3.25.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",