homebridge-xbox-tv 2.12.28 → 2.12.30
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/package.json +1 -1
- package/src/xboxdevice.js +11 -30
package/package.json
CHANGED
package/src/xboxdevice.js
CHANGED
|
@@ -458,7 +458,7 @@ class XboxDevice extends EventEmitter {
|
|
|
458
458
|
|
|
459
459
|
//Prepare television service
|
|
460
460
|
const debug1 = !this.enableDebugMode ? false : this.emit('debug', `Prepare television service`);
|
|
461
|
-
this.televisionService =
|
|
461
|
+
this.televisionService = accessory.addService(Service.Television, `${accessoryName} Television`, 'Television');
|
|
462
462
|
this.televisionService.setCharacteristic(Characteristic.ConfiguredName, accessoryName);
|
|
463
463
|
this.televisionService.setCharacteristic(Characteristic.SleepDiscoveryMode, 1);
|
|
464
464
|
|
|
@@ -673,13 +673,11 @@ class XboxDevice extends EventEmitter {
|
|
|
673
673
|
this.emit('error', `set Power Mode Selection error: ${error}`);
|
|
674
674
|
};
|
|
675
675
|
});
|
|
676
|
-
|
|
677
676
|
this.allServices.push(this.televisionService);
|
|
678
|
-
accessory.addService(this.televisionService);
|
|
679
677
|
|
|
680
678
|
//Prepare speaker service
|
|
681
679
|
const debug2 = !this.enableDebugMode ? false : this.emit('debug', `Prepare speaker service`);
|
|
682
|
-
this.speakerService =
|
|
680
|
+
this.speakerService = accessory.addService(Service.TelevisionSpeaker, `${accessoryName} Speaker`, 'Speaker');
|
|
683
681
|
this.speakerService.getCharacteristic(Characteristic.Active)
|
|
684
682
|
.onGet(async () => {
|
|
685
683
|
const state = this.power;
|
|
@@ -755,9 +753,7 @@ class XboxDevice extends EventEmitter {
|
|
|
755
753
|
this.emit('error', `set Mute error: ${error}`);
|
|
756
754
|
};
|
|
757
755
|
});
|
|
758
|
-
|
|
759
756
|
this.allServices.push(this.speakerService);
|
|
760
|
-
accessory.addService(this.speakerService);
|
|
761
757
|
|
|
762
758
|
//prepare inputs service
|
|
763
759
|
const debug3 = !this.enableDebugMode ? false : this.emit('debug', `Prepare inputs service`);
|
|
@@ -809,7 +805,7 @@ class XboxDevice extends EventEmitter {
|
|
|
809
805
|
input.identifier = inputIdentifier;
|
|
810
806
|
|
|
811
807
|
//input service
|
|
812
|
-
const inputService =
|
|
808
|
+
const inputService = accessory.addService(Service.InputSource, inputName, `Input ${inputIdentifier}`);
|
|
813
809
|
inputService
|
|
814
810
|
.setCharacteristic(Characteristic.Identifier, inputIdentifier)
|
|
815
811
|
.setCharacteristic(Characteristic.Name, inputName)
|
|
@@ -857,18 +853,16 @@ class XboxDevice extends EventEmitter {
|
|
|
857
853
|
this.emit('error', `save Target Visibility error: ${error}`);
|
|
858
854
|
}
|
|
859
855
|
});
|
|
860
|
-
|
|
861
856
|
this.inputsConfigured.push(input);
|
|
862
857
|
this.televisionService.addLinkedService(inputService);
|
|
863
858
|
this.allServices.push(inputService);
|
|
864
|
-
accessory.addService(inputService);
|
|
865
859
|
}
|
|
866
860
|
|
|
867
861
|
//Prepare volume service
|
|
868
862
|
if (this.volumeControl) {
|
|
869
863
|
const debug = !this.enableDebugMode ? false : this.emit('debug', `Prepare volume service`);
|
|
870
864
|
if (this.volumeControl === 1) {
|
|
871
|
-
this.volumeService =
|
|
865
|
+
this.volumeService = accessory.addService(Service.Lightbulb, `${accessoryName} Volume`, 'Volume');
|
|
872
866
|
this.volumeService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
873
867
|
this.volumeService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Volume`);
|
|
874
868
|
this.volumeService.getCharacteristic(Characteristic.Brightness)
|
|
@@ -889,11 +883,10 @@ class XboxDevice extends EventEmitter {
|
|
|
889
883
|
});
|
|
890
884
|
|
|
891
885
|
this.allServices.push(this.volumeService);
|
|
892
|
-
accessory.addService(this.volumeService);
|
|
893
886
|
}
|
|
894
887
|
|
|
895
888
|
if (this.volumeControl === 2) {
|
|
896
|
-
this.volumeServiceFan =
|
|
889
|
+
this.volumeServiceFan = accessory.addService(Service.Fan, `${accessoryName} Volume`, 'Volume');
|
|
897
890
|
this.volumeServiceFan.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
898
891
|
this.volumeServiceFan.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Volume`);
|
|
899
892
|
this.volumeServiceFan.getCharacteristic(Characteristic.RotationSpeed)
|
|
@@ -912,16 +905,14 @@ class XboxDevice extends EventEmitter {
|
|
|
912
905
|
.onSet(async (state) => {
|
|
913
906
|
this.speakerService.setCharacteristic(Characteristic.Mute, !state);
|
|
914
907
|
});
|
|
915
|
-
|
|
916
908
|
this.allServices.push(this.volumeServiceFan);
|
|
917
|
-
accessory.addService(this.volumeServiceFan);
|
|
918
909
|
}
|
|
919
910
|
}
|
|
920
911
|
|
|
921
912
|
//prepare sensor service
|
|
922
913
|
if (this.sensorPower) {
|
|
923
914
|
const debug = !this.enableDebugMode ? false : this.emit('debug', `Prepare power sensor service`);
|
|
924
|
-
this.sensorPowerService =
|
|
915
|
+
this.sensorPowerService = accessory.addService(Service.ContactSensor, `${accessoryName} Power Sensor`, `Power Sensor`);
|
|
925
916
|
this.sensorPowerService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
926
917
|
this.sensorPowerService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Power Sensor`);
|
|
927
918
|
this.sensorPowerService.getCharacteristic(Characteristic.ContactSensorState)
|
|
@@ -929,14 +920,12 @@ class XboxDevice extends EventEmitter {
|
|
|
929
920
|
const state = this.power;
|
|
930
921
|
return state;
|
|
931
922
|
});
|
|
932
|
-
|
|
933
923
|
this.allServices.push(this.sensorPowerService);
|
|
934
|
-
accessory.addService(this.sensorPowerService);
|
|
935
924
|
};
|
|
936
925
|
|
|
937
926
|
if (this.sensorInput) {
|
|
938
927
|
const debug = !this.enableDebugMode ? false : this.emit('debug', `Prepare input sensor service`);
|
|
939
|
-
this.sensorInputService =
|
|
928
|
+
this.sensorInputService = accessory.addService(Service.ContactSensor, `${accessoryName} Input Sensor`, `Input Sensor`);
|
|
940
929
|
this.sensorInputService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
941
930
|
this.sensorInputService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Input Sensor`);
|
|
942
931
|
this.sensorInputService.getCharacteristic(Characteristic.ContactSensorState)
|
|
@@ -944,14 +933,12 @@ class XboxDevice extends EventEmitter {
|
|
|
944
933
|
const state = this.power ? this.sensorInputState : false;
|
|
945
934
|
return state;
|
|
946
935
|
});
|
|
947
|
-
|
|
948
936
|
this.allServices.push(this.sensorInputService);
|
|
949
|
-
accessory.addService(this.sensorInputService);
|
|
950
937
|
};
|
|
951
938
|
|
|
952
939
|
if (this.sensorScreenSaver) {
|
|
953
940
|
const debug = !this.enableDebugMode ? false : this.emit('debug', `Prepare screen saver sensor service`);
|
|
954
|
-
this.sensorScreenSaverService =
|
|
941
|
+
this.sensorScreenSaverService = accessory.addService(Service.ContactSensor, `${accessoryName} Screen Saver Sensor`, `Screen Saver Sensor`);
|
|
955
942
|
this.sensorScreenSaverService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
956
943
|
this.sensorScreenSaverService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Screen Saver Sensor`);
|
|
957
944
|
this.sensorScreenSaverService.getCharacteristic(Characteristic.ContactSensorState)
|
|
@@ -959,9 +946,7 @@ class XboxDevice extends EventEmitter {
|
|
|
959
946
|
const state = this.power ? this.sensorScreenSaverState : false;
|
|
960
947
|
return state;
|
|
961
948
|
});
|
|
962
|
-
|
|
963
949
|
this.allServices.push(this.sensorScreenSaverService);
|
|
964
|
-
accessory.addService(this.sensorScreenSaverService);
|
|
965
950
|
};
|
|
966
951
|
|
|
967
952
|
//prepare sonsor service
|
|
@@ -990,9 +975,9 @@ class XboxDevice extends EventEmitter {
|
|
|
990
975
|
if (sensorInputDisplayType) {
|
|
991
976
|
if (sensorInputName && sensorInputReference) {
|
|
992
977
|
const serviceName = namePrefix ? `${accessoryName} ${sensorInputName}` : sensorInputName;
|
|
993
|
-
const serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensorInputDisplayType];
|
|
994
978
|
const characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensorInputDisplayType];
|
|
995
|
-
const
|
|
979
|
+
const serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensorInputDisplayType];
|
|
980
|
+
const sensorInputService = accessory.addService(serviceType, serviceName, `Sensor ${i}`);
|
|
996
981
|
sensorInputService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
997
982
|
sensorInputService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
|
|
998
983
|
sensorInputService.getCharacteristic(characteristicType)
|
|
@@ -1000,11 +985,9 @@ class XboxDevice extends EventEmitter {
|
|
|
1000
985
|
const state = this.power ? (this.reference === sensorInputReference) : false;
|
|
1001
986
|
return state;
|
|
1002
987
|
});
|
|
1003
|
-
|
|
1004
988
|
this.sensorsInputsConfigured.push(sensorInput);
|
|
1005
989
|
this.sensorsInputsServices.push(sensorInputService);
|
|
1006
990
|
this.allServices.push(sensorInputService);
|
|
1007
|
-
accessory.addService(this.sensorsInputsServices[i]);
|
|
1008
991
|
} else {
|
|
1009
992
|
this.emit('message', `Sensor Name: ${sensorInputName ? sensorInputName : 'Missing'}, Reference: ${sensorInputReference ? sensorInputReference : 'Missing'}.`);
|
|
1010
993
|
};
|
|
@@ -1059,7 +1042,7 @@ class XboxDevice extends EventEmitter {
|
|
|
1059
1042
|
if (buttonName && buttonCommand && buttonMode >= 0) {
|
|
1060
1043
|
const serviceName = namePrefix ? `${accessoryName} ${buttonName}` : buttonName;
|
|
1061
1044
|
const serviceType = ['', Service.Outlet, Service.Switch][buttonDisplayType];
|
|
1062
|
-
const buttonService =
|
|
1045
|
+
const buttonService = accessory.addService(serviceType, serviceName, `Button ${i}`);
|
|
1063
1046
|
buttonService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1064
1047
|
buttonService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
|
|
1065
1048
|
buttonService.getCharacteristic(Characteristic.On)
|
|
@@ -1126,11 +1109,9 @@ class XboxDevice extends EventEmitter {
|
|
|
1126
1109
|
buttonService.updateCharacteristic(Characteristic.On, false);
|
|
1127
1110
|
}
|
|
1128
1111
|
});
|
|
1129
|
-
|
|
1130
1112
|
this.buttonsConfigured.push(button);
|
|
1131
1113
|
this.buttonsServices.push(buttonService);
|
|
1132
1114
|
this.allServices.push(buttonService);
|
|
1133
|
-
accessory.addService(this.buttonsServices[i]);
|
|
1134
1115
|
} else {
|
|
1135
1116
|
this.emit('message', `Button Name: ${buttonName ? buttonName : 'Missing'}, Command: ${buttonCommand ? buttonCommand : 'Missing'}, Mode: ${buttonMode ? buttonMode : 'Missing'}.`);
|
|
1136
1117
|
};
|