@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
|
@@ -5,6 +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 ColorSwitchCCSupportedReport_1, ColorSwitchCCReport_1, ColorSwitchCCGet_1, ColorSwitchCCSet_1, ColorSwitchCCStartLevelChange_1, ColorSwitchCCStopLevelChange_1;
|
|
8
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
10
|
exports.ColorSwitchCCStopLevelChange = exports.ColorSwitchCCStartLevelChange = exports.ColorSwitchCCSet = exports.ColorSwitchCCGet = exports.ColorSwitchCCReport = exports.ColorSwitchCCSupportedGet = exports.ColorSwitchCCSupportedReport = exports.ColorSwitchCC = exports.ColorSwitchCCAPI = exports.ColorSwitchCCValues = void 0;
|
|
10
11
|
function __assertType(argName, typeName, boundHasError) {
|
|
@@ -447,22 +448,22 @@ let ColorSwitchCCAPI = class ColorSwitchCCAPI extends API_1.CCAPI {
|
|
|
447
448
|
}
|
|
448
449
|
async getSupported() {
|
|
449
450
|
this.assertSupportsCommand(_Types_1.ColorSwitchCommand, _Types_1.ColorSwitchCommand.SupportedGet);
|
|
450
|
-
const cc = new ColorSwitchCCSupportedGet(
|
|
451
|
+
const cc = new ColorSwitchCCSupportedGet({
|
|
451
452
|
nodeId: this.endpoint.nodeId,
|
|
452
|
-
|
|
453
|
+
endpointIndex: this.endpoint.index,
|
|
453
454
|
});
|
|
454
|
-
const response = await this.
|
|
455
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
455
456
|
return response?.supportedColorComponents;
|
|
456
457
|
}
|
|
457
458
|
async get(component) {
|
|
458
459
|
__assertType("component", "ColorComponent", __assertType__ColorComponent.bind(void 0, component));
|
|
459
460
|
this.assertSupportsCommand(_Types_1.ColorSwitchCommand, _Types_1.ColorSwitchCommand.Get);
|
|
460
|
-
const cc = new ColorSwitchCCGet(
|
|
461
|
+
const cc = new ColorSwitchCCGet({
|
|
461
462
|
nodeId: this.endpoint.nodeId,
|
|
462
|
-
|
|
463
|
+
endpointIndex: this.endpoint.index,
|
|
463
464
|
colorComponent: component,
|
|
464
465
|
});
|
|
465
|
-
const response = await this.
|
|
466
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
466
467
|
if (response) {
|
|
467
468
|
return (0, safe_2.pick)(response, ["currentValue", "targetValue", "duration"]);
|
|
468
469
|
}
|
|
@@ -470,12 +471,12 @@ let ColorSwitchCCAPI = class ColorSwitchCCAPI extends API_1.CCAPI {
|
|
|
470
471
|
async set(options) {
|
|
471
472
|
__assertType("options", "ColorSwitchCCSetOptions", __assertType__ColorSwitchCCSetOptions.bind(void 0, options));
|
|
472
473
|
this.assertSupportsCommand(_Types_1.ColorSwitchCommand, _Types_1.ColorSwitchCommand.Set);
|
|
473
|
-
const cc = new ColorSwitchCCSet(
|
|
474
|
+
const cc = new ColorSwitchCCSet({
|
|
474
475
|
nodeId: this.endpoint.nodeId,
|
|
475
|
-
|
|
476
|
+
endpointIndex: this.endpoint.index,
|
|
476
477
|
...options,
|
|
477
478
|
});
|
|
478
|
-
const result = await this.
|
|
479
|
+
const result = await this.host.sendCommand(cc, this.commandOptions);
|
|
479
480
|
if ((0, core_1.isUnsupervisedOrSucceeded)(result)) {
|
|
480
481
|
// If the command did not fail, assume that it succeeded and update the values accordingly
|
|
481
482
|
// TODO: The API methods should not modify the value DB directly, but to do so
|
|
@@ -491,7 +492,7 @@ let ColorSwitchCCAPI = class ColorSwitchCCAPI extends API_1.CCAPI {
|
|
|
491
492
|
?.supportsCC(this.ccId));
|
|
492
493
|
// and optimistically update the currentColor
|
|
493
494
|
for (const node of affectedNodes) {
|
|
494
|
-
const valueDB = this.
|
|
495
|
+
const valueDB = this.host.tryGetValueDB(node.id);
|
|
495
496
|
if (valueDB) {
|
|
496
497
|
this.updateCurrentColor(valueDB, cc.colorTable);
|
|
497
498
|
}
|
|
@@ -540,22 +541,22 @@ let ColorSwitchCCAPI = class ColorSwitchCCAPI extends API_1.CCAPI {
|
|
|
540
541
|
async startLevelChange(options) {
|
|
541
542
|
__assertType("options", "ColorSwitchCCStartLevelChangeOptions", __assertType__ColorSwitchCCStartLevelChangeOptions.bind(void 0, options));
|
|
542
543
|
this.assertSupportsCommand(_Types_1.ColorSwitchCommand, _Types_1.ColorSwitchCommand.StartLevelChange);
|
|
543
|
-
const cc = new ColorSwitchCCStartLevelChange(
|
|
544
|
+
const cc = new ColorSwitchCCStartLevelChange({
|
|
544
545
|
nodeId: this.endpoint.nodeId,
|
|
545
|
-
|
|
546
|
+
endpointIndex: this.endpoint.index,
|
|
546
547
|
...options,
|
|
547
548
|
});
|
|
548
|
-
return this.
|
|
549
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
549
550
|
}
|
|
550
551
|
async stopLevelChange(colorComponent) {
|
|
551
552
|
__assertType("colorComponent", "ColorComponent", __assertType__ColorComponent.bind(void 0, colorComponent));
|
|
552
553
|
this.assertSupportsCommand(_Types_1.ColorSwitchCommand, _Types_1.ColorSwitchCommand.StopLevelChange);
|
|
553
|
-
const cc = new ColorSwitchCCStopLevelChange(
|
|
554
|
+
const cc = new ColorSwitchCCStopLevelChange({
|
|
554
555
|
nodeId: this.endpoint.nodeId,
|
|
555
|
-
|
|
556
|
+
endpointIndex: this.endpoint.index,
|
|
556
557
|
colorComponent,
|
|
557
558
|
});
|
|
558
|
-
return this.
|
|
559
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
559
560
|
}
|
|
560
561
|
get [API_1.SET_VALUE]() {
|
|
561
562
|
return async function ({ property, propertyKey }, value, options) {
|
|
@@ -655,32 +656,32 @@ exports.ColorSwitchCCAPI = ColorSwitchCCAPI = __decorate([
|
|
|
655
656
|
(0, CommandClassDecorators_1.API)(core_1.CommandClasses["Color Switch"])
|
|
656
657
|
], ColorSwitchCCAPI);
|
|
657
658
|
let ColorSwitchCC = class ColorSwitchCC extends CommandClass_1.CommandClass {
|
|
658
|
-
async interview(
|
|
659
|
-
const node = this.getNode(
|
|
660
|
-
const endpoint = this.getEndpoint(
|
|
661
|
-
const api = API_1.CCAPI.create(core_1.CommandClasses["Color Switch"],
|
|
659
|
+
async interview(ctx) {
|
|
660
|
+
const node = this.getNode(ctx);
|
|
661
|
+
const endpoint = this.getEndpoint(ctx);
|
|
662
|
+
const api = API_1.CCAPI.create(core_1.CommandClasses["Color Switch"], ctx, endpoint).withOptions({
|
|
662
663
|
priority: core_1.MessagePriority.NodeQuery,
|
|
663
664
|
});
|
|
664
|
-
|
|
665
|
+
ctx.logNode(node.id, {
|
|
665
666
|
endpoint: this.endpointIndex,
|
|
666
667
|
message: `Interviewing ${this.ccName}...`,
|
|
667
668
|
direction: "none",
|
|
668
669
|
});
|
|
669
|
-
|
|
670
|
+
ctx.logNode(node.id, {
|
|
670
671
|
endpoint: this.endpointIndex,
|
|
671
672
|
message: "querying supported colors...",
|
|
672
673
|
direction: "outbound",
|
|
673
674
|
});
|
|
674
675
|
const supportedColors = await api.getSupported();
|
|
675
676
|
if (!supportedColors) {
|
|
676
|
-
|
|
677
|
+
ctx.logNode(node.id, {
|
|
677
678
|
endpoint: this.endpointIndex,
|
|
678
679
|
message: "Querying supported colors timed out, skipping interview...",
|
|
679
680
|
level: "warn",
|
|
680
681
|
});
|
|
681
682
|
return;
|
|
682
683
|
}
|
|
683
|
-
|
|
684
|
+
ctx.logNode(node.id, {
|
|
684
685
|
endpoint: this.endpointIndex,
|
|
685
686
|
message: `received supported colors:${supportedColors
|
|
686
687
|
.map((c) => `\n· ${(0, safe_2.getEnumMemberName)(_Types_1.ColorComponent, c)}`)
|
|
@@ -691,46 +692,46 @@ let ColorSwitchCC = class ColorSwitchCC extends CommandClass_1.CommandClass {
|
|
|
691
692
|
for (const color of supportedColors) {
|
|
692
693
|
const currentColorChannelValue = exports.ColorSwitchCCValues
|
|
693
694
|
.currentColorChannel(color);
|
|
694
|
-
this.setMetadata(
|
|
695
|
+
this.setMetadata(ctx, currentColorChannelValue);
|
|
695
696
|
const targetColorChannelValue = exports.ColorSwitchCCValues
|
|
696
697
|
.targetColorChannel(color);
|
|
697
|
-
this.setMetadata(
|
|
698
|
+
this.setMetadata(ctx, targetColorChannelValue);
|
|
698
699
|
}
|
|
699
700
|
// And the compound one
|
|
700
701
|
const currentColorValue = exports.ColorSwitchCCValues.currentColor;
|
|
701
|
-
this.setMetadata(
|
|
702
|
+
this.setMetadata(ctx, currentColorValue);
|
|
702
703
|
const targetColorValue = exports.ColorSwitchCCValues.targetColor;
|
|
703
|
-
this.setMetadata(
|
|
704
|
+
this.setMetadata(ctx, targetColorValue);
|
|
704
705
|
// Create the collective HEX color values
|
|
705
706
|
const supportsHex = [
|
|
706
707
|
_Types_1.ColorComponent.Red,
|
|
707
708
|
_Types_1.ColorComponent.Green,
|
|
708
709
|
_Types_1.ColorComponent.Blue,
|
|
709
710
|
].every((c) => supportedColors.includes(c));
|
|
710
|
-
this.setValue(
|
|
711
|
+
this.setValue(ctx, exports.ColorSwitchCCValues.supportsHexColor, supportsHex);
|
|
711
712
|
if (supportsHex) {
|
|
712
713
|
const hexColorValue = exports.ColorSwitchCCValues.hexColor;
|
|
713
|
-
this.setMetadata(
|
|
714
|
+
this.setMetadata(ctx, hexColorValue);
|
|
714
715
|
}
|
|
715
716
|
// Query all color components
|
|
716
|
-
await this.refreshValues(
|
|
717
|
+
await this.refreshValues(ctx);
|
|
717
718
|
// Remember that the interview is complete
|
|
718
|
-
this.setInterviewComplete(
|
|
719
|
+
this.setInterviewComplete(ctx, true);
|
|
719
720
|
}
|
|
720
|
-
async refreshValues(
|
|
721
|
-
const node = this.getNode(
|
|
722
|
-
const endpoint = this.getEndpoint(
|
|
723
|
-
const api = API_1.CCAPI.create(core_1.CommandClasses["Color Switch"],
|
|
721
|
+
async refreshValues(ctx) {
|
|
722
|
+
const node = this.getNode(ctx);
|
|
723
|
+
const endpoint = this.getEndpoint(ctx);
|
|
724
|
+
const api = API_1.CCAPI.create(core_1.CommandClasses["Color Switch"], ctx, endpoint).withOptions({
|
|
724
725
|
priority: core_1.MessagePriority.NodeQuery,
|
|
725
726
|
});
|
|
726
|
-
const supportedColors = this.getValue(
|
|
727
|
+
const supportedColors = this.getValue(ctx, exports.ColorSwitchCCValues.supportedColorComponents) ?? [];
|
|
727
728
|
for (const color of supportedColors) {
|
|
728
729
|
// Some devices report invalid colors, but the CC API checks
|
|
729
730
|
// for valid values and throws otherwise.
|
|
730
731
|
if (!(0, safe_2.isEnumMember)(_Types_1.ColorComponent, color))
|
|
731
732
|
continue;
|
|
732
733
|
const colorName = (0, safe_2.getEnumMemberName)(_Types_1.ColorComponent, color);
|
|
733
|
-
|
|
734
|
+
ctx.logNode(node.id, {
|
|
734
735
|
endpoint: this.endpointIndex,
|
|
735
736
|
message: `querying current color state (${colorName})`,
|
|
736
737
|
direction: "outbound",
|
|
@@ -738,14 +739,14 @@ let ColorSwitchCC = class ColorSwitchCC extends CommandClass_1.CommandClass {
|
|
|
738
739
|
await api.get(color);
|
|
739
740
|
}
|
|
740
741
|
}
|
|
741
|
-
translatePropertyKey(
|
|
742
|
+
translatePropertyKey(ctx, property, propertyKey) {
|
|
742
743
|
if ((property === "currentColor" || property === "targetColor")
|
|
743
744
|
&& typeof propertyKey === "number") {
|
|
744
745
|
const translated = _Types_1.ColorComponent[propertyKey];
|
|
745
746
|
if (translated)
|
|
746
747
|
return translated;
|
|
747
748
|
}
|
|
748
|
-
return super.translatePropertyKey(
|
|
749
|
+
return super.translatePropertyKey(ctx, property, propertyKey);
|
|
749
750
|
}
|
|
750
751
|
};
|
|
751
752
|
exports.ColorSwitchCC = ColorSwitchCC;
|
|
@@ -754,27 +755,29 @@ exports.ColorSwitchCC = ColorSwitchCC = __decorate([
|
|
|
754
755
|
(0, CommandClassDecorators_1.implementedVersion)(3),
|
|
755
756
|
(0, CommandClassDecorators_1.ccValues)(exports.ColorSwitchCCValues)
|
|
756
757
|
], ColorSwitchCC);
|
|
757
|
-
let ColorSwitchCCSupportedReport = class ColorSwitchCCSupportedReport extends ColorSwitchCC {
|
|
758
|
-
constructor(
|
|
759
|
-
super(
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
758
|
+
let ColorSwitchCCSupportedReport = ColorSwitchCCSupportedReport_1 = class ColorSwitchCCSupportedReport extends ColorSwitchCC {
|
|
759
|
+
constructor(options) {
|
|
760
|
+
super(options);
|
|
761
|
+
this.supportedColorComponents = options.supportedColorComponents;
|
|
762
|
+
}
|
|
763
|
+
static from(raw, ctx) {
|
|
764
|
+
// Docs say 'variable length', but the table shows 2 bytes.
|
|
765
|
+
(0, core_1.validatePayload)(raw.payload.length >= 2);
|
|
766
|
+
const supportedColorComponents = (0, core_1.parseBitMask)(raw.payload.subarray(0, 2), _Types_1.ColorComponent["Warm White"]);
|
|
767
|
+
return new ColorSwitchCCSupportedReport_1({
|
|
768
|
+
nodeId: ctx.sourceNodeId,
|
|
769
|
+
supportedColorComponents,
|
|
770
|
+
});
|
|
768
771
|
}
|
|
769
772
|
supportedColorComponents;
|
|
770
|
-
serialize() {
|
|
773
|
+
serialize(ctx) {
|
|
771
774
|
this.payload = (0, safe_1.encodeBitMask)(this.supportedColorComponents, 15, // fixed 2 bytes
|
|
772
775
|
_Types_1.ColorComponent["Warm White"]);
|
|
773
|
-
return super.serialize();
|
|
776
|
+
return super.serialize(ctx);
|
|
774
777
|
}
|
|
775
|
-
toLogEntry(
|
|
778
|
+
toLogEntry(ctx) {
|
|
776
779
|
return {
|
|
777
|
-
...super.toLogEntry(
|
|
780
|
+
...super.toLogEntry(ctx),
|
|
778
781
|
message: {
|
|
779
782
|
"supported color components": this.supportedColorComponents
|
|
780
783
|
.map((c) => `\n· ${(0, safe_2.getEnumMemberName)(_Types_1.ColorComponent, c)}`)
|
|
@@ -787,7 +790,7 @@ exports.ColorSwitchCCSupportedReport = ColorSwitchCCSupportedReport;
|
|
|
787
790
|
__decorate([
|
|
788
791
|
(0, CommandClassDecorators_1.ccValue)(exports.ColorSwitchCCValues.supportedColorComponents)
|
|
789
792
|
], ColorSwitchCCSupportedReport.prototype, "supportedColorComponents", void 0);
|
|
790
|
-
exports.ColorSwitchCCSupportedReport = ColorSwitchCCSupportedReport = __decorate([
|
|
793
|
+
exports.ColorSwitchCCSupportedReport = ColorSwitchCCSupportedReport = ColorSwitchCCSupportedReport_1 = __decorate([
|
|
791
794
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.ColorSwitchCommand.SupportedReport)
|
|
792
795
|
], ColorSwitchCCSupportedReport);
|
|
793
796
|
let ColorSwitchCCSupportedGet = class ColorSwitchCCSupportedGet extends ColorSwitchCC {
|
|
@@ -797,59 +800,66 @@ exports.ColorSwitchCCSupportedGet = ColorSwitchCCSupportedGet = __decorate([
|
|
|
797
800
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.ColorSwitchCommand.SupportedGet),
|
|
798
801
|
(0, CommandClassDecorators_1.expectedCCResponse)(ColorSwitchCCSupportedReport)
|
|
799
802
|
], ColorSwitchCCSupportedGet);
|
|
800
|
-
let ColorSwitchCCReport = class ColorSwitchCCReport extends ColorSwitchCC {
|
|
801
|
-
constructor(
|
|
802
|
-
super(
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
}
|
|
803
|
+
let ColorSwitchCCReport = ColorSwitchCCReport_1 = class ColorSwitchCCReport extends ColorSwitchCC {
|
|
804
|
+
constructor(options) {
|
|
805
|
+
super(options);
|
|
806
|
+
this.colorComponent = options.colorComponent;
|
|
807
|
+
this.currentValue = options.currentValue;
|
|
808
|
+
this.targetValue = options.targetValue;
|
|
809
|
+
this.duration = core_1.Duration.from(options.duration);
|
|
810
|
+
}
|
|
811
|
+
static from(raw, ctx) {
|
|
812
|
+
(0, core_1.validatePayload)(raw.payload.length >= 2);
|
|
813
|
+
const colorComponent = raw.payload[0];
|
|
814
|
+
const currentValue = raw.payload[1];
|
|
815
|
+
let targetValue;
|
|
816
|
+
let duration;
|
|
817
|
+
if (raw.payload.length >= 4) {
|
|
818
|
+
targetValue = raw.payload[2];
|
|
819
|
+
duration = core_1.Duration.parseReport(raw.payload[3]);
|
|
820
|
+
}
|
|
821
|
+
return new ColorSwitchCCReport_1({
|
|
822
|
+
nodeId: ctx.sourceNodeId,
|
|
823
|
+
colorComponent,
|
|
824
|
+
currentValue,
|
|
825
|
+
targetValue,
|
|
826
|
+
duration,
|
|
827
|
+
});
|
|
818
828
|
}
|
|
819
|
-
persistValues(
|
|
829
|
+
persistValues(ctx) {
|
|
820
830
|
// Duration is stored globally instead of per component
|
|
821
|
-
if (!super.persistValues(
|
|
831
|
+
if (!super.persistValues(ctx))
|
|
822
832
|
return false;
|
|
823
833
|
// Update compound current value
|
|
824
834
|
const colorTableKey = colorComponentToTableKey(this.colorComponent);
|
|
825
835
|
if (colorTableKey) {
|
|
826
836
|
const compoundCurrentColorValue = exports.ColorSwitchCCValues.currentColor;
|
|
827
|
-
const compoundCurrentColor = this.getValue(
|
|
837
|
+
const compoundCurrentColor = this.getValue(ctx, compoundCurrentColorValue) ?? {};
|
|
828
838
|
compoundCurrentColor[colorTableKey] = this.currentValue;
|
|
829
|
-
this.setValue(
|
|
839
|
+
this.setValue(ctx, compoundCurrentColorValue, compoundCurrentColor);
|
|
830
840
|
// and target value
|
|
831
841
|
if (this.targetValue != undefined) {
|
|
832
842
|
const compoundTargetColorValue = exports.ColorSwitchCCValues.targetColor;
|
|
833
|
-
const compoundTargetColor = this.getValue(
|
|
843
|
+
const compoundTargetColor = this.getValue(ctx, compoundTargetColorValue) ?? {};
|
|
834
844
|
compoundTargetColor[colorTableKey] = this.targetValue;
|
|
835
|
-
this.setValue(
|
|
845
|
+
this.setValue(ctx, compoundTargetColorValue, compoundTargetColor);
|
|
836
846
|
}
|
|
837
847
|
}
|
|
838
848
|
// Update collective hex value if required
|
|
839
|
-
const supportsHex = !!this.getValue(
|
|
849
|
+
const supportsHex = !!this.getValue(ctx, exports.ColorSwitchCCValues.supportsHexColor);
|
|
840
850
|
if (supportsHex
|
|
841
851
|
&& (this.colorComponent === _Types_1.ColorComponent.Red
|
|
842
852
|
|| this.colorComponent === _Types_1.ColorComponent.Green
|
|
843
853
|
|| this.colorComponent === _Types_1.ColorComponent.Blue)) {
|
|
844
854
|
const hexColorValue = exports.ColorSwitchCCValues.hexColor;
|
|
845
|
-
const hexValue = this.getValue(
|
|
855
|
+
const hexValue = this.getValue(ctx, hexColorValue)
|
|
846
856
|
?? "000000";
|
|
847
857
|
const byteOffset = _Types_1.ColorComponent.Blue - this.colorComponent;
|
|
848
858
|
const byteMask = 0xff << (byteOffset * 8);
|
|
849
859
|
let hexValueNumeric = parseInt(hexValue, 16);
|
|
850
860
|
hexValueNumeric = (hexValueNumeric & ~byteMask)
|
|
851
861
|
| (this.currentValue << (byteOffset * 8));
|
|
852
|
-
this.setValue(
|
|
862
|
+
this.setValue(ctx, hexColorValue, hexValueNumeric.toString(16).padStart(6, "0"));
|
|
853
863
|
}
|
|
854
864
|
return true;
|
|
855
865
|
}
|
|
@@ -857,7 +867,7 @@ let ColorSwitchCCReport = class ColorSwitchCCReport extends ColorSwitchCC {
|
|
|
857
867
|
currentValue;
|
|
858
868
|
targetValue;
|
|
859
869
|
duration;
|
|
860
|
-
serialize() {
|
|
870
|
+
serialize(ctx) {
|
|
861
871
|
this.payload = Buffer.from([
|
|
862
872
|
this.colorComponent,
|
|
863
873
|
this.currentValue,
|
|
@@ -871,9 +881,9 @@ let ColorSwitchCCReport = class ColorSwitchCCReport extends ColorSwitchCC {
|
|
|
871
881
|
]),
|
|
872
882
|
]);
|
|
873
883
|
}
|
|
874
|
-
return super.serialize();
|
|
884
|
+
return super.serialize(ctx);
|
|
875
885
|
}
|
|
876
|
-
toLogEntry(
|
|
886
|
+
toLogEntry(ctx) {
|
|
877
887
|
const message = {
|
|
878
888
|
"color component": (0, safe_2.getEnumMemberName)(_Types_1.ColorComponent, this.colorComponent),
|
|
879
889
|
"current value": this.currentValue,
|
|
@@ -885,7 +895,7 @@ let ColorSwitchCCReport = class ColorSwitchCCReport extends ColorSwitchCC {
|
|
|
885
895
|
message.duration = this.duration.toString();
|
|
886
896
|
}
|
|
887
897
|
return {
|
|
888
|
-
...super.toLogEntry(
|
|
898
|
+
...super.toLogEntry(ctx),
|
|
889
899
|
message,
|
|
890
900
|
};
|
|
891
901
|
}
|
|
@@ -900,22 +910,24 @@ __decorate([
|
|
|
900
910
|
__decorate([
|
|
901
911
|
(0, CommandClassDecorators_1.ccValue)(exports.ColorSwitchCCValues.duration)
|
|
902
912
|
], ColorSwitchCCReport.prototype, "duration", void 0);
|
|
903
|
-
exports.ColorSwitchCCReport = ColorSwitchCCReport = __decorate([
|
|
913
|
+
exports.ColorSwitchCCReport = ColorSwitchCCReport = ColorSwitchCCReport_1 = __decorate([
|
|
904
914
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.ColorSwitchCommand.Report)
|
|
905
915
|
], ColorSwitchCCReport);
|
|
906
916
|
function testResponseForColorSwitchGet(sent, received) {
|
|
907
917
|
return sent.colorComponent === received.colorComponent;
|
|
908
918
|
}
|
|
909
|
-
let ColorSwitchCCGet = class ColorSwitchCCGet extends ColorSwitchCC {
|
|
910
|
-
constructor(
|
|
911
|
-
super(
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
+
let ColorSwitchCCGet = ColorSwitchCCGet_1 = class ColorSwitchCCGet extends ColorSwitchCC {
|
|
920
|
+
constructor(options) {
|
|
921
|
+
super(options);
|
|
922
|
+
this._colorComponent = options.colorComponent;
|
|
923
|
+
}
|
|
924
|
+
static from(raw, ctx) {
|
|
925
|
+
(0, core_1.validatePayload)(raw.payload.length >= 1);
|
|
926
|
+
const colorComponent = raw.payload[0];
|
|
927
|
+
return new ColorSwitchCCGet_1({
|
|
928
|
+
nodeId: ctx.sourceNodeId,
|
|
929
|
+
colorComponent,
|
|
930
|
+
});
|
|
919
931
|
}
|
|
920
932
|
_colorComponent;
|
|
921
933
|
get colorComponent() {
|
|
@@ -927,13 +939,13 @@ let ColorSwitchCCGet = class ColorSwitchCCGet extends ColorSwitchCC {
|
|
|
927
939
|
}
|
|
928
940
|
this._colorComponent = value;
|
|
929
941
|
}
|
|
930
|
-
serialize() {
|
|
942
|
+
serialize(ctx) {
|
|
931
943
|
this.payload = Buffer.from([this._colorComponent]);
|
|
932
|
-
return super.serialize();
|
|
944
|
+
return super.serialize(ctx);
|
|
933
945
|
}
|
|
934
|
-
toLogEntry(
|
|
946
|
+
toLogEntry(ctx) {
|
|
935
947
|
return {
|
|
936
|
-
...super.toLogEntry(
|
|
948
|
+
...super.toLogEntry(ctx),
|
|
937
949
|
message: {
|
|
938
950
|
"color component": (0, safe_2.getEnumMemberName)(_Types_1.ColorComponent, this.colorComponent),
|
|
939
951
|
},
|
|
@@ -941,54 +953,58 @@ let ColorSwitchCCGet = class ColorSwitchCCGet extends ColorSwitchCC {
|
|
|
941
953
|
}
|
|
942
954
|
};
|
|
943
955
|
exports.ColorSwitchCCGet = ColorSwitchCCGet;
|
|
944
|
-
exports.ColorSwitchCCGet = ColorSwitchCCGet = __decorate([
|
|
956
|
+
exports.ColorSwitchCCGet = ColorSwitchCCGet = ColorSwitchCCGet_1 = __decorate([
|
|
945
957
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.ColorSwitchCommand.Get),
|
|
946
958
|
(0, CommandClassDecorators_1.expectedCCResponse)(ColorSwitchCCReport, testResponseForColorSwitchGet)
|
|
947
959
|
], ColorSwitchCCGet);
|
|
948
|
-
let ColorSwitchCCSet = class ColorSwitchCCSet extends ColorSwitchCC {
|
|
949
|
-
constructor(
|
|
950
|
-
super(
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
const
|
|
954
|
-
(
|
|
955
|
-
|
|
956
|
-
let offset = 1;
|
|
957
|
-
for (let color = 0; color < populatedColorCount; color++) {
|
|
958
|
-
const component = this.payload[offset];
|
|
959
|
-
const value = this.payload[offset + 1];
|
|
960
|
-
const key = colorComponentToTableKey(component);
|
|
961
|
-
// @ts-expect-error
|
|
962
|
-
if (key)
|
|
963
|
-
this.colorTable[key] = value;
|
|
964
|
-
offset += 2;
|
|
965
|
-
}
|
|
966
|
-
if (this.payload.length > offset) {
|
|
967
|
-
this.duration = core_1.Duration.parseSet(this.payload[offset]);
|
|
960
|
+
let ColorSwitchCCSet = ColorSwitchCCSet_1 = class ColorSwitchCCSet extends ColorSwitchCC {
|
|
961
|
+
constructor(options) {
|
|
962
|
+
super(options);
|
|
963
|
+
// Populate properties from options object
|
|
964
|
+
if ("hexColor" in options) {
|
|
965
|
+
const match = hexColorRegex.exec(options.hexColor);
|
|
966
|
+
if (!match) {
|
|
967
|
+
throw new core_1.ZWaveError(`${options.hexColor} is not a valid HEX color string`, core_1.ZWaveErrorCodes.Argument_Invalid);
|
|
968
968
|
}
|
|
969
|
+
this.colorTable = {
|
|
970
|
+
red: parseInt(match.groups.red, 16),
|
|
971
|
+
green: parseInt(match.groups.green, 16),
|
|
972
|
+
blue: parseInt(match.groups.blue, 16),
|
|
973
|
+
};
|
|
969
974
|
}
|
|
970
975
|
else {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
976
|
+
this.colorTable = (0, safe_2.pick)(options, colorTableKeys);
|
|
977
|
+
}
|
|
978
|
+
this.duration = core_1.Duration.from(options.duration);
|
|
979
|
+
}
|
|
980
|
+
static from(raw, ctx) {
|
|
981
|
+
(0, core_1.validatePayload)(raw.payload.length >= 1);
|
|
982
|
+
const populatedColorCount = raw.payload[0] & 0b11111;
|
|
983
|
+
(0, core_1.validatePayload)(raw.payload.length >= 1 + populatedColorCount * 2);
|
|
984
|
+
const colorTable = {};
|
|
985
|
+
let offset = 1;
|
|
986
|
+
for (let color = 0; color < populatedColorCount; color++) {
|
|
987
|
+
const component = raw.payload[offset];
|
|
988
|
+
const value = raw.payload[offset + 1];
|
|
989
|
+
const key = colorComponentToTableKey(component);
|
|
990
|
+
// @ts-expect-error
|
|
991
|
+
if (key)
|
|
992
|
+
this.colorTable[key] = value;
|
|
993
|
+
offset += 2;
|
|
994
|
+
}
|
|
995
|
+
let duration;
|
|
996
|
+
if (raw.payload.length > offset) {
|
|
997
|
+
duration = core_1.Duration.parseSet(raw.payload[offset]);
|
|
998
|
+
}
|
|
999
|
+
return new ColorSwitchCCSet_1({
|
|
1000
|
+
nodeId: ctx.sourceNodeId,
|
|
1001
|
+
...colorTable,
|
|
1002
|
+
duration,
|
|
1003
|
+
});
|
|
988
1004
|
}
|
|
989
1005
|
colorTable;
|
|
990
1006
|
duration;
|
|
991
|
-
serialize() {
|
|
1007
|
+
serialize(ctx) {
|
|
992
1008
|
const populatedColorCount = Object.keys(this.colorTable).length;
|
|
993
1009
|
this.payload = Buffer.allocUnsafe(1 + populatedColorCount * 2 + 1);
|
|
994
1010
|
this.payload[0] = populatedColorCount & 0b11111;
|
|
@@ -1000,13 +1016,14 @@ let ColorSwitchCCSet = class ColorSwitchCCSet extends ColorSwitchCC {
|
|
|
1000
1016
|
i += 2;
|
|
1001
1017
|
}
|
|
1002
1018
|
this.payload[i] = (this.duration ?? core_1.Duration.default()).serializeSet();
|
|
1003
|
-
|
|
1019
|
+
const ccVersion = (0, CommandClass_1.getEffectiveCCVersion)(ctx, this);
|
|
1020
|
+
if (ccVersion < 2 && ctx.getDeviceConfig?.(this.nodeId)?.compat?.encodeCCsUsingTargetVersion) {
|
|
1004
1021
|
// When forcing CC version 1, omit the duration byte
|
|
1005
1022
|
this.payload = this.payload.subarray(0, -1);
|
|
1006
1023
|
}
|
|
1007
|
-
return super.serialize();
|
|
1024
|
+
return super.serialize(ctx);
|
|
1008
1025
|
}
|
|
1009
|
-
toLogEntry(
|
|
1026
|
+
toLogEntry(ctx) {
|
|
1010
1027
|
const message = {};
|
|
1011
1028
|
for (const [key, value] of Object.entries(this.colorTable)) {
|
|
1012
1029
|
const realKey = key in _Types_1.ColorComponentMap
|
|
@@ -1018,45 +1035,52 @@ let ColorSwitchCCSet = class ColorSwitchCCSet extends ColorSwitchCC {
|
|
|
1018
1035
|
message.duration = this.duration.toString();
|
|
1019
1036
|
}
|
|
1020
1037
|
return {
|
|
1021
|
-
...super.toLogEntry(
|
|
1038
|
+
...super.toLogEntry(ctx),
|
|
1022
1039
|
message,
|
|
1023
1040
|
};
|
|
1024
1041
|
}
|
|
1025
1042
|
};
|
|
1026
1043
|
exports.ColorSwitchCCSet = ColorSwitchCCSet;
|
|
1027
|
-
exports.ColorSwitchCCSet = ColorSwitchCCSet = __decorate([
|
|
1044
|
+
exports.ColorSwitchCCSet = ColorSwitchCCSet = ColorSwitchCCSet_1 = __decorate([
|
|
1028
1045
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.ColorSwitchCommand.Set),
|
|
1029
1046
|
(0, CommandClassDecorators_1.useSupervision)()
|
|
1030
1047
|
], ColorSwitchCCSet);
|
|
1031
|
-
let ColorSwitchCCStartLevelChange = class ColorSwitchCCStartLevelChange extends ColorSwitchCC {
|
|
1032
|
-
constructor(
|
|
1033
|
-
super(
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1048
|
+
let ColorSwitchCCStartLevelChange = ColorSwitchCCStartLevelChange_1 = class ColorSwitchCCStartLevelChange extends ColorSwitchCC {
|
|
1049
|
+
constructor(options) {
|
|
1050
|
+
super(options);
|
|
1051
|
+
this.duration = core_1.Duration.from(options.duration);
|
|
1052
|
+
this.ignoreStartLevel = options.ignoreStartLevel;
|
|
1053
|
+
this.startLevel = options.startLevel ?? 0;
|
|
1054
|
+
this.direction = options.direction;
|
|
1055
|
+
this.colorComponent = options.colorComponent;
|
|
1056
|
+
}
|
|
1057
|
+
static from(raw, ctx) {
|
|
1058
|
+
(0, core_1.validatePayload)(raw.payload.length >= 3);
|
|
1059
|
+
const ignoreStartLevel = !!((raw.payload[0] & 0b0_0_1_00000) >>> 5);
|
|
1060
|
+
const direction = ((raw.payload[0] & 0b0_1_0_00000) >>> 6)
|
|
1061
|
+
? "down"
|
|
1062
|
+
: "up";
|
|
1063
|
+
const colorComponent = raw.payload[1];
|
|
1064
|
+
const startLevel = raw.payload[2];
|
|
1065
|
+
let duration;
|
|
1066
|
+
if (raw.payload.length >= 4) {
|
|
1067
|
+
duration = core_1.Duration.parseSet(raw.payload[3]);
|
|
1068
|
+
}
|
|
1069
|
+
return new ColorSwitchCCStartLevelChange_1({
|
|
1070
|
+
nodeId: ctx.sourceNodeId,
|
|
1071
|
+
ignoreStartLevel,
|
|
1072
|
+
direction,
|
|
1073
|
+
colorComponent,
|
|
1074
|
+
startLevel,
|
|
1075
|
+
duration,
|
|
1076
|
+
});
|
|
1053
1077
|
}
|
|
1054
1078
|
duration;
|
|
1055
1079
|
startLevel;
|
|
1056
1080
|
ignoreStartLevel;
|
|
1057
1081
|
direction;
|
|
1058
1082
|
colorComponent;
|
|
1059
|
-
serialize() {
|
|
1083
|
+
serialize(ctx) {
|
|
1060
1084
|
const controlByte = (_Types_1.LevelChangeDirection[this.direction] << 6)
|
|
1061
1085
|
| (this.ignoreStartLevel ? 0b0010_0000 : 0);
|
|
1062
1086
|
this.payload = Buffer.from([
|
|
@@ -1065,13 +1089,14 @@ let ColorSwitchCCStartLevelChange = class ColorSwitchCCStartLevelChange extends
|
|
|
1065
1089
|
this.startLevel,
|
|
1066
1090
|
(this.duration ?? core_1.Duration.default()).serializeSet(),
|
|
1067
1091
|
]);
|
|
1068
|
-
|
|
1092
|
+
const ccVersion = (0, CommandClass_1.getEffectiveCCVersion)(ctx, this);
|
|
1093
|
+
if (ccVersion < 3 && ctx.getDeviceConfig?.(this.nodeId)?.compat?.encodeCCsUsingTargetVersion) {
|
|
1069
1094
|
// When forcing CC version 1 or 2, omit the duration byte
|
|
1070
1095
|
this.payload = this.payload.subarray(0, -1);
|
|
1071
1096
|
}
|
|
1072
|
-
return super.serialize();
|
|
1097
|
+
return super.serialize(ctx);
|
|
1073
1098
|
}
|
|
1074
|
-
toLogEntry(
|
|
1099
|
+
toLogEntry(ctx) {
|
|
1075
1100
|
const message = {
|
|
1076
1101
|
"color component": (0, safe_2.getEnumMemberName)(_Types_1.ColorComponent, this.colorComponent),
|
|
1077
1102
|
"start level": `${this.startLevel}${this.ignoreStartLevel ? " (ignored)" : ""}`,
|
|
@@ -1081,35 +1106,37 @@ let ColorSwitchCCStartLevelChange = class ColorSwitchCCStartLevelChange extends
|
|
|
1081
1106
|
message.duration = this.duration.toString();
|
|
1082
1107
|
}
|
|
1083
1108
|
return {
|
|
1084
|
-
...super.toLogEntry(
|
|
1109
|
+
...super.toLogEntry(ctx),
|
|
1085
1110
|
message,
|
|
1086
1111
|
};
|
|
1087
1112
|
}
|
|
1088
1113
|
};
|
|
1089
1114
|
exports.ColorSwitchCCStartLevelChange = ColorSwitchCCStartLevelChange;
|
|
1090
|
-
exports.ColorSwitchCCStartLevelChange = ColorSwitchCCStartLevelChange = __decorate([
|
|
1115
|
+
exports.ColorSwitchCCStartLevelChange = ColorSwitchCCStartLevelChange = ColorSwitchCCStartLevelChange_1 = __decorate([
|
|
1091
1116
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.ColorSwitchCommand.StartLevelChange),
|
|
1092
1117
|
(0, CommandClassDecorators_1.useSupervision)()
|
|
1093
1118
|
], ColorSwitchCCStartLevelChange);
|
|
1094
|
-
let ColorSwitchCCStopLevelChange = class ColorSwitchCCStopLevelChange extends ColorSwitchCC {
|
|
1095
|
-
constructor(
|
|
1096
|
-
super(
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1119
|
+
let ColorSwitchCCStopLevelChange = ColorSwitchCCStopLevelChange_1 = class ColorSwitchCCStopLevelChange extends ColorSwitchCC {
|
|
1120
|
+
constructor(options) {
|
|
1121
|
+
super(options);
|
|
1122
|
+
this.colorComponent = options.colorComponent;
|
|
1123
|
+
}
|
|
1124
|
+
static from(raw, ctx) {
|
|
1125
|
+
(0, core_1.validatePayload)(raw.payload.length >= 1);
|
|
1126
|
+
const colorComponent = raw.payload[0];
|
|
1127
|
+
return new ColorSwitchCCStopLevelChange_1({
|
|
1128
|
+
nodeId: ctx.sourceNodeId,
|
|
1129
|
+
colorComponent,
|
|
1130
|
+
});
|
|
1104
1131
|
}
|
|
1105
1132
|
colorComponent;
|
|
1106
|
-
serialize() {
|
|
1133
|
+
serialize(ctx) {
|
|
1107
1134
|
this.payload = Buffer.from([this.colorComponent]);
|
|
1108
|
-
return super.serialize();
|
|
1135
|
+
return super.serialize(ctx);
|
|
1109
1136
|
}
|
|
1110
|
-
toLogEntry(
|
|
1137
|
+
toLogEntry(ctx) {
|
|
1111
1138
|
return {
|
|
1112
|
-
...super.toLogEntry(
|
|
1139
|
+
...super.toLogEntry(ctx),
|
|
1113
1140
|
message: {
|
|
1114
1141
|
"color component": (0, safe_2.getEnumMemberName)(_Types_1.ColorComponent, this.colorComponent),
|
|
1115
1142
|
},
|
|
@@ -1117,7 +1144,7 @@ let ColorSwitchCCStopLevelChange = class ColorSwitchCCStopLevelChange extends Co
|
|
|
1117
1144
|
}
|
|
1118
1145
|
};
|
|
1119
1146
|
exports.ColorSwitchCCStopLevelChange = ColorSwitchCCStopLevelChange;
|
|
1120
|
-
exports.ColorSwitchCCStopLevelChange = ColorSwitchCCStopLevelChange = __decorate([
|
|
1147
|
+
exports.ColorSwitchCCStopLevelChange = ColorSwitchCCStopLevelChange = ColorSwitchCCStopLevelChange_1 = __decorate([
|
|
1121
1148
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.ColorSwitchCommand.StopLevelChange),
|
|
1122
1149
|
(0, CommandClassDecorators_1.useSupervision)()
|
|
1123
1150
|
], ColorSwitchCCStopLevelChange);
|