@zwave-js/cc 13.10.1 → 14.0.0-beta.0
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/build/cc/AlarmSensorCC.d.ts +31 -20
- package/build/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/cc/AlarmSensorCC.js +106 -87
- package/build/cc/AlarmSensorCC.js.map +1 -1
- package/build/cc/AssociationCC.d.ts +38 -32
- package/build/cc/AssociationCC.d.ts.map +1 -1
- package/build/cc/AssociationCC.js +193 -176
- package/build/cc/AssociationCC.js.map +1 -1
- package/build/cc/AssociationGroupInfoCC.d.ts +42 -36
- package/build/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/cc/AssociationGroupInfoCC.js +218 -200
- package/build/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/cc/BarrierOperatorCC.d.ts +41 -24
- package/build/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/cc/BarrierOperatorCC.js +143 -109
- package/build/cc/BarrierOperatorCC.js.map +1 -1
- package/build/cc/BasicCC.d.ts +22 -23
- package/build/cc/BasicCC.d.ts.map +1 -1
- package/build/cc/BasicCC.js +83 -77
- package/build/cc/BasicCC.js.map +1 -1
- package/build/cc/BatteryCC.d.ts +22 -14
- package/build/cc/BatteryCC.d.ts.map +1 -1
- package/build/cc/BatteryCC.js +116 -87
- package/build/cc/BatteryCC.js.map +1 -1
- package/build/cc/BinarySensorCC.d.ts +22 -19
- package/build/cc/BinarySensorCC.d.ts.map +1 -1
- package/build/cc/BinarySensorCC.js +103 -93
- package/build/cc/BinarySensorCC.js.map +1 -1
- package/build/cc/BinarySwitchCC.d.ts +20 -20
- package/build/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/cc/BinarySwitchCC.js +71 -59
- package/build/cc/BinarySwitchCC.js.map +1 -1
- package/build/cc/CRC16CC.d.ts +9 -9
- package/build/cc/CRC16CC.d.ts.map +1 -1
- package/build/cc/CRC16CC.js +36 -36
- package/build/cc/CRC16CC.js.map +1 -1
- package/build/cc/CentralSceneCC.d.ts +34 -16
- package/build/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/cc/CentralSceneCC.js +116 -79
- package/build/cc/CentralSceneCC.js.map +1 -1
- package/build/cc/ClimateControlScheduleCC.d.ts +38 -21
- package/build/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/cc/ClimateControlScheduleCC.js +113 -81
- package/build/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/cc/ClockCC.d.ts +18 -11
- package/build/cc/ClockCC.d.ts.map +1 -1
- package/build/cc/ClockCC.js +57 -43
- package/build/cc/ClockCC.js.map +1 -1
- package/build/cc/ColorSwitchCC.d.ts +37 -33
- package/build/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/cc/ColorSwitchCC.js +216 -189
- package/build/cc/ColorSwitchCC.js.map +1 -1
- package/build/cc/ConfigurationCC.d.ts +89 -74
- package/build/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/cc/ConfigurationCC.js +541 -485
- package/build/cc/ConfigurationCC.js.map +1 -1
- package/build/cc/DeviceResetLocallyCC.d.ts +3 -3
- package/build/cc/DeviceResetLocallyCC.d.ts.map +1 -1
- package/build/cc/DeviceResetLocallyCC.js +14 -14
- package/build/cc/DeviceResetLocallyCC.js.map +1 -1
- package/build/cc/DoorLockCC.d.ts +66 -27
- package/build/cc/DoorLockCC.d.ts.map +1 -1
- package/build/cc/DoorLockCC.js +288 -197
- package/build/cc/DoorLockCC.js.map +1 -1
- package/build/cc/DoorLockLoggingCC.d.ts +23 -13
- package/build/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/cc/DoorLockLoggingCC.js +81 -63
- package/build/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/cc/EnergyProductionCC.d.ts +16 -14
- package/build/cc/EnergyProductionCC.d.ts.map +1 -1
- package/build/cc/EnergyProductionCC.js +58 -52
- package/build/cc/EnergyProductionCC.js.map +1 -1
- package/build/cc/EntryControlCC.d.ts +44 -18
- package/build/cc/EntryControlCC.d.ts.map +1 -1
- package/build/cc/EntryControlCC.js +163 -112
- package/build/cc/EntryControlCC.js.map +1 -1
- package/build/cc/FirmwareUpdateMetaDataCC.d.ts +69 -34
- package/build/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
- package/build/cc/FirmwareUpdateMetaDataCC.js +311 -245
- package/build/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/cc/HumidityControlModeCC.d.ts +24 -16
- package/build/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/cc/HumidityControlModeCC.js +80 -65
- package/build/cc/HumidityControlModeCC.js.map +1 -1
- package/build/cc/HumidityControlOperatingStateCC.d.ts +11 -7
- package/build/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/cc/HumidityControlOperatingStateCC.js +31 -22
- package/build/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/cc/HumidityControlSetpointCC.d.ts +68 -49
- package/build/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/cc/HumidityControlSetpointCC.js +203 -181
- package/build/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/cc/InclusionControllerCC.d.ts +13 -11
- package/build/cc/InclusionControllerCC.d.ts.map +1 -1
- package/build/cc/InclusionControllerCC.js +49 -42
- package/build/cc/InclusionControllerCC.js.map +1 -1
- package/build/cc/IndicatorCC.d.ts +46 -39
- package/build/cc/IndicatorCC.d.ts.map +1 -1
- package/build/cc/IndicatorCC.js +298 -277
- package/build/cc/IndicatorCC.js.map +1 -1
- package/build/cc/IrrigationCC.d.ts +127 -57
- package/build/cc/IrrigationCC.d.ts.map +1 -1
- package/build/cc/IrrigationCC.js +496 -352
- package/build/cc/IrrigationCC.js.map +1 -1
- package/build/cc/LanguageCC.d.ts +17 -11
- package/build/cc/LanguageCC.d.ts.map +1 -1
- package/build/cc/LanguageCC.js +54 -44
- package/build/cc/LanguageCC.js.map +1 -1
- package/build/cc/LockCC.d.ts +16 -11
- package/build/cc/LockCC.d.ts.map +1 -1
- package/build/cc/LockCC.js +48 -38
- package/build/cc/LockCC.js.map +1 -1
- package/build/cc/ManufacturerProprietaryCC.d.ts +12 -11
- package/build/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
- package/build/cc/ManufacturerProprietaryCC.js +45 -50
- package/build/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/cc/ManufacturerSpecificCC.d.ts +20 -13
- package/build/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/cc/ManufacturerSpecificCC.js +79 -63
- package/build/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/cc/MeterCC.d.ts +30 -26
- package/build/cc/MeterCC.d.ts.map +1 -1
- package/build/cc/MeterCC.js +236 -204
- package/build/cc/MeterCC.js.map +1 -1
- package/build/cc/MultiChannelAssociationCC.d.ts +31 -26
- package/build/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/cc/MultiChannelAssociationCC.js +177 -168
- package/build/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/cc/MultiChannelCC.d.ts +70 -49
- package/build/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/cc/MultiChannelCC.js +377 -318
- package/build/cc/MultiChannelCC.js.map +1 -1
- package/build/cc/MultiCommandCC.d.ts +9 -9
- package/build/cc/MultiCommandCC.d.ts.map +1 -1
- package/build/cc/MultiCommandCC.js +35 -36
- package/build/cc/MultiCommandCC.js.map +1 -1
- package/build/cc/MultilevelSensorCC.d.ts +38 -33
- package/build/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/cc/MultilevelSensorCC.js +172 -152
- package/build/cc/MultilevelSensorCC.js.map +1 -1
- package/build/cc/MultilevelSwitchCC.d.ts +29 -25
- package/build/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/cc/MultilevelSwitchCC.js +147 -127
- package/build/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/cc/NoOperationCC.d.ts +0 -8
- package/build/cc/NoOperationCC.d.ts.map +1 -1
- package/build/cc/NoOperationCC.js +2 -11
- package/build/cc/NoOperationCC.js.map +1 -1
- package/build/cc/NodeNamingCC.d.ts +27 -17
- package/build/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/cc/NodeNamingCC.js +86 -69
- package/build/cc/NodeNamingCC.js.map +1 -1
- package/build/cc/NotificationCC.d.ts +46 -43
- package/build/cc/NotificationCC.d.ts.map +1 -1
- package/build/cc/NotificationCC.js +317 -303
- package/build/cc/NotificationCC.js.map +1 -1
- package/build/cc/PowerlevelCC.d.ts +22 -18
- package/build/cc/PowerlevelCC.d.ts.map +1 -1
- package/build/cc/PowerlevelCC.js +125 -95
- package/build/cc/PowerlevelCC.js.map +1 -1
- package/build/cc/ProtectionCC.d.ts +49 -26
- package/build/cc/ProtectionCC.d.ts.map +1 -1
- package/build/cc/ProtectionCC.js +172 -126
- package/build/cc/ProtectionCC.js.map +1 -1
- package/build/cc/SceneActivationCC.d.ts +8 -7
- package/build/cc/SceneActivationCC.d.ts.map +1 -1
- package/build/cc/SceneActivationCC.js +28 -23
- package/build/cc/SceneActivationCC.js.map +1 -1
- package/build/cc/SceneActuatorConfigurationCC.d.ts +23 -15
- package/build/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/cc/SceneActuatorConfigurationCC.js +79 -62
- package/build/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/cc/SceneControllerConfigurationCC.d.ts +25 -17
- package/build/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/cc/SceneControllerConfigurationCC.js +92 -78
- package/build/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/cc/ScheduleEntryLockCC.d.ts +86 -72
- package/build/cc/ScheduleEntryLockCC.d.ts.map +1 -1
- package/build/cc/ScheduleEntryLockCC.js +607 -455
- package/build/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/cc/Security2CC.d.ts +78 -87
- package/build/cc/Security2CC.d.ts.map +1 -1
- package/build/cc/Security2CC.js +798 -765
- package/build/cc/Security2CC.js.map +1 -1
- package/build/cc/SecurityCC.d.ts +47 -42
- package/build/cc/SecurityCC.d.ts.map +1 -1
- package/build/cc/SecurityCC.js +240 -218
- package/build/cc/SecurityCC.js.map +1 -1
- package/build/cc/SoundSwitchCC.d.ts +36 -29
- package/build/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/cc/SoundSwitchCC.js +180 -157
- package/build/cc/SoundSwitchCC.js.map +1 -1
- package/build/cc/SupervisionCC.d.ts +17 -14
- package/build/cc/SupervisionCC.d.ts.map +1 -1
- package/build/cc/SupervisionCC.js +86 -66
- package/build/cc/SupervisionCC.js.map +1 -1
- package/build/cc/ThermostatFanModeCC.d.ts +25 -15
- package/build/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/cc/ThermostatFanModeCC.js +79 -60
- package/build/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/cc/ThermostatFanStateCC.d.ts +11 -7
- package/build/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/cc/ThermostatFanStateCC.js +31 -22
- package/build/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/cc/ThermostatModeCC.d.ts +24 -21
- package/build/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/cc/ThermostatModeCC.js +106 -90
- package/build/cc/ThermostatModeCC.js.map +1 -1
- package/build/cc/ThermostatOperatingStateCC.d.ts +11 -7
- package/build/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/cc/ThermostatOperatingStateCC.js +31 -22
- package/build/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/cc/ThermostatSetbackCC.d.ts +14 -13
- package/build/cc/ThermostatSetbackCC.d.ts.map +1 -1
- package/build/cc/ThermostatSetbackCC.js +64 -57
- package/build/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/cc/ThermostatSetpointCC.d.ts +38 -57
- package/build/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/cc/ThermostatSetpointCC.js +200 -264
- package/build/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/cc/TimeCC.d.ts +24 -20
- package/build/cc/TimeCC.d.ts.map +1 -1
- package/build/cc/TimeCC.js +119 -108
- package/build/cc/TimeCC.js.map +1 -1
- package/build/cc/TimeParametersCC.d.ts +18 -14
- package/build/cc/TimeParametersCC.d.ts.map +1 -1
- package/build/cc/TimeParametersCC.js +77 -69
- package/build/cc/TimeParametersCC.js.map +1 -1
- package/build/cc/TransportServiceCC.d.ts +29 -32
- package/build/cc/TransportServiceCC.d.ts.map +1 -1
- package/build/cc/TransportServiceCC.js +159 -161
- package/build/cc/TransportServiceCC.js.map +1 -1
- package/build/cc/UserCodeCC.d.ts +83 -66
- package/build/cc/UserCodeCC.d.ts.map +1 -1
- package/build/cc/UserCodeCC.js +449 -402
- package/build/cc/UserCodeCC.js.map +1 -1
- package/build/cc/VersionCC.d.ts +36 -20
- package/build/cc/VersionCC.d.ts.map +1 -1
- package/build/cc/VersionCC.js +190 -149
- package/build/cc/VersionCC.js.map +1 -1
- package/build/cc/WakeUpCC.d.ts +27 -13
- package/build/cc/WakeUpCC.d.ts.map +1 -1
- package/build/cc/WakeUpCC.js +105 -77
- package/build/cc/WakeUpCC.js.map +1 -1
- package/build/cc/WindowCoveringCC.d.ts +39 -27
- package/build/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/cc/WindowCoveringCC.js +169 -137
- package/build/cc/WindowCoveringCC.js.map +1 -1
- package/build/cc/ZWavePlusCC.d.ts +8 -7
- package/build/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/cc/ZWavePlusCC.js +44 -37
- package/build/cc/ZWavePlusCC.js.map +1 -1
- package/build/cc/ZWaveProtocolCC.d.ts +111 -84
- package/build/cc/ZWaveProtocolCC.d.ts.map +1 -1
- package/build/cc/ZWaveProtocolCC.js +583 -508
- package/build/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/cc/index.d.ts +37 -34
- package/build/cc/index.d.ts.map +1 -1
- package/build/cc/index.js +6 -7
- package/build/cc/index.js.map +1 -1
- package/build/cc/manufacturerProprietary/FibaroCC.d.ts +29 -24
- package/build/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
- package/build/cc/manufacturerProprietary/FibaroCC.js +109 -112
- package/build/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/index.d.ts +0 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +0 -1
- package/build/index.js.map +1 -1
- package/build/lib/API.d.ts +21 -18
- package/build/lib/API.d.ts.map +1 -1
- package/build/lib/API.js +25 -49
- package/build/lib/API.js.map +1 -1
- package/build/lib/CommandClass.d.ts +51 -89
- package/build/lib/CommandClass.d.ts.map +1 -1
- package/build/lib/CommandClass.js +177 -249
- package/build/lib/CommandClass.js.map +1 -1
- package/build/lib/EncapsulatingCommandClass.d.ts +1 -15
- package/build/lib/EncapsulatingCommandClass.d.ts.map +1 -1
- package/build/lib/EncapsulatingCommandClass.js.map +1 -1
- package/build/lib/ICommandClassContainer.d.ts +1 -8
- package/build/lib/ICommandClassContainer.d.ts.map +1 -1
- package/build/lib/ICommandClassContainer.js +0 -8
- package/build/lib/ICommandClassContainer.js.map +1 -1
- package/build/lib/Values.d.ts +3 -3
- package/build/lib/Values.d.ts.map +1 -1
- package/build/lib/_Types.d.ts.map +1 -1
- package/build/lib/_Types.js +1 -0
- package/build/lib/_Types.js.map +1 -1
- package/build/lib/utils.d.ts +14 -13
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +94 -92
- package/build/lib/utils.js.map +1 -1
- package/package.json +4 -5
package/build/cc/UserCodeCC.js
CHANGED
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
-
var UserCodeCC_1;
|
|
8
|
+
var UserCodeCC_1, UserCodeCCSet_1, UserCodeCCReport_1, UserCodeCCGet_1, UserCodeCCUsersNumberReport_1, UserCodeCCCapabilitiesReport_1, UserCodeCCKeypadModeSet_1, UserCodeCCKeypadModeReport_1, UserCodeCCAdminCodeSet_1, UserCodeCCAdminCodeReport_1, UserCodeCCUserCodeChecksumReport_1, UserCodeCCExtendedUserCodeReport_1;
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.UserCodeCCExtendedUserCodeGet = exports.UserCodeCCExtendedUserCodeReport = exports.UserCodeCCExtendedUserCodeSet = exports.UserCodeCCUserCodeChecksumGet = exports.UserCodeCCUserCodeChecksumReport = exports.UserCodeCCAdminCodeGet = exports.UserCodeCCAdminCodeReport = exports.UserCodeCCAdminCodeSet = exports.UserCodeCCKeypadModeGet = exports.UserCodeCCKeypadModeReport = exports.UserCodeCCKeypadModeSet = exports.UserCodeCCCapabilitiesGet = exports.UserCodeCCCapabilitiesReport = exports.UserCodeCCUsersNumberGet = exports.UserCodeCCUsersNumberReport = exports.UserCodeCCGet = exports.UserCodeCCReport = exports.UserCodeCCSet = exports.UserCodeCC = exports.UserCodeCCAPI = exports.UserCodeCCValues = void 0;
|
|
11
11
|
exports.userCodeToLogString = userCodeToLogString;
|
|
@@ -335,11 +335,12 @@ function validateCode(code, supportedChars) {
|
|
|
335
335
|
return false;
|
|
336
336
|
return [...code].every((char) => supportedChars.includes(char));
|
|
337
337
|
}
|
|
338
|
-
function setUserCodeMetadata(
|
|
338
|
+
function setUserCodeMetadata(ctx, userId, userCode) {
|
|
339
339
|
const statusValue = exports.UserCodeCCValues.userIdStatus(userId);
|
|
340
340
|
const codeValue = exports.UserCodeCCValues.userCode(userId);
|
|
341
|
-
const
|
|
342
|
-
|
|
341
|
+
const ccVersion = (0, CommandClass_1.getEffectiveCCVersion)(ctx, this);
|
|
342
|
+
const supportedUserIDStatuses = this.getValue(ctx, exports.UserCodeCCValues.supportedUserIDStatuses)
|
|
343
|
+
?? (ccVersion === 1
|
|
343
344
|
? [
|
|
344
345
|
_Types_1.UserIDStatus.Available,
|
|
345
346
|
_Types_1.UserIDStatus.Enabled,
|
|
@@ -352,7 +353,7 @@ function setUserCodeMetadata(applHost, userId, userCode) {
|
|
|
352
353
|
_Types_1.UserIDStatus.Messaging,
|
|
353
354
|
_Types_1.UserIDStatus.PassageMode,
|
|
354
355
|
]);
|
|
355
|
-
this.ensureMetadata(
|
|
356
|
+
this.ensureMetadata(ctx, statusValue, {
|
|
356
357
|
...statusValue.meta,
|
|
357
358
|
states: (0, safe_1.enumValuesToMetadataStates)(_Types_1.UserIDStatus, supportedUserIDStatuses),
|
|
358
359
|
});
|
|
@@ -364,26 +365,26 @@ function setUserCodeMetadata(applHost, userId, userCode) {
|
|
|
364
365
|
maxLength: 10,
|
|
365
366
|
label: `User Code (${userId})`,
|
|
366
367
|
};
|
|
367
|
-
if (this.getMetadata(
|
|
368
|
-
this.setMetadata(
|
|
368
|
+
if (this.getMetadata(ctx, codeValue)?.type !== codeMetadata.type) {
|
|
369
|
+
this.setMetadata(ctx, codeValue, codeMetadata);
|
|
369
370
|
}
|
|
370
371
|
}
|
|
371
|
-
function persistUserCode(
|
|
372
|
+
function persistUserCode(ctx, userId, userIdStatus, userCode) {
|
|
372
373
|
const statusValue = exports.UserCodeCCValues.userIdStatus(userId);
|
|
373
374
|
const codeValue = exports.UserCodeCCValues.userCode(userId);
|
|
374
375
|
// Check if this code is supported
|
|
375
376
|
if (userIdStatus === _Types_1.UserIDStatus.StatusNotAvailable) {
|
|
376
377
|
// It is not, remove all values if any exist
|
|
377
|
-
this.removeValue(
|
|
378
|
-
this.removeValue(
|
|
379
|
-
this.removeMetadata(
|
|
380
|
-
this.removeMetadata(
|
|
378
|
+
this.removeValue(ctx, statusValue);
|
|
379
|
+
this.removeValue(ctx, codeValue);
|
|
380
|
+
this.removeMetadata(ctx, statusValue);
|
|
381
|
+
this.removeMetadata(ctx, codeValue);
|
|
381
382
|
}
|
|
382
383
|
else {
|
|
383
384
|
// Always create metadata in case it does not exist
|
|
384
|
-
setUserCodeMetadata.call(this,
|
|
385
|
-
this.setValue(
|
|
386
|
-
this.setValue(
|
|
385
|
+
setUserCodeMetadata.call(this, ctx, userId, userCode);
|
|
386
|
+
this.setValue(ctx, statusValue, userIdStatus);
|
|
387
|
+
this.setValue(ctx, codeValue, userCode);
|
|
387
388
|
}
|
|
388
389
|
return true;
|
|
389
390
|
}
|
|
@@ -511,11 +512,11 @@ let UserCodeCCAPI = class UserCodeCCAPI extends API_1.PhysicalCCAPI {
|
|
|
511
512
|
}
|
|
512
513
|
async getUsersCount() {
|
|
513
514
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.UsersNumberGet);
|
|
514
|
-
const cc = new UserCodeCCUsersNumberGet(
|
|
515
|
+
const cc = new UserCodeCCUsersNumberGet({
|
|
515
516
|
nodeId: this.endpoint.nodeId,
|
|
516
|
-
|
|
517
|
+
endpointIndex: this.endpoint.index,
|
|
517
518
|
});
|
|
518
|
-
const response = await this.
|
|
519
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
519
520
|
return response?.supportedUsers;
|
|
520
521
|
}
|
|
521
522
|
async get(userId, multiple = false) {
|
|
@@ -523,13 +524,13 @@ let UserCodeCCAPI = class UserCodeCCAPI extends API_1.PhysicalCCAPI {
|
|
|
523
524
|
__assertType("multiple", "(optional) boolean", __assertType__optional_boolean.bind(void 0, multiple));
|
|
524
525
|
if (userId > 255 || multiple) {
|
|
525
526
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.ExtendedUserCodeGet);
|
|
526
|
-
const cc = new UserCodeCCExtendedUserCodeGet(
|
|
527
|
+
const cc = new UserCodeCCExtendedUserCodeGet({
|
|
527
528
|
nodeId: this.endpoint.nodeId,
|
|
528
|
-
|
|
529
|
+
endpointIndex: this.endpoint.index,
|
|
529
530
|
userId,
|
|
530
531
|
reportMore: multiple,
|
|
531
532
|
});
|
|
532
|
-
const response = await this.
|
|
533
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
533
534
|
if (!response) {
|
|
534
535
|
return;
|
|
535
536
|
}
|
|
@@ -545,12 +546,12 @@ let UserCodeCCAPI = class UserCodeCCAPI extends API_1.PhysicalCCAPI {
|
|
|
545
546
|
}
|
|
546
547
|
else {
|
|
547
548
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.Get);
|
|
548
|
-
const cc = new UserCodeCCGet(
|
|
549
|
+
const cc = new UserCodeCCGet({
|
|
549
550
|
nodeId: this.endpoint.nodeId,
|
|
550
|
-
|
|
551
|
+
endpointIndex: this.endpoint.index,
|
|
551
552
|
userId,
|
|
552
553
|
});
|
|
553
|
-
const response = await this.
|
|
554
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
554
555
|
if (response)
|
|
555
556
|
return (0, safe_2.pick)(response, ["userIdStatus", "userCode"]);
|
|
556
557
|
}
|
|
@@ -564,27 +565,27 @@ let UserCodeCCAPI = class UserCodeCCAPI extends API_1.PhysicalCCAPI {
|
|
|
564
565
|
return this.setMany([{ userId, userIdStatus, userCode }]);
|
|
565
566
|
}
|
|
566
567
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.Set);
|
|
567
|
-
const numUsers = UserCodeCC.getSupportedUsersCached(this.
|
|
568
|
+
const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
|
|
568
569
|
if (numUsers != undefined && userId > numUsers) {
|
|
569
570
|
throw new safe_1.ZWaveError(`The user ID must be between 0 and the number of supported users ${numUsers}.`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
570
571
|
}
|
|
571
|
-
const cc = new UserCodeCCSet(
|
|
572
|
+
const cc = new UserCodeCCSet({
|
|
572
573
|
nodeId: this.endpoint.nodeId,
|
|
573
|
-
|
|
574
|
+
endpointIndex: this.endpoint.index,
|
|
574
575
|
userId,
|
|
575
576
|
userIdStatus,
|
|
576
577
|
userCode,
|
|
577
578
|
});
|
|
578
|
-
return this.
|
|
579
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
579
580
|
}
|
|
580
581
|
/** Configures multiple user codes */
|
|
581
582
|
async setMany(codes) {
|
|
582
583
|
__assertType("codes", undefined, __assertType__sa_su__3__4__5_eu_ea_2.bind(void 0, codes));
|
|
583
584
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.ExtendedUserCodeSet);
|
|
584
|
-
const numUsers = UserCodeCC.getSupportedUsersCached(this.
|
|
585
|
-
const supportedStatuses = UserCodeCC.getSupportedUserIDStatusesCached(this.
|
|
586
|
-
const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.
|
|
587
|
-
const supportsMultipleUserCodeSet = UserCodeCC.supportsMultipleUserCodeSetCached(this.
|
|
585
|
+
const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
|
|
586
|
+
const supportedStatuses = UserCodeCC.getSupportedUserIDStatusesCached(this.host, this.endpoint);
|
|
587
|
+
const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.host, this.endpoint);
|
|
588
|
+
const supportsMultipleUserCodeSet = UserCodeCC.supportsMultipleUserCodeSetCached(this.host, this.endpoint) ?? false;
|
|
588
589
|
// Validate options
|
|
589
590
|
if (numUsers != undefined) {
|
|
590
591
|
if (codes.some((code) => code.userId < 0 || code.userId > numUsers)) {
|
|
@@ -620,12 +621,12 @@ let UserCodeCCAPI = class UserCodeCCAPI extends API_1.PhysicalCCAPI {
|
|
|
620
621
|
}
|
|
621
622
|
}
|
|
622
623
|
}
|
|
623
|
-
const cc = new UserCodeCCExtendedUserCodeSet(
|
|
624
|
+
const cc = new UserCodeCCExtendedUserCodeSet({
|
|
624
625
|
nodeId: this.endpoint.nodeId,
|
|
625
|
-
|
|
626
|
+
endpointIndex: this.endpoint.index,
|
|
626
627
|
userCodes: codes,
|
|
627
628
|
});
|
|
628
|
-
return this.
|
|
629
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
629
630
|
}
|
|
630
631
|
/**
|
|
631
632
|
* Clears one or all user code
|
|
@@ -640,27 +641,27 @@ let UserCodeCCAPI = class UserCodeCCAPI extends API_1.PhysicalCCAPI {
|
|
|
640
641
|
}
|
|
641
642
|
else {
|
|
642
643
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.Set);
|
|
643
|
-
const numUsers = UserCodeCC.getSupportedUsersCached(this.
|
|
644
|
+
const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
|
|
644
645
|
if (numUsers != undefined && userId > numUsers) {
|
|
645
646
|
throw new safe_1.ZWaveError(`The user ID must be between 0 and the number of supported users ${numUsers}.`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
646
647
|
}
|
|
647
|
-
const cc = new UserCodeCCSet(
|
|
648
|
+
const cc = new UserCodeCCSet({
|
|
648
649
|
nodeId: this.endpoint.nodeId,
|
|
649
|
-
|
|
650
|
+
endpointIndex: this.endpoint.index,
|
|
650
651
|
userId,
|
|
651
652
|
userIdStatus: _Types_1.UserIDStatus.Available,
|
|
652
653
|
});
|
|
653
|
-
return this.
|
|
654
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
654
655
|
}
|
|
655
656
|
}
|
|
656
657
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
657
658
|
async getCapabilities() {
|
|
658
659
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.CapabilitiesGet);
|
|
659
|
-
const cc = new UserCodeCCCapabilitiesGet(
|
|
660
|
+
const cc = new UserCodeCCCapabilitiesGet({
|
|
660
661
|
nodeId: this.endpoint.nodeId,
|
|
661
|
-
|
|
662
|
+
endpointIndex: this.endpoint.index,
|
|
662
663
|
});
|
|
663
|
-
const response = await this.
|
|
664
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
664
665
|
if (response) {
|
|
665
666
|
return (0, safe_2.pick)(response, [
|
|
666
667
|
"supportsAdminCode",
|
|
@@ -676,50 +677,50 @@ let UserCodeCCAPI = class UserCodeCCAPI extends API_1.PhysicalCCAPI {
|
|
|
676
677
|
}
|
|
677
678
|
async getKeypadMode() {
|
|
678
679
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.KeypadModeGet);
|
|
679
|
-
const cc = new UserCodeCCKeypadModeGet(
|
|
680
|
+
const cc = new UserCodeCCKeypadModeGet({
|
|
680
681
|
nodeId: this.endpoint.nodeId,
|
|
681
|
-
|
|
682
|
+
endpointIndex: this.endpoint.index,
|
|
682
683
|
});
|
|
683
|
-
const response = await this.
|
|
684
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
684
685
|
return response?.keypadMode;
|
|
685
686
|
}
|
|
686
687
|
async setKeypadMode(keypadMode) {
|
|
687
688
|
__assertType("keypadMode", "KeypadMode", __assertType__KeypadMode.bind(void 0, keypadMode));
|
|
688
689
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.KeypadModeSet);
|
|
689
|
-
const supportedModes = UserCodeCC.getSupportedKeypadModesCached(this.
|
|
690
|
+
const supportedModes = UserCodeCC.getSupportedKeypadModesCached(this.host, this.endpoint);
|
|
690
691
|
if (!supportedModes) {
|
|
691
692
|
throw new safe_1.ZWaveError(`The keypad mode can only be set after the interview is complete!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
692
693
|
}
|
|
693
694
|
else if (!supportedModes.includes(keypadMode)) {
|
|
694
695
|
throw new safe_1.ZWaveError(`The keypad mode ${(0, safe_2.getEnumMemberName)(_Types_1.KeypadMode, keypadMode)} is not supported by the node!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
695
696
|
}
|
|
696
|
-
const cc = new UserCodeCCKeypadModeSet(
|
|
697
|
+
const cc = new UserCodeCCKeypadModeSet({
|
|
697
698
|
nodeId: this.endpoint.nodeId,
|
|
698
|
-
|
|
699
|
+
endpointIndex: this.endpoint.index,
|
|
699
700
|
keypadMode,
|
|
700
701
|
});
|
|
701
|
-
return this.
|
|
702
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
702
703
|
}
|
|
703
704
|
async getAdminCode() {
|
|
704
705
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.AdminCodeGet);
|
|
705
|
-
const cc = new UserCodeCCAdminCodeGet(
|
|
706
|
+
const cc = new UserCodeCCAdminCodeGet({
|
|
706
707
|
nodeId: this.endpoint.nodeId,
|
|
707
|
-
|
|
708
|
+
endpointIndex: this.endpoint.index,
|
|
708
709
|
});
|
|
709
|
-
const response = await this.
|
|
710
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
710
711
|
return response?.adminCode;
|
|
711
712
|
}
|
|
712
713
|
async setAdminCode(adminCode) {
|
|
713
714
|
__assertType("adminCode", "string", __assertType__string.bind(void 0, adminCode));
|
|
714
715
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.AdminCodeSet);
|
|
715
|
-
const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.
|
|
716
|
+
const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.host, this.endpoint);
|
|
716
717
|
if (!supportedASCIIChars) {
|
|
717
718
|
throw new safe_1.ZWaveError(`The admin code can only be set after the interview is complete!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
718
719
|
}
|
|
719
720
|
// Validate the code
|
|
720
721
|
if (!adminCode) {
|
|
721
722
|
const supportsDeactivation = UserCodeCC
|
|
722
|
-
.supportsAdminCodeDeactivationCached(this.
|
|
723
|
+
.supportsAdminCodeDeactivationCached(this.host, this.endpoint);
|
|
723
724
|
if (!supportsDeactivation) {
|
|
724
725
|
throw new safe_1.ZWaveError(`The node does not support deactivating the admin code!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
725
726
|
}
|
|
@@ -727,20 +728,20 @@ let UserCodeCCAPI = class UserCodeCCAPI extends API_1.PhysicalCCAPI {
|
|
|
727
728
|
else if (!validateCode(adminCode, supportedASCIIChars)) {
|
|
728
729
|
throw new safe_1.ZWaveError(`The admin code must consist of 4 to 10 of the following characters: ${supportedASCIIChars}`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
729
730
|
}
|
|
730
|
-
const cc = new UserCodeCCAdminCodeSet(
|
|
731
|
+
const cc = new UserCodeCCAdminCodeSet({
|
|
731
732
|
nodeId: this.endpoint.nodeId,
|
|
732
|
-
|
|
733
|
+
endpointIndex: this.endpoint.index,
|
|
733
734
|
adminCode,
|
|
734
735
|
});
|
|
735
|
-
return this.
|
|
736
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
736
737
|
}
|
|
737
738
|
async getUserCodeChecksum() {
|
|
738
739
|
this.assertSupportsCommand(_Types_1.UserCodeCommand, _Types_1.UserCodeCommand.UserCodeChecksumGet);
|
|
739
|
-
const cc = new UserCodeCCUserCodeChecksumGet(
|
|
740
|
+
const cc = new UserCodeCCUserCodeChecksumGet({
|
|
740
741
|
nodeId: this.endpoint.nodeId,
|
|
741
|
-
|
|
742
|
+
endpointIndex: this.endpoint.index,
|
|
742
743
|
});
|
|
743
|
-
const response = await this.
|
|
744
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
744
745
|
return response?.userCodeChecksum;
|
|
745
746
|
}
|
|
746
747
|
};
|
|
@@ -749,26 +750,26 @@ exports.UserCodeCCAPI = UserCodeCCAPI = __decorate([
|
|
|
749
750
|
(0, CommandClassDecorators_1.API)(safe_1.CommandClasses["User Code"])
|
|
750
751
|
], UserCodeCCAPI);
|
|
751
752
|
let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandClass {
|
|
752
|
-
async interview(
|
|
753
|
-
const node = this.getNode(
|
|
754
|
-
const endpoint = this.getEndpoint(
|
|
755
|
-
const api = API_1.CCAPI.create(safe_1.CommandClasses["User Code"],
|
|
753
|
+
async interview(ctx) {
|
|
754
|
+
const node = this.getNode(ctx);
|
|
755
|
+
const endpoint = this.getEndpoint(ctx);
|
|
756
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses["User Code"], ctx, endpoint).withOptions({
|
|
756
757
|
priority: safe_1.MessagePriority.NodeQuery,
|
|
757
758
|
});
|
|
758
|
-
|
|
759
|
+
ctx.logNode(node.id, {
|
|
759
760
|
endpoint: this.endpointIndex,
|
|
760
761
|
message: `Interviewing ${this.ccName}...`,
|
|
761
762
|
direction: "none",
|
|
762
763
|
});
|
|
763
764
|
// Query capabilities first to determine what needs to be done when refreshing
|
|
764
|
-
if (
|
|
765
|
-
|
|
765
|
+
if (api.version >= 2) {
|
|
766
|
+
ctx.logNode(node.id, {
|
|
766
767
|
message: "querying capabilities...",
|
|
767
768
|
direction: "outbound",
|
|
768
769
|
});
|
|
769
770
|
const caps = await api.getCapabilities();
|
|
770
771
|
if (!caps) {
|
|
771
|
-
|
|
772
|
+
ctx.logNode(node.id, {
|
|
772
773
|
endpoint: this.endpointIndex,
|
|
773
774
|
message: "User Code capabilities query timed out, skipping interview...",
|
|
774
775
|
level: "warn",
|
|
@@ -776,13 +777,13 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
776
777
|
return;
|
|
777
778
|
}
|
|
778
779
|
}
|
|
779
|
-
|
|
780
|
+
ctx.logNode(node.id, {
|
|
780
781
|
message: "querying number of user codes...",
|
|
781
782
|
direction: "outbound",
|
|
782
783
|
});
|
|
783
784
|
const supportedUsers = await api.getUsersCount();
|
|
784
785
|
if (supportedUsers == undefined) {
|
|
785
|
-
|
|
786
|
+
ctx.logNode(node.id, {
|
|
786
787
|
endpoint: this.endpointIndex,
|
|
787
788
|
message: "Querying number of user codes timed out, skipping interview...",
|
|
788
789
|
level: "warn",
|
|
@@ -790,47 +791,47 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
790
791
|
return;
|
|
791
792
|
}
|
|
792
793
|
for (let userId = 1; userId <= supportedUsers; userId++) {
|
|
793
|
-
setUserCodeMetadata.call(this,
|
|
794
|
+
setUserCodeMetadata.call(this, ctx, userId);
|
|
794
795
|
}
|
|
795
796
|
// Synchronize user codes and settings
|
|
796
|
-
if (
|
|
797
|
-
await this.refreshValues(
|
|
797
|
+
if (ctx.getInterviewOptions()?.queryAllUserCodes) {
|
|
798
|
+
await this.refreshValues(ctx);
|
|
798
799
|
}
|
|
799
800
|
// Remember that the interview is complete
|
|
800
|
-
this.setInterviewComplete(
|
|
801
|
+
this.setInterviewComplete(ctx, true);
|
|
801
802
|
}
|
|
802
|
-
async refreshValues(
|
|
803
|
-
const node = this.getNode(
|
|
804
|
-
const endpoint = this.getEndpoint(
|
|
805
|
-
const api = API_1.CCAPI.create(safe_1.CommandClasses["User Code"],
|
|
803
|
+
async refreshValues(ctx) {
|
|
804
|
+
const node = this.getNode(ctx);
|
|
805
|
+
const endpoint = this.getEndpoint(ctx);
|
|
806
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses["User Code"], ctx, endpoint).withOptions({
|
|
806
807
|
priority: safe_1.MessagePriority.NodeQuery,
|
|
807
808
|
});
|
|
808
|
-
const supportsAdminCode = UserCodeCC_1.supportsAdminCodeCached(
|
|
809
|
-
const supportsUserCodeChecksum = this.getValue(
|
|
810
|
-
const supportedKeypadModes = this.getValue(
|
|
809
|
+
const supportsAdminCode = UserCodeCC_1.supportsAdminCodeCached(ctx, endpoint);
|
|
810
|
+
const supportsUserCodeChecksum = this.getValue(ctx, exports.UserCodeCCValues.supportsUserCodeChecksum) ?? false;
|
|
811
|
+
const supportedKeypadModes = this.getValue(ctx, exports.UserCodeCCValues.supportedKeypadModes)
|
|
811
812
|
?? [];
|
|
812
|
-
const supportedUsers = this.getValue(
|
|
813
|
-
const supportsMultipleUserCodeReport = !!this.getValue(
|
|
813
|
+
const supportedUsers = this.getValue(ctx, exports.UserCodeCCValues.supportedUsers) ?? 0;
|
|
814
|
+
const supportsMultipleUserCodeReport = !!this.getValue(ctx, exports.UserCodeCCValues.supportsMultipleUserCodeReport);
|
|
814
815
|
// Check for changed values and codes
|
|
815
|
-
if (
|
|
816
|
+
if (api.version >= 2) {
|
|
816
817
|
if (supportsAdminCode) {
|
|
817
|
-
|
|
818
|
+
ctx.logNode(node.id, {
|
|
818
819
|
message: "querying admin code...",
|
|
819
820
|
direction: "outbound",
|
|
820
821
|
});
|
|
821
822
|
await api.getAdminCode();
|
|
822
823
|
}
|
|
823
824
|
if (supportedKeypadModes.length > 1) {
|
|
824
|
-
|
|
825
|
+
ctx.logNode(node.id, {
|
|
825
826
|
message: "querying active keypad mode...",
|
|
826
827
|
direction: "outbound",
|
|
827
828
|
});
|
|
828
829
|
await api.getKeypadMode();
|
|
829
830
|
}
|
|
830
|
-
const storedUserCodeChecksum = this.getValue(
|
|
831
|
+
const storedUserCodeChecksum = this.getValue(ctx, exports.UserCodeCCValues.userCodeChecksum) ?? 0;
|
|
831
832
|
let currentUserCodeChecksum = 0;
|
|
832
833
|
if (supportsUserCodeChecksum) {
|
|
833
|
-
|
|
834
|
+
ctx.logNode(node.id, {
|
|
834
835
|
message: "retrieving current user code checksum...",
|
|
835
836
|
direction: "outbound",
|
|
836
837
|
});
|
|
@@ -838,7 +839,7 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
838
839
|
}
|
|
839
840
|
if (!supportsUserCodeChecksum
|
|
840
841
|
|| currentUserCodeChecksum !== storedUserCodeChecksum) {
|
|
841
|
-
|
|
842
|
+
ctx.logNode(node.id, {
|
|
842
843
|
message: "checksum changed or is not supported, querying all user codes...",
|
|
843
844
|
direction: "outbound",
|
|
844
845
|
});
|
|
@@ -851,7 +852,7 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
851
852
|
nextUserId = response.nextUserId;
|
|
852
853
|
}
|
|
853
854
|
else {
|
|
854
|
-
|
|
855
|
+
ctx.logNode(node.id, {
|
|
855
856
|
endpoint: this.endpointIndex,
|
|
856
857
|
message: `Querying user code #${nextUserId} timed out, skipping the remaining interview...`,
|
|
857
858
|
level: "warn",
|
|
@@ -870,7 +871,7 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
870
871
|
}
|
|
871
872
|
else {
|
|
872
873
|
// V1
|
|
873
|
-
|
|
874
|
+
ctx.logNode(node.id, {
|
|
874
875
|
message: "querying all user codes...",
|
|
875
876
|
direction: "outbound",
|
|
876
877
|
});
|
|
@@ -883,8 +884,8 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
883
884
|
* Returns the number of supported users.
|
|
884
885
|
* This only works AFTER the interview process
|
|
885
886
|
*/
|
|
886
|
-
static getSupportedUsersCached(
|
|
887
|
-
return
|
|
887
|
+
static getSupportedUsersCached(ctx, endpoint) {
|
|
888
|
+
return ctx
|
|
888
889
|
.getValueDB(endpoint.nodeId)
|
|
889
890
|
.getValue(exports.UserCodeCCValues.supportedUsers.endpoint(endpoint.index));
|
|
890
891
|
}
|
|
@@ -892,8 +893,8 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
892
893
|
* Returns the supported keypad modes.
|
|
893
894
|
* This only works AFTER the interview process
|
|
894
895
|
*/
|
|
895
|
-
static getSupportedKeypadModesCached(
|
|
896
|
-
return
|
|
896
|
+
static getSupportedKeypadModesCached(ctx, endpoint) {
|
|
897
|
+
return ctx
|
|
897
898
|
.getValueDB(endpoint.nodeId)
|
|
898
899
|
.getValue(exports.UserCodeCCValues.supportedKeypadModes.endpoint(endpoint.index));
|
|
899
900
|
}
|
|
@@ -901,8 +902,8 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
901
902
|
* Returns the supported user ID statuses.
|
|
902
903
|
* This only works AFTER the interview process
|
|
903
904
|
*/
|
|
904
|
-
static getSupportedUserIDStatusesCached(
|
|
905
|
-
return
|
|
905
|
+
static getSupportedUserIDStatusesCached(ctx, endpoint) {
|
|
906
|
+
return ctx
|
|
906
907
|
.getValueDB(endpoint.nodeId)
|
|
907
908
|
.getValue(exports.UserCodeCCValues.supportedUserIDStatuses.endpoint(endpoint.index));
|
|
908
909
|
}
|
|
@@ -910,8 +911,8 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
910
911
|
* Returns the supported ASCII characters.
|
|
911
912
|
* This only works AFTER the interview process
|
|
912
913
|
*/
|
|
913
|
-
static getSupportedASCIICharsCached(
|
|
914
|
-
return
|
|
914
|
+
static getSupportedASCIICharsCached(ctx, endpoint) {
|
|
915
|
+
return ctx
|
|
915
916
|
.getValueDB(endpoint.nodeId)
|
|
916
917
|
.getValue(exports.UserCodeCCValues.supportedASCIIChars.endpoint(endpoint.index));
|
|
917
918
|
}
|
|
@@ -919,8 +920,8 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
919
920
|
* Returns whether the admin code functionality is supported.
|
|
920
921
|
* This only works AFTER the interview process
|
|
921
922
|
*/
|
|
922
|
-
static supportsAdminCodeCached(
|
|
923
|
-
const valueDB =
|
|
923
|
+
static supportsAdminCodeCached(ctx, endpoint) {
|
|
924
|
+
const valueDB = ctx
|
|
924
925
|
.getValueDB(endpoint.nodeId);
|
|
925
926
|
return valueDB.getValue(exports.UserCodeCCValues.supportsAdminCode.endpoint(endpoint.index)) ?? valueDB.getValue(exports.UserCodeCCValues._deprecated_supportsMasterCode.endpoint(endpoint.index)) ?? false;
|
|
926
927
|
}
|
|
@@ -928,8 +929,8 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
928
929
|
* Returns whether deactivating the admin code is supported.
|
|
929
930
|
* This only works AFTER the interview process
|
|
930
931
|
*/
|
|
931
|
-
static supportsAdminCodeDeactivationCached(
|
|
932
|
-
const valueDB =
|
|
932
|
+
static supportsAdminCodeDeactivationCached(ctx, endpoint) {
|
|
933
|
+
const valueDB = ctx
|
|
933
934
|
.getValueDB(endpoint.nodeId);
|
|
934
935
|
return valueDB.getValue(exports.UserCodeCCValues.supportsAdminCodeDeactivation.endpoint(endpoint.index)) ?? valueDB.getValue(exports.UserCodeCCValues._deprecated_supportsMasterCodeDeactivation
|
|
935
936
|
.endpoint(endpoint.index)) ?? false;
|
|
@@ -938,8 +939,8 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
938
939
|
* Returns whether setting multiple user codes at once is supported.
|
|
939
940
|
* This only works AFTER the interview process
|
|
940
941
|
*/
|
|
941
|
-
static supportsMultipleUserCodeSetCached(
|
|
942
|
-
return !!
|
|
942
|
+
static supportsMultipleUserCodeSetCached(ctx, endpoint) {
|
|
943
|
+
return !!ctx
|
|
943
944
|
.getValueDB(endpoint.nodeId)
|
|
944
945
|
.getValue(exports.UserCodeCCValues.supportsMultipleUserCodeSet.endpoint(endpoint.index));
|
|
945
946
|
}
|
|
@@ -947,8 +948,8 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
947
948
|
* Returns the current status of a user ID.
|
|
948
949
|
* This only works AFTER the user IDs have been queried.
|
|
949
950
|
*/
|
|
950
|
-
static getUserIdStatusCached(
|
|
951
|
-
return
|
|
951
|
+
static getUserIdStatusCached(ctx, endpoint, userId) {
|
|
952
|
+
return ctx
|
|
952
953
|
.getValueDB(endpoint.nodeId)
|
|
953
954
|
.getValue(exports.UserCodeCCValues.userIdStatus(userId).endpoint(endpoint.index));
|
|
954
955
|
}
|
|
@@ -956,8 +957,8 @@ let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass_1.CommandC
|
|
|
956
957
|
* Returns the current code belonging to a user ID.
|
|
957
958
|
* This only works AFTER the user IDs have been queried.
|
|
958
959
|
*/
|
|
959
|
-
static getUserCodeCached(
|
|
960
|
-
return
|
|
960
|
+
static getUserCodeCached(ctx, endpoint, userId) {
|
|
961
|
+
return ctx
|
|
961
962
|
.getValueDB(endpoint.nodeId)
|
|
962
963
|
.getValue(exports.UserCodeCCValues.userCode(userId).endpoint(endpoint.index));
|
|
963
964
|
}
|
|
@@ -968,61 +969,69 @@ exports.UserCodeCC = UserCodeCC = UserCodeCC_1 = __decorate([
|
|
|
968
969
|
(0, CommandClassDecorators_1.implementedVersion)(2),
|
|
969
970
|
(0, CommandClassDecorators_1.ccValues)(exports.UserCodeCCValues)
|
|
970
971
|
], UserCodeCC);
|
|
971
|
-
let UserCodeCCSet = class UserCodeCCSet extends UserCodeCC {
|
|
972
|
-
constructor(
|
|
973
|
-
super(
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
972
|
+
let UserCodeCCSet = UserCodeCCSet_1 = class UserCodeCCSet extends UserCodeCC {
|
|
973
|
+
constructor(options) {
|
|
974
|
+
super(options);
|
|
975
|
+
this.userId = options.userId;
|
|
976
|
+
this.userIdStatus = options.userIdStatus;
|
|
977
|
+
// Validate options
|
|
978
|
+
if (this.userId < 0) {
|
|
979
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: The user ID must be between greater than 0.`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
980
|
+
}
|
|
981
|
+
else if (this.userId === 0
|
|
982
|
+
&& this.userIdStatus !== _Types_1.UserIDStatus.Available) {
|
|
983
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: User ID 0 may only be used to clear all user codes`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
984
|
+
}
|
|
985
|
+
else if (this.userIdStatus === _Types_1.UserIDStatus.Available) {
|
|
986
|
+
this.userCode = "\0".repeat(4);
|
|
985
987
|
}
|
|
986
988
|
else {
|
|
987
|
-
this.
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
else if (this.userId === 0
|
|
994
|
-
&& this.userIdStatus !== _Types_1.UserIDStatus.Available) {
|
|
995
|
-
throw new safe_1.ZWaveError(`${this.constructor.name}: User ID 0 may only be used to clear all user codes`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
996
|
-
}
|
|
997
|
-
else if (this.userIdStatus === _Types_1.UserIDStatus.Available) {
|
|
998
|
-
this.userCode = "\0".repeat(4);
|
|
999
|
-
}
|
|
1000
|
-
else {
|
|
1001
|
-
this.userCode = options.userCode;
|
|
1002
|
-
// Specs say ASCII 0-9, manufacturers don't care :)
|
|
1003
|
-
if (this.userCode.length < 4 || this.userCode.length > 10) {
|
|
1004
|
-
throw new safe_1.ZWaveError(`${this.constructor.name}: The user code must have a length of 4 to 10 ${typeof this.userCode === "string"
|
|
1005
|
-
? "characters"
|
|
1006
|
-
: "bytes"}`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
1007
|
-
}
|
|
989
|
+
this.userCode = options.userCode;
|
|
990
|
+
// Specs say ASCII 0-9, manufacturers don't care :)
|
|
991
|
+
if (this.userCode.length < 4 || this.userCode.length > 10) {
|
|
992
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: The user code must have a length of 4 to 10 ${typeof this.userCode === "string"
|
|
993
|
+
? "characters"
|
|
994
|
+
: "bytes"}`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
1008
995
|
}
|
|
1009
996
|
}
|
|
1010
997
|
}
|
|
998
|
+
static from(raw, ctx) {
|
|
999
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 2);
|
|
1000
|
+
const userId = raw.payload[0];
|
|
1001
|
+
const userIdStatus = raw.payload[1];
|
|
1002
|
+
if (userIdStatus === _Types_1.UserIDStatus.StatusNotAvailable) {
|
|
1003
|
+
safe_1.validatePayload.fail("Invalid user ID status");
|
|
1004
|
+
}
|
|
1005
|
+
if (userIdStatus === _Types_1.UserIDStatus.Available) {
|
|
1006
|
+
return new UserCodeCCSet_1({
|
|
1007
|
+
nodeId: ctx.sourceNodeId,
|
|
1008
|
+
userId,
|
|
1009
|
+
userIdStatus,
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
const userCode = raw.payload.subarray(2);
|
|
1013
|
+
return new UserCodeCCSet_1({
|
|
1014
|
+
nodeId: ctx.sourceNodeId,
|
|
1015
|
+
userId,
|
|
1016
|
+
userIdStatus,
|
|
1017
|
+
userCode,
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1011
1020
|
userId;
|
|
1012
1021
|
userIdStatus;
|
|
1013
1022
|
userCode;
|
|
1014
|
-
serialize() {
|
|
1023
|
+
serialize(ctx) {
|
|
1015
1024
|
this.payload = Buffer.concat([
|
|
1016
1025
|
Buffer.from([this.userId, this.userIdStatus]),
|
|
1017
1026
|
typeof this.userCode === "string"
|
|
1018
1027
|
? Buffer.from(this.userCode, "ascii")
|
|
1019
1028
|
: this.userCode,
|
|
1020
1029
|
]);
|
|
1021
|
-
return super.serialize();
|
|
1030
|
+
return super.serialize(ctx);
|
|
1022
1031
|
}
|
|
1023
|
-
toLogEntry(
|
|
1032
|
+
toLogEntry(ctx) {
|
|
1024
1033
|
return {
|
|
1025
|
-
...super.toLogEntry(
|
|
1034
|
+
...super.toLogEntry(ctx),
|
|
1026
1035
|
message: {
|
|
1027
1036
|
"user id": this.userId,
|
|
1028
1037
|
"id status": (0, safe_2.getEnumMemberName)(_Types_1.UserIDStatus, this.userIdStatus),
|
|
@@ -1032,63 +1041,67 @@ let UserCodeCCSet = class UserCodeCCSet extends UserCodeCC {
|
|
|
1032
1041
|
}
|
|
1033
1042
|
};
|
|
1034
1043
|
exports.UserCodeCCSet = UserCodeCCSet;
|
|
1035
|
-
exports.UserCodeCCSet = UserCodeCCSet = __decorate([
|
|
1044
|
+
exports.UserCodeCCSet = UserCodeCCSet = UserCodeCCSet_1 = __decorate([
|
|
1036
1045
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.Set),
|
|
1037
1046
|
(0, CommandClassDecorators_1.useSupervision)()
|
|
1038
1047
|
], UserCodeCCSet);
|
|
1039
|
-
let UserCodeCCReport = class UserCodeCCReport extends UserCodeCC {
|
|
1040
|
-
constructor(
|
|
1041
|
-
super(
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1048
|
+
let UserCodeCCReport = UserCodeCCReport_1 = class UserCodeCCReport extends UserCodeCC {
|
|
1049
|
+
constructor(options) {
|
|
1050
|
+
super(options);
|
|
1051
|
+
this.userId = options.userId;
|
|
1052
|
+
this.userIdStatus = options.userIdStatus;
|
|
1053
|
+
this.userCode = options.userCode ?? "";
|
|
1054
|
+
}
|
|
1055
|
+
static from(raw, ctx) {
|
|
1056
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 2);
|
|
1057
|
+
const userId = raw.payload[0];
|
|
1058
|
+
const userIdStatus = raw.payload[1];
|
|
1059
|
+
let userCode;
|
|
1060
|
+
if (raw.payload.length === 2
|
|
1061
|
+
&& (userIdStatus === _Types_1.UserIDStatus.Available
|
|
1062
|
+
|| userIdStatus === _Types_1.UserIDStatus.StatusNotAvailable)) {
|
|
1063
|
+
// The user code is not set or not available and this report contains no user code
|
|
1064
|
+
userCode = "";
|
|
1065
|
+
}
|
|
1066
|
+
else {
|
|
1067
|
+
// The specs require the user code to be at least 4 digits
|
|
1068
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 6);
|
|
1069
|
+
let userCodeBuffer = raw.payload.subarray(2);
|
|
1070
|
+
// Specs say infer user code from payload length, manufacturers send zero-padded strings
|
|
1071
|
+
while (userCodeBuffer.at(-1) === 0) {
|
|
1072
|
+
userCodeBuffer = userCodeBuffer.subarray(0, -1);
|
|
1073
|
+
}
|
|
1074
|
+
// Specs say ASCII 0-9, manufacturers don't care :)
|
|
1075
|
+
// Thus we check if the code is printable using ASCII, if not keep it as a Buffer
|
|
1076
|
+
const userCodeString = userCodeBuffer.toString("utf8");
|
|
1077
|
+
if ((0, safe_2.isPrintableASCII)(userCodeString)) {
|
|
1078
|
+
userCode = userCodeString;
|
|
1079
|
+
}
|
|
1080
|
+
else if ((0, safe_2.isPrintableASCIIWithWhitespace)(userCodeString)) {
|
|
1081
|
+
// Ignore leading and trailing whitespace in V1 reports if the rest is ASCII
|
|
1082
|
+
userCode = userCodeString.trim();
|
|
1051
1083
|
}
|
|
1052
1084
|
else {
|
|
1053
|
-
|
|
1054
|
-
(0, safe_1.validatePayload)(this.payload.length >= 6);
|
|
1055
|
-
let userCodeBuffer = this.payload.subarray(2);
|
|
1056
|
-
// Specs say infer user code from payload length, manufacturers send zero-padded strings
|
|
1057
|
-
while (userCodeBuffer.at(-1) === 0) {
|
|
1058
|
-
userCodeBuffer = userCodeBuffer.subarray(0, -1);
|
|
1059
|
-
}
|
|
1060
|
-
// Specs say ASCII 0-9, manufacturers don't care :)
|
|
1061
|
-
// Thus we check if the code is printable using ASCII, if not keep it as a Buffer
|
|
1062
|
-
const userCodeString = userCodeBuffer.toString("utf8");
|
|
1063
|
-
if ((0, safe_2.isPrintableASCII)(userCodeString)) {
|
|
1064
|
-
this.userCode = userCodeString;
|
|
1065
|
-
}
|
|
1066
|
-
else if (this.version === 1
|
|
1067
|
-
&& (0, safe_2.isPrintableASCIIWithWhitespace)(userCodeString)) {
|
|
1068
|
-
// Ignore leading and trailing whitespace in V1 reports if the rest is ASCII
|
|
1069
|
-
this.userCode = userCodeString.trim();
|
|
1070
|
-
}
|
|
1071
|
-
else {
|
|
1072
|
-
this.userCode = userCodeBuffer;
|
|
1073
|
-
}
|
|
1085
|
+
userCode = userCodeBuffer;
|
|
1074
1086
|
}
|
|
1075
1087
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1088
|
+
return new UserCodeCCReport_1({
|
|
1089
|
+
nodeId: ctx.sourceNodeId,
|
|
1090
|
+
userId,
|
|
1091
|
+
userIdStatus,
|
|
1092
|
+
userCode,
|
|
1093
|
+
});
|
|
1081
1094
|
}
|
|
1082
1095
|
userId;
|
|
1083
1096
|
userIdStatus;
|
|
1084
1097
|
userCode;
|
|
1085
|
-
persistValues(
|
|
1086
|
-
if (!super.persistValues(
|
|
1098
|
+
persistValues(ctx) {
|
|
1099
|
+
if (!super.persistValues(ctx))
|
|
1087
1100
|
return false;
|
|
1088
|
-
persistUserCode.call(this,
|
|
1101
|
+
persistUserCode.call(this, ctx, this.userId, this.userIdStatus, this.userCode);
|
|
1089
1102
|
return true;
|
|
1090
1103
|
}
|
|
1091
|
-
serialize() {
|
|
1104
|
+
serialize(ctx) {
|
|
1092
1105
|
let userCodeBuffer;
|
|
1093
1106
|
if (typeof this.userCode === "string") {
|
|
1094
1107
|
userCodeBuffer = Buffer.from(this.userCode, "ascii");
|
|
@@ -1100,11 +1113,11 @@ let UserCodeCCReport = class UserCodeCCReport extends UserCodeCC {
|
|
|
1100
1113
|
Buffer.from([this.userId, this.userIdStatus]),
|
|
1101
1114
|
userCodeBuffer,
|
|
1102
1115
|
]);
|
|
1103
|
-
return super.serialize();
|
|
1116
|
+
return super.serialize(ctx);
|
|
1104
1117
|
}
|
|
1105
|
-
toLogEntry(
|
|
1118
|
+
toLogEntry(ctx) {
|
|
1106
1119
|
return {
|
|
1107
|
-
...super.toLogEntry(
|
|
1120
|
+
...super.toLogEntry(ctx),
|
|
1108
1121
|
message: {
|
|
1109
1122
|
"user id": this.userId,
|
|
1110
1123
|
"id status": (0, safe_2.getEnumMemberName)(_Types_1.UserIDStatus, this.userIdStatus),
|
|
@@ -1118,66 +1131,71 @@ let UserCodeCCReport = class UserCodeCCReport extends UserCodeCC {
|
|
|
1118
1131
|
}
|
|
1119
1132
|
};
|
|
1120
1133
|
exports.UserCodeCCReport = UserCodeCCReport;
|
|
1121
|
-
exports.UserCodeCCReport = UserCodeCCReport = __decorate([
|
|
1134
|
+
exports.UserCodeCCReport = UserCodeCCReport = UserCodeCCReport_1 = __decorate([
|
|
1122
1135
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.Report)
|
|
1123
1136
|
], UserCodeCCReport);
|
|
1124
|
-
let UserCodeCCGet = class UserCodeCCGet extends UserCodeCC {
|
|
1125
|
-
constructor(
|
|
1126
|
-
super(
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1137
|
+
let UserCodeCCGet = UserCodeCCGet_1 = class UserCodeCCGet extends UserCodeCC {
|
|
1138
|
+
constructor(options) {
|
|
1139
|
+
super(options);
|
|
1140
|
+
this.userId = options.userId;
|
|
1141
|
+
}
|
|
1142
|
+
static from(raw, ctx) {
|
|
1143
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1);
|
|
1144
|
+
const userId = raw.payload[0];
|
|
1145
|
+
return new UserCodeCCGet_1({
|
|
1146
|
+
nodeId: ctx.sourceNodeId,
|
|
1147
|
+
userId,
|
|
1148
|
+
});
|
|
1134
1149
|
}
|
|
1135
1150
|
userId;
|
|
1136
|
-
serialize() {
|
|
1151
|
+
serialize(ctx) {
|
|
1137
1152
|
this.payload = Buffer.from([this.userId]);
|
|
1138
|
-
return super.serialize();
|
|
1153
|
+
return super.serialize(ctx);
|
|
1139
1154
|
}
|
|
1140
|
-
toLogEntry(
|
|
1155
|
+
toLogEntry(ctx) {
|
|
1141
1156
|
return {
|
|
1142
|
-
...super.toLogEntry(
|
|
1157
|
+
...super.toLogEntry(ctx),
|
|
1143
1158
|
message: { "user id": this.userId },
|
|
1144
1159
|
};
|
|
1145
1160
|
}
|
|
1146
1161
|
};
|
|
1147
1162
|
exports.UserCodeCCGet = UserCodeCCGet;
|
|
1148
|
-
exports.UserCodeCCGet = UserCodeCCGet = __decorate([
|
|
1163
|
+
exports.UserCodeCCGet = UserCodeCCGet = UserCodeCCGet_1 = __decorate([
|
|
1149
1164
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.Get),
|
|
1150
1165
|
(0, CommandClassDecorators_1.expectedCCResponse)(UserCodeCCReport)
|
|
1151
1166
|
], UserCodeCCGet);
|
|
1152
|
-
let UserCodeCCUsersNumberReport = class UserCodeCCUsersNumberReport extends UserCodeCC {
|
|
1153
|
-
constructor(
|
|
1154
|
-
super(
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
this.supportedUsers = this.payload[0];
|
|
1164
|
-
}
|
|
1167
|
+
let UserCodeCCUsersNumberReport = UserCodeCCUsersNumberReport_1 = class UserCodeCCUsersNumberReport extends UserCodeCC {
|
|
1168
|
+
constructor(options) {
|
|
1169
|
+
super(options);
|
|
1170
|
+
this.supportedUsers = options.supportedUsers;
|
|
1171
|
+
}
|
|
1172
|
+
static from(raw, ctx) {
|
|
1173
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1);
|
|
1174
|
+
let supportedUsers;
|
|
1175
|
+
if (raw.payload.length >= 3) {
|
|
1176
|
+
// V2+
|
|
1177
|
+
supportedUsers = raw.payload.readUInt16BE(1);
|
|
1165
1178
|
}
|
|
1166
1179
|
else {
|
|
1167
|
-
|
|
1180
|
+
// V1
|
|
1181
|
+
supportedUsers = raw.payload[0];
|
|
1168
1182
|
}
|
|
1183
|
+
return new UserCodeCCUsersNumberReport_1({
|
|
1184
|
+
nodeId: ctx.sourceNodeId,
|
|
1185
|
+
supportedUsers,
|
|
1186
|
+
});
|
|
1169
1187
|
}
|
|
1170
1188
|
supportedUsers;
|
|
1171
|
-
serialize() {
|
|
1189
|
+
serialize(ctx) {
|
|
1172
1190
|
this.payload = Buffer.allocUnsafe(3);
|
|
1173
1191
|
// If the node implements more than 255 users, this field MUST be set to 255
|
|
1174
1192
|
this.payload[0] = Math.min(255, this.supportedUsers);
|
|
1175
1193
|
this.payload.writeUInt16BE(this.supportedUsers, 1);
|
|
1176
|
-
return super.serialize();
|
|
1194
|
+
return super.serialize(ctx);
|
|
1177
1195
|
}
|
|
1178
|
-
toLogEntry(
|
|
1196
|
+
toLogEntry(ctx) {
|
|
1179
1197
|
return {
|
|
1180
|
-
...super.toLogEntry(
|
|
1198
|
+
...super.toLogEntry(ctx),
|
|
1181
1199
|
message: { "supported users": this.supportedUsers },
|
|
1182
1200
|
};
|
|
1183
1201
|
}
|
|
@@ -1186,7 +1204,7 @@ exports.UserCodeCCUsersNumberReport = UserCodeCCUsersNumberReport;
|
|
|
1186
1204
|
__decorate([
|
|
1187
1205
|
(0, CommandClassDecorators_1.ccValue)(exports.UserCodeCCValues.supportedUsers)
|
|
1188
1206
|
], UserCodeCCUsersNumberReport.prototype, "supportedUsers", void 0);
|
|
1189
|
-
exports.UserCodeCCUsersNumberReport = UserCodeCCUsersNumberReport = __decorate([
|
|
1207
|
+
exports.UserCodeCCUsersNumberReport = UserCodeCCUsersNumberReport = UserCodeCCUsersNumberReport_1 = __decorate([
|
|
1190
1208
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.UsersNumberReport)
|
|
1191
1209
|
], UserCodeCCUsersNumberReport);
|
|
1192
1210
|
let UserCodeCCUsersNumberGet = class UserCodeCCUsersNumberGet extends UserCodeCC {
|
|
@@ -1196,45 +1214,53 @@ exports.UserCodeCCUsersNumberGet = UserCodeCCUsersNumberGet = __decorate([
|
|
|
1196
1214
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.UsersNumberGet),
|
|
1197
1215
|
(0, CommandClassDecorators_1.expectedCCResponse)(UserCodeCCUsersNumberReport)
|
|
1198
1216
|
], UserCodeCCUsersNumberGet);
|
|
1199
|
-
let UserCodeCCCapabilitiesReport = class UserCodeCCCapabilitiesReport extends UserCodeCC {
|
|
1200
|
-
constructor(
|
|
1201
|
-
super(
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1217
|
+
let UserCodeCCCapabilitiesReport = UserCodeCCCapabilitiesReport_1 = class UserCodeCCCapabilitiesReport extends UserCodeCC {
|
|
1218
|
+
constructor(options) {
|
|
1219
|
+
super(options);
|
|
1220
|
+
this.supportsAdminCode = options.supportsAdminCode;
|
|
1221
|
+
this.supportsAdminCodeDeactivation =
|
|
1222
|
+
options.supportsAdminCodeDeactivation;
|
|
1223
|
+
this.supportsUserCodeChecksum = options.supportsUserCodeChecksum;
|
|
1224
|
+
this.supportsMultipleUserCodeReport =
|
|
1225
|
+
options.supportsMultipleUserCodeReport;
|
|
1226
|
+
this.supportsMultipleUserCodeSet = options.supportsMultipleUserCodeSet;
|
|
1227
|
+
this.supportedUserIDStatuses = options.supportedUserIDStatuses;
|
|
1228
|
+
this.supportedKeypadModes = options.supportedKeypadModes;
|
|
1229
|
+
this.supportedASCIIChars = options.supportedASCIIChars;
|
|
1230
|
+
}
|
|
1231
|
+
static from(raw, ctx) {
|
|
1232
|
+
let offset = 0;
|
|
1233
|
+
(0, safe_1.validatePayload)(raw.payload.length >= offset + 1);
|
|
1234
|
+
const supportsAdminCode = !!(raw.payload[offset] & 0b100_00000);
|
|
1235
|
+
const supportsAdminCodeDeactivation = !!(raw.payload[offset] & 0b010_00000);
|
|
1236
|
+
const statusBitMaskLength = raw.payload[offset] & 0b000_11111;
|
|
1237
|
+
offset += 1;
|
|
1238
|
+
(0, safe_1.validatePayload)(raw.payload.length >= offset + statusBitMaskLength + 1);
|
|
1239
|
+
const supportedUserIDStatuses = (0, safe_1.parseBitMask)(raw.payload.subarray(offset, offset + statusBitMaskLength), _Types_1.UserIDStatus.Available);
|
|
1240
|
+
offset += statusBitMaskLength;
|
|
1241
|
+
const supportsUserCodeChecksum = !!(raw.payload[offset] & 0b100_00000);
|
|
1242
|
+
const supportsMultipleUserCodeReport = !!(raw.payload[offset] & 0b010_00000);
|
|
1243
|
+
const supportsMultipleUserCodeSet = !!(raw.payload[offset] & 0b001_00000);
|
|
1244
|
+
const keypadModesBitMaskLength = raw.payload[offset] & 0b000_11111;
|
|
1245
|
+
offset += 1;
|
|
1246
|
+
(0, safe_1.validatePayload)(raw.payload.length >= offset + keypadModesBitMaskLength + 1);
|
|
1247
|
+
const supportedKeypadModes = (0, safe_1.parseBitMask)(raw.payload.subarray(offset, offset + keypadModesBitMaskLength), _Types_1.KeypadMode.Normal);
|
|
1248
|
+
offset += keypadModesBitMaskLength;
|
|
1249
|
+
const keysBitMaskLength = raw.payload[offset] & 0b000_11111;
|
|
1250
|
+
offset += 1;
|
|
1251
|
+
(0, safe_1.validatePayload)(raw.payload.length >= offset + keysBitMaskLength);
|
|
1252
|
+
const supportedASCIIChars = Buffer.from((0, safe_1.parseBitMask)(raw.payload.subarray(offset, offset + keysBitMaskLength), 0)).toString("ascii");
|
|
1253
|
+
return new UserCodeCCCapabilitiesReport_1({
|
|
1254
|
+
nodeId: ctx.sourceNodeId,
|
|
1255
|
+
supportsAdminCode,
|
|
1256
|
+
supportsAdminCodeDeactivation,
|
|
1257
|
+
supportedUserIDStatuses,
|
|
1258
|
+
supportsUserCodeChecksum,
|
|
1259
|
+
supportsMultipleUserCodeReport,
|
|
1260
|
+
supportsMultipleUserCodeSet,
|
|
1261
|
+
supportedKeypadModes,
|
|
1262
|
+
supportedASCIIChars,
|
|
1263
|
+
});
|
|
1238
1264
|
}
|
|
1239
1265
|
supportsAdminCode;
|
|
1240
1266
|
supportsAdminCodeDeactivation;
|
|
@@ -1244,7 +1270,7 @@ let UserCodeCCCapabilitiesReport = class UserCodeCCCapabilitiesReport extends Us
|
|
|
1244
1270
|
supportedUserIDStatuses;
|
|
1245
1271
|
supportedKeypadModes;
|
|
1246
1272
|
supportedASCIIChars;
|
|
1247
|
-
serialize() {
|
|
1273
|
+
serialize(ctx) {
|
|
1248
1274
|
const supportedStatusesBitmask = (0, safe_1.encodeBitMask)(this.supportedUserIDStatuses, undefined, _Types_1.UserIDStatus.Available);
|
|
1249
1275
|
const controlByte1 = (this.supportsAdminCode ? 0b100_00000 : 0)
|
|
1250
1276
|
| (this.supportsAdminCodeDeactivation ? 0b010_00000 : 0)
|
|
@@ -1265,11 +1291,11 @@ let UserCodeCCCapabilitiesReport = class UserCodeCCCapabilitiesReport extends Us
|
|
|
1265
1291
|
Buffer.from([controlByte3]),
|
|
1266
1292
|
supportedKeysBitmask,
|
|
1267
1293
|
]);
|
|
1268
|
-
return super.serialize();
|
|
1294
|
+
return super.serialize(ctx);
|
|
1269
1295
|
}
|
|
1270
|
-
toLogEntry(
|
|
1296
|
+
toLogEntry(ctx) {
|
|
1271
1297
|
return {
|
|
1272
|
-
...super.toLogEntry(
|
|
1298
|
+
...super.toLogEntry(ctx),
|
|
1273
1299
|
message: {
|
|
1274
1300
|
"supports admin code": this.supportsAdminCode,
|
|
1275
1301
|
"supports admin code deactivation": this.supportsAdminCodeDeactivation,
|
|
@@ -1312,7 +1338,7 @@ __decorate([
|
|
|
1312
1338
|
__decorate([
|
|
1313
1339
|
(0, CommandClassDecorators_1.ccValue)(exports.UserCodeCCValues.supportedASCIIChars)
|
|
1314
1340
|
], UserCodeCCCapabilitiesReport.prototype, "supportedASCIIChars", void 0);
|
|
1315
|
-
exports.UserCodeCCCapabilitiesReport = UserCodeCCCapabilitiesReport = __decorate([
|
|
1341
|
+
exports.UserCodeCCCapabilitiesReport = UserCodeCCCapabilitiesReport = UserCodeCCCapabilitiesReport_1 = __decorate([
|
|
1316
1342
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.CapabilitiesReport)
|
|
1317
1343
|
], UserCodeCCCapabilitiesReport);
|
|
1318
1344
|
let UserCodeCCCapabilitiesGet = class UserCodeCCCapabilitiesGet extends UserCodeCC {
|
|
@@ -1322,65 +1348,69 @@ exports.UserCodeCCCapabilitiesGet = UserCodeCCCapabilitiesGet = __decorate([
|
|
|
1322
1348
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.CapabilitiesGet),
|
|
1323
1349
|
(0, CommandClassDecorators_1.expectedCCResponse)(UserCodeCCCapabilitiesReport)
|
|
1324
1350
|
], UserCodeCCCapabilitiesGet);
|
|
1325
|
-
let UserCodeCCKeypadModeSet = class UserCodeCCKeypadModeSet extends UserCodeCC {
|
|
1326
|
-
constructor(
|
|
1327
|
-
super(
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1351
|
+
let UserCodeCCKeypadModeSet = UserCodeCCKeypadModeSet_1 = class UserCodeCCKeypadModeSet extends UserCodeCC {
|
|
1352
|
+
constructor(options) {
|
|
1353
|
+
super(options);
|
|
1354
|
+
this.keypadMode = options.keypadMode;
|
|
1355
|
+
}
|
|
1356
|
+
static from(raw, ctx) {
|
|
1357
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1);
|
|
1358
|
+
const keypadMode = raw.payload[0];
|
|
1359
|
+
return new UserCodeCCKeypadModeSet_1({
|
|
1360
|
+
nodeId: ctx.sourceNodeId,
|
|
1361
|
+
keypadMode,
|
|
1362
|
+
});
|
|
1335
1363
|
}
|
|
1336
1364
|
keypadMode;
|
|
1337
|
-
serialize() {
|
|
1365
|
+
serialize(ctx) {
|
|
1338
1366
|
this.payload = Buffer.from([this.keypadMode]);
|
|
1339
|
-
return super.serialize();
|
|
1367
|
+
return super.serialize(ctx);
|
|
1340
1368
|
}
|
|
1341
|
-
toLogEntry(
|
|
1369
|
+
toLogEntry(ctx) {
|
|
1342
1370
|
return {
|
|
1343
|
-
...super.toLogEntry(
|
|
1371
|
+
...super.toLogEntry(ctx),
|
|
1344
1372
|
message: { mode: (0, safe_2.getEnumMemberName)(_Types_1.KeypadMode, this.keypadMode) },
|
|
1345
1373
|
};
|
|
1346
1374
|
}
|
|
1347
1375
|
};
|
|
1348
1376
|
exports.UserCodeCCKeypadModeSet = UserCodeCCKeypadModeSet;
|
|
1349
|
-
exports.UserCodeCCKeypadModeSet = UserCodeCCKeypadModeSet = __decorate([
|
|
1377
|
+
exports.UserCodeCCKeypadModeSet = UserCodeCCKeypadModeSet = UserCodeCCKeypadModeSet_1 = __decorate([
|
|
1350
1378
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.KeypadModeSet),
|
|
1351
1379
|
(0, CommandClassDecorators_1.useSupervision)()
|
|
1352
1380
|
], UserCodeCCKeypadModeSet);
|
|
1353
|
-
let UserCodeCCKeypadModeReport = class UserCodeCCKeypadModeReport extends UserCodeCC {
|
|
1354
|
-
constructor(
|
|
1355
|
-
super(
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1381
|
+
let UserCodeCCKeypadModeReport = UserCodeCCKeypadModeReport_1 = class UserCodeCCKeypadModeReport extends UserCodeCC {
|
|
1382
|
+
constructor(options) {
|
|
1383
|
+
super(options);
|
|
1384
|
+
this.keypadMode = options.keypadMode;
|
|
1385
|
+
}
|
|
1386
|
+
static from(raw, ctx) {
|
|
1387
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1);
|
|
1388
|
+
const keypadMode = raw.payload[0];
|
|
1389
|
+
return new UserCodeCCKeypadModeReport_1({
|
|
1390
|
+
nodeId: ctx.sourceNodeId,
|
|
1391
|
+
keypadMode,
|
|
1392
|
+
});
|
|
1363
1393
|
}
|
|
1364
|
-
persistValues(
|
|
1365
|
-
if (!super.persistValues(
|
|
1394
|
+
persistValues(ctx) {
|
|
1395
|
+
if (!super.persistValues(ctx))
|
|
1366
1396
|
return false;
|
|
1367
1397
|
// Update the keypad modes metadata
|
|
1368
|
-
const supportedKeypadModes = this.getValue(
|
|
1398
|
+
const supportedKeypadModes = this.getValue(ctx, exports.UserCodeCCValues.supportedKeypadModes) ?? [this.keypadMode];
|
|
1369
1399
|
const keypadModeValue = exports.UserCodeCCValues.keypadMode;
|
|
1370
|
-
this.setMetadata(
|
|
1400
|
+
this.setMetadata(ctx, keypadModeValue, {
|
|
1371
1401
|
...keypadModeValue.meta,
|
|
1372
1402
|
states: (0, safe_1.enumValuesToMetadataStates)(_Types_1.KeypadMode, supportedKeypadModes),
|
|
1373
1403
|
});
|
|
1374
1404
|
return true;
|
|
1375
1405
|
}
|
|
1376
1406
|
keypadMode;
|
|
1377
|
-
serialize() {
|
|
1407
|
+
serialize(ctx) {
|
|
1378
1408
|
this.payload = Buffer.from([this.keypadMode]);
|
|
1379
|
-
return super.serialize();
|
|
1409
|
+
return super.serialize(ctx);
|
|
1380
1410
|
}
|
|
1381
|
-
toLogEntry(
|
|
1411
|
+
toLogEntry(ctx) {
|
|
1382
1412
|
return {
|
|
1383
|
-
...super.toLogEntry(
|
|
1413
|
+
...super.toLogEntry(ctx),
|
|
1384
1414
|
message: {
|
|
1385
1415
|
keypadMode: (0, safe_2.getEnumMemberName)(_Types_1.KeypadMode, this.keypadMode),
|
|
1386
1416
|
},
|
|
@@ -1391,7 +1421,7 @@ exports.UserCodeCCKeypadModeReport = UserCodeCCKeypadModeReport;
|
|
|
1391
1421
|
__decorate([
|
|
1392
1422
|
(0, CommandClassDecorators_1.ccValue)(exports.UserCodeCCValues.keypadMode)
|
|
1393
1423
|
], UserCodeCCKeypadModeReport.prototype, "keypadMode", void 0);
|
|
1394
|
-
exports.UserCodeCCKeypadModeReport = UserCodeCCKeypadModeReport = __decorate([
|
|
1424
|
+
exports.UserCodeCCKeypadModeReport = UserCodeCCKeypadModeReport = UserCodeCCKeypadModeReport_1 = __decorate([
|
|
1395
1425
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.KeypadModeReport)
|
|
1396
1426
|
], UserCodeCCKeypadModeReport);
|
|
1397
1427
|
let UserCodeCCKeypadModeGet = class UserCodeCCKeypadModeGet extends UserCodeCC {
|
|
@@ -1401,67 +1431,71 @@ exports.UserCodeCCKeypadModeGet = UserCodeCCKeypadModeGet = __decorate([
|
|
|
1401
1431
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.KeypadModeGet),
|
|
1402
1432
|
(0, CommandClassDecorators_1.expectedCCResponse)(UserCodeCCKeypadModeReport)
|
|
1403
1433
|
], UserCodeCCKeypadModeGet);
|
|
1404
|
-
let UserCodeCCAdminCodeSet = class UserCodeCCAdminCodeSet extends UserCodeCC {
|
|
1405
|
-
constructor(
|
|
1406
|
-
super(
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1434
|
+
let UserCodeCCAdminCodeSet = UserCodeCCAdminCodeSet_1 = class UserCodeCCAdminCodeSet extends UserCodeCC {
|
|
1435
|
+
constructor(options) {
|
|
1436
|
+
super(options);
|
|
1437
|
+
this.adminCode = options.adminCode;
|
|
1438
|
+
}
|
|
1439
|
+
static from(raw, ctx) {
|
|
1440
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1);
|
|
1441
|
+
const codeLength = raw.payload[0] & 0b1111;
|
|
1442
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1 + codeLength);
|
|
1443
|
+
const adminCode = raw.payload
|
|
1444
|
+
.subarray(1, 1 + codeLength)
|
|
1445
|
+
.toString("ascii");
|
|
1446
|
+
return new UserCodeCCAdminCodeSet_1({
|
|
1447
|
+
nodeId: ctx.sourceNodeId,
|
|
1448
|
+
adminCode,
|
|
1449
|
+
});
|
|
1418
1450
|
}
|
|
1419
1451
|
adminCode;
|
|
1420
|
-
serialize() {
|
|
1452
|
+
serialize(ctx) {
|
|
1421
1453
|
this.payload = Buffer.concat([
|
|
1422
1454
|
Buffer.from([this.adminCode.length & 0b1111]),
|
|
1423
1455
|
Buffer.from(this.adminCode, "ascii"),
|
|
1424
1456
|
]);
|
|
1425
|
-
return super.serialize();
|
|
1457
|
+
return super.serialize(ctx);
|
|
1426
1458
|
}
|
|
1427
|
-
toLogEntry(
|
|
1459
|
+
toLogEntry(ctx) {
|
|
1428
1460
|
return {
|
|
1429
|
-
...super.toLogEntry(
|
|
1461
|
+
...super.toLogEntry(ctx),
|
|
1430
1462
|
message: { "admin code": userCodeToLogString(this.adminCode) },
|
|
1431
1463
|
};
|
|
1432
1464
|
}
|
|
1433
1465
|
};
|
|
1434
1466
|
exports.UserCodeCCAdminCodeSet = UserCodeCCAdminCodeSet;
|
|
1435
|
-
exports.UserCodeCCAdminCodeSet = UserCodeCCAdminCodeSet = __decorate([
|
|
1467
|
+
exports.UserCodeCCAdminCodeSet = UserCodeCCAdminCodeSet = UserCodeCCAdminCodeSet_1 = __decorate([
|
|
1436
1468
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.AdminCodeSet),
|
|
1437
1469
|
(0, CommandClassDecorators_1.useSupervision)()
|
|
1438
1470
|
], UserCodeCCAdminCodeSet);
|
|
1439
|
-
let UserCodeCCAdminCodeReport = class UserCodeCCAdminCodeReport extends UserCodeCC {
|
|
1440
|
-
constructor(
|
|
1441
|
-
super(
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1471
|
+
let UserCodeCCAdminCodeReport = UserCodeCCAdminCodeReport_1 = class UserCodeCCAdminCodeReport extends UserCodeCC {
|
|
1472
|
+
constructor(options) {
|
|
1473
|
+
super(options);
|
|
1474
|
+
this.adminCode = options.adminCode;
|
|
1475
|
+
}
|
|
1476
|
+
static from(raw, ctx) {
|
|
1477
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1);
|
|
1478
|
+
const codeLength = raw.payload[0] & 0b1111;
|
|
1479
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1 + codeLength);
|
|
1480
|
+
const adminCode = raw.payload
|
|
1481
|
+
.subarray(1, 1 + codeLength)
|
|
1482
|
+
.toString("ascii");
|
|
1483
|
+
return new UserCodeCCAdminCodeReport_1({
|
|
1484
|
+
nodeId: ctx.sourceNodeId,
|
|
1485
|
+
adminCode,
|
|
1486
|
+
});
|
|
1453
1487
|
}
|
|
1454
1488
|
adminCode;
|
|
1455
|
-
serialize() {
|
|
1489
|
+
serialize(ctx) {
|
|
1456
1490
|
this.payload = Buffer.concat([
|
|
1457
1491
|
Buffer.from([this.adminCode.length & 0b1111]),
|
|
1458
1492
|
Buffer.from(this.adminCode, "ascii"),
|
|
1459
1493
|
]);
|
|
1460
|
-
return super.serialize();
|
|
1494
|
+
return super.serialize(ctx);
|
|
1461
1495
|
}
|
|
1462
|
-
toLogEntry(
|
|
1496
|
+
toLogEntry(ctx) {
|
|
1463
1497
|
return {
|
|
1464
|
-
...super.toLogEntry(
|
|
1498
|
+
...super.toLogEntry(ctx),
|
|
1465
1499
|
message: { "admin code": userCodeToLogString(this.adminCode) },
|
|
1466
1500
|
};
|
|
1467
1501
|
}
|
|
@@ -1470,7 +1504,7 @@ exports.UserCodeCCAdminCodeReport = UserCodeCCAdminCodeReport;
|
|
|
1470
1504
|
__decorate([
|
|
1471
1505
|
(0, CommandClassDecorators_1.ccValue)(exports.UserCodeCCValues.adminCode)
|
|
1472
1506
|
], UserCodeCCAdminCodeReport.prototype, "adminCode", void 0);
|
|
1473
|
-
exports.UserCodeCCAdminCodeReport = UserCodeCCAdminCodeReport = __decorate([
|
|
1507
|
+
exports.UserCodeCCAdminCodeReport = UserCodeCCAdminCodeReport = UserCodeCCAdminCodeReport_1 = __decorate([
|
|
1474
1508
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.AdminCodeReport)
|
|
1475
1509
|
], UserCodeCCAdminCodeReport);
|
|
1476
1510
|
let UserCodeCCAdminCodeGet = class UserCodeCCAdminCodeGet extends UserCodeCC {
|
|
@@ -1480,26 +1514,28 @@ exports.UserCodeCCAdminCodeGet = UserCodeCCAdminCodeGet = __decorate([
|
|
|
1480
1514
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.AdminCodeGet),
|
|
1481
1515
|
(0, CommandClassDecorators_1.expectedCCResponse)(UserCodeCCAdminCodeReport)
|
|
1482
1516
|
], UserCodeCCAdminCodeGet);
|
|
1483
|
-
let UserCodeCCUserCodeChecksumReport = class UserCodeCCUserCodeChecksumReport extends UserCodeCC {
|
|
1484
|
-
constructor(
|
|
1485
|
-
super(
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1517
|
+
let UserCodeCCUserCodeChecksumReport = UserCodeCCUserCodeChecksumReport_1 = class UserCodeCCUserCodeChecksumReport extends UserCodeCC {
|
|
1518
|
+
constructor(options) {
|
|
1519
|
+
super(options);
|
|
1520
|
+
this.userCodeChecksum = options.userCodeChecksum;
|
|
1521
|
+
}
|
|
1522
|
+
static from(raw, ctx) {
|
|
1523
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 2);
|
|
1524
|
+
const userCodeChecksum = raw.payload.readUInt16BE(0);
|
|
1525
|
+
return new UserCodeCCUserCodeChecksumReport_1({
|
|
1526
|
+
nodeId: ctx.sourceNodeId,
|
|
1527
|
+
userCodeChecksum,
|
|
1528
|
+
});
|
|
1493
1529
|
}
|
|
1494
1530
|
userCodeChecksum;
|
|
1495
|
-
serialize() {
|
|
1531
|
+
serialize(ctx) {
|
|
1496
1532
|
this.payload = Buffer.allocUnsafe(2);
|
|
1497
1533
|
this.payload.writeUInt16BE(this.userCodeChecksum, 0);
|
|
1498
|
-
return super.serialize();
|
|
1534
|
+
return super.serialize(ctx);
|
|
1499
1535
|
}
|
|
1500
|
-
toLogEntry(
|
|
1536
|
+
toLogEntry(ctx) {
|
|
1501
1537
|
return {
|
|
1502
|
-
...super.toLogEntry(
|
|
1538
|
+
...super.toLogEntry(ctx),
|
|
1503
1539
|
message: { "user code checksum": (0, safe_2.num2hex)(this.userCodeChecksum) },
|
|
1504
1540
|
};
|
|
1505
1541
|
}
|
|
@@ -1508,7 +1544,7 @@ exports.UserCodeCCUserCodeChecksumReport = UserCodeCCUserCodeChecksumReport;
|
|
|
1508
1544
|
__decorate([
|
|
1509
1545
|
(0, CommandClassDecorators_1.ccValue)(exports.UserCodeCCValues.userCodeChecksum)
|
|
1510
1546
|
], UserCodeCCUserCodeChecksumReport.prototype, "userCodeChecksum", void 0);
|
|
1511
|
-
exports.UserCodeCCUserCodeChecksumReport = UserCodeCCUserCodeChecksumReport = __decorate([
|
|
1547
|
+
exports.UserCodeCCUserCodeChecksumReport = UserCodeCCUserCodeChecksumReport = UserCodeCCUserCodeChecksumReport_1 = __decorate([
|
|
1512
1548
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.UserCodeChecksumReport)
|
|
1513
1549
|
], UserCodeCCUserCodeChecksumReport);
|
|
1514
1550
|
let UserCodeCCUserCodeChecksumGet = class UserCodeCCUserCodeChecksumGet extends UserCodeCC {
|
|
@@ -1519,18 +1555,19 @@ exports.UserCodeCCUserCodeChecksumGet = UserCodeCCUserCodeChecksumGet = __decora
|
|
|
1519
1555
|
(0, CommandClassDecorators_1.expectedCCResponse)(UserCodeCCUserCodeChecksumReport)
|
|
1520
1556
|
], UserCodeCCUserCodeChecksumGet);
|
|
1521
1557
|
let UserCodeCCExtendedUserCodeSet = class UserCodeCCExtendedUserCodeSet extends UserCodeCC {
|
|
1522
|
-
constructor(
|
|
1523
|
-
super(
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1558
|
+
constructor(options) {
|
|
1559
|
+
super(options);
|
|
1560
|
+
this.userCodes = options.userCodes;
|
|
1561
|
+
}
|
|
1562
|
+
static from(_raw, _ctx) {
|
|
1563
|
+
// TODO: Deserialize payload
|
|
1564
|
+
throw new safe_1.ZWaveError(`${this.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1565
|
+
// return new UserCodeCCExtendedUserCodeSet({
|
|
1566
|
+
// nodeId: ctx.sourceNodeId,
|
|
1567
|
+
// });
|
|
1531
1568
|
}
|
|
1532
1569
|
userCodes;
|
|
1533
|
-
serialize() {
|
|
1570
|
+
serialize(ctx) {
|
|
1534
1571
|
const userCodeBuffers = this.userCodes.map((code) => {
|
|
1535
1572
|
const ret = Buffer.concat([
|
|
1536
1573
|
Buffer.from([
|
|
@@ -1550,15 +1587,15 @@ let UserCodeCCExtendedUserCodeSet = class UserCodeCCExtendedUserCodeSet extends
|
|
|
1550
1587
|
Buffer.from([this.userCodes.length]),
|
|
1551
1588
|
...userCodeBuffers,
|
|
1552
1589
|
]);
|
|
1553
|
-
return super.serialize();
|
|
1590
|
+
return super.serialize(ctx);
|
|
1554
1591
|
}
|
|
1555
|
-
toLogEntry(
|
|
1592
|
+
toLogEntry(ctx) {
|
|
1556
1593
|
const message = {};
|
|
1557
1594
|
for (const { userId, userIdStatus, userCode } of this.userCodes) {
|
|
1558
1595
|
message[`code #${userId}`] = `${userCodeToLogString(userCode ?? "")} (status: ${(0, safe_2.getEnumMemberName)(_Types_1.UserIDStatus, userIdStatus)})`;
|
|
1559
1596
|
}
|
|
1560
1597
|
return {
|
|
1561
|
-
...super.toLogEntry(
|
|
1598
|
+
...super.toLogEntry(ctx),
|
|
1562
1599
|
message,
|
|
1563
1600
|
};
|
|
1564
1601
|
}
|
|
@@ -1568,71 +1605,81 @@ exports.UserCodeCCExtendedUserCodeSet = UserCodeCCExtendedUserCodeSet = __decora
|
|
|
1568
1605
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.ExtendedUserCodeSet),
|
|
1569
1606
|
(0, CommandClassDecorators_1.useSupervision)()
|
|
1570
1607
|
], UserCodeCCExtendedUserCodeSet);
|
|
1571
|
-
let UserCodeCCExtendedUserCodeReport = class UserCodeCCExtendedUserCodeReport extends UserCodeCC {
|
|
1572
|
-
constructor(
|
|
1573
|
-
super(
|
|
1574
|
-
|
|
1575
|
-
|
|
1608
|
+
let UserCodeCCExtendedUserCodeReport = UserCodeCCExtendedUserCodeReport_1 = class UserCodeCCExtendedUserCodeReport extends UserCodeCC {
|
|
1609
|
+
constructor(options) {
|
|
1610
|
+
super(options);
|
|
1611
|
+
// TODO: Check implementation:
|
|
1612
|
+
this.userCodes = options.userCodes;
|
|
1613
|
+
this.nextUserId = options.nextUserId;
|
|
1614
|
+
}
|
|
1615
|
+
static from(raw, ctx) {
|
|
1616
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1);
|
|
1617
|
+
const numCodes = raw.payload[0];
|
|
1576
1618
|
let offset = 1;
|
|
1577
1619
|
const userCodes = [];
|
|
1578
1620
|
// parse each user code
|
|
1579
1621
|
for (let i = 0; i < numCodes; i++) {
|
|
1580
|
-
const { code, bytesRead } = parseExtendedUserCode(
|
|
1622
|
+
const { code, bytesRead } = parseExtendedUserCode(raw.payload.subarray(offset));
|
|
1581
1623
|
userCodes.push(code);
|
|
1582
1624
|
offset += bytesRead;
|
|
1583
1625
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1626
|
+
(0, safe_1.validatePayload)(raw.payload.length >= offset + 2);
|
|
1627
|
+
const nextUserId = raw.payload.readUInt16BE(offset);
|
|
1628
|
+
return new UserCodeCCExtendedUserCodeReport_1({
|
|
1629
|
+
nodeId: ctx.sourceNodeId,
|
|
1630
|
+
userCodes,
|
|
1631
|
+
nextUserId,
|
|
1632
|
+
});
|
|
1587
1633
|
}
|
|
1588
|
-
persistValues(
|
|
1589
|
-
if (!super.persistValues(
|
|
1634
|
+
persistValues(ctx) {
|
|
1635
|
+
if (!super.persistValues(ctx))
|
|
1590
1636
|
return false;
|
|
1591
1637
|
for (const { userId, userIdStatus, userCode } of this.userCodes) {
|
|
1592
|
-
persistUserCode.call(this,
|
|
1638
|
+
persistUserCode.call(this, ctx, userId, userIdStatus, userCode);
|
|
1593
1639
|
}
|
|
1594
1640
|
return true;
|
|
1595
1641
|
}
|
|
1596
1642
|
userCodes;
|
|
1597
1643
|
nextUserId;
|
|
1598
|
-
toLogEntry(
|
|
1644
|
+
toLogEntry(ctx) {
|
|
1599
1645
|
const message = {};
|
|
1600
1646
|
for (const { userId, userIdStatus, userCode } of this.userCodes) {
|
|
1601
1647
|
message[`code #${userId}`] = `${userCodeToLogString(userCode)} (status: ${(0, safe_2.getEnumMemberName)(_Types_1.UserIDStatus, userIdStatus)})`;
|
|
1602
1648
|
}
|
|
1603
1649
|
message["next user id"] = this.nextUserId;
|
|
1604
1650
|
return {
|
|
1605
|
-
...super.toLogEntry(
|
|
1651
|
+
...super.toLogEntry(ctx),
|
|
1606
1652
|
message,
|
|
1607
1653
|
};
|
|
1608
1654
|
}
|
|
1609
1655
|
};
|
|
1610
1656
|
exports.UserCodeCCExtendedUserCodeReport = UserCodeCCExtendedUserCodeReport;
|
|
1611
|
-
exports.UserCodeCCExtendedUserCodeReport = UserCodeCCExtendedUserCodeReport = __decorate([
|
|
1657
|
+
exports.UserCodeCCExtendedUserCodeReport = UserCodeCCExtendedUserCodeReport = UserCodeCCExtendedUserCodeReport_1 = __decorate([
|
|
1612
1658
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.UserCodeCommand.ExtendedUserCodeReport)
|
|
1613
1659
|
], UserCodeCCExtendedUserCodeReport);
|
|
1614
1660
|
let UserCodeCCExtendedUserCodeGet = class UserCodeCCExtendedUserCodeGet extends UserCodeCC {
|
|
1615
|
-
constructor(
|
|
1616
|
-
super(
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1661
|
+
constructor(options) {
|
|
1662
|
+
super(options);
|
|
1663
|
+
this.userId = options.userId;
|
|
1664
|
+
this.reportMore = !!options.reportMore;
|
|
1665
|
+
}
|
|
1666
|
+
static from(_raw, _ctx) {
|
|
1667
|
+
// TODO: Deserialize payload
|
|
1668
|
+
throw new safe_1.ZWaveError(`${this.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1669
|
+
// return new UserCodeCCExtendedUserCodeGet({
|
|
1670
|
+
// nodeId: ctx.sourceNodeId,
|
|
1671
|
+
// });
|
|
1625
1672
|
}
|
|
1626
1673
|
userId;
|
|
1627
1674
|
reportMore;
|
|
1628
|
-
serialize() {
|
|
1675
|
+
serialize(ctx) {
|
|
1629
1676
|
this.payload = Buffer.from([0, 0, this.reportMore ? 1 : 0]);
|
|
1630
1677
|
this.payload.writeUInt16BE(this.userId, 0);
|
|
1631
|
-
return super.serialize();
|
|
1678
|
+
return super.serialize(ctx);
|
|
1632
1679
|
}
|
|
1633
|
-
toLogEntry(
|
|
1680
|
+
toLogEntry(ctx) {
|
|
1634
1681
|
return {
|
|
1635
|
-
...super.toLogEntry(
|
|
1682
|
+
...super.toLogEntry(ctx),
|
|
1636
1683
|
message: {
|
|
1637
1684
|
"user id": this.userId,
|
|
1638
1685
|
"report more": this.reportMore,
|