homebridge-denon-tv 3.23.1 → 3.23.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.
- package/index.js +32 -30
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -931,39 +931,41 @@ class denonTvDevice {
|
|
|
931
931
|
const index = inputsSwitchesButtons[i];
|
|
932
932
|
|
|
933
933
|
//get name
|
|
934
|
-
const inputName = this.inputsName[index];
|
|
934
|
+
const inputName = this.inputsName[index] || 'Not set';
|
|
935
935
|
|
|
936
936
|
//get reference
|
|
937
|
-
const inputReference = this.inputsReference[index];
|
|
937
|
+
const inputReference = this.inputsReference[index] || 'Not set';
|
|
938
938
|
|
|
939
939
|
//get mode
|
|
940
940
|
const inputMode = (zoneControl <= 2) ? this.inputsMode[index] : 'MS';
|
|
941
941
|
|
|
942
942
|
//get display type
|
|
943
|
-
const inputDisplayType = this.inputsDisplayType[index];
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
.
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
943
|
+
const inputDisplayType = this.inputsDisplayType[index] || -1;
|
|
944
|
+
|
|
945
|
+
if (inputDisplayType >= 0) {
|
|
946
|
+
const serviceType = [Service.Outlet, Service.Switch][inputDisplayType];
|
|
947
|
+
const characteristicType = [Characteristic.On, Characteristic.On][inputDisplayType];
|
|
948
|
+
const inputSwitchButtonService = new serviceType(`${this.sZoneName} ${inputName}`, `Switch ${i}`);
|
|
949
|
+
inputSwitchButtonService.getCharacteristic(characteristicType)
|
|
950
|
+
.onGet(async () => {
|
|
951
|
+
const state = this.power ? (this.reference === inputReference) : false;
|
|
952
|
+
return state;
|
|
953
|
+
})
|
|
954
|
+
.onSet(async (state) => {
|
|
955
|
+
try {
|
|
956
|
+
const zone = [inputMode, 'Z2', 'Z3', inputMode][zoneControl];
|
|
957
|
+
const reference = zone + inputReference;
|
|
958
|
+
|
|
959
|
+
const setSwitchInput = (state && this.power) ? await this.denon.send(CONSTANS.ApiUrls.iPhoneDirect + reference) : false;
|
|
960
|
+
const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, set new ${zoneControl <= 2 ? 'Input' : 'Sound Mode'} successful, name: ${inputName}, reference: ${inputReference}`);
|
|
961
|
+
} catch (error) {
|
|
962
|
+
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}`);
|
|
963
|
+
};
|
|
964
|
+
});
|
|
965
|
+
|
|
966
|
+
this.inputSwitchButtonServices.push(inputSwitchButtonService);
|
|
967
|
+
accessory.addService(this.inputSwitchButtonServices[i]);
|
|
968
|
+
}
|
|
967
969
|
}
|
|
968
970
|
};
|
|
969
971
|
};
|
|
@@ -982,10 +984,10 @@ class denonTvDevice {
|
|
|
982
984
|
const sensorInput = sensorInputs[i];
|
|
983
985
|
|
|
984
986
|
//get name
|
|
985
|
-
const sensorInputName = sensorInput.name || 'Not set
|
|
987
|
+
const sensorInputName = sensorInput.name || 'Not set';
|
|
986
988
|
|
|
987
989
|
//get reference
|
|
988
|
-
const sensorInputReference = sensorInput.reference || 'Not set
|
|
990
|
+
const sensorInputReference = sensorInput.reference || 'Not set';
|
|
989
991
|
|
|
990
992
|
//get display type
|
|
991
993
|
const sensorInputDisplayType = sensorInput.displayType || -1;
|
|
@@ -1021,10 +1023,10 @@ class denonTvDevice {
|
|
|
1021
1023
|
this.log.debug('prepareButtonsService');
|
|
1022
1024
|
for (const button of buttons) {
|
|
1023
1025
|
//get button name
|
|
1024
|
-
const buttonName = button.name || 'Not set
|
|
1026
|
+
const buttonName = button.name || 'Not set';
|
|
1025
1027
|
|
|
1026
1028
|
//get button reference
|
|
1027
|
-
const buttonReference = button.reference || 'Not set
|
|
1029
|
+
const buttonReference = button.reference || 'Not set'
|
|
1028
1030
|
|
|
1029
1031
|
//get button display type
|
|
1030
1032
|
const buttonDisplayType = button.displayType || -1;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Denon TV",
|
|
3
3
|
"name": "homebridge-denon-tv",
|
|
4
|
-
"version": "3.23.
|
|
4
|
+
"version": "3.23.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",
|