@zwave-js/cc 9.3.1-0-pr-4662-79458fb
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 +54 -0
- package/build/cc/AlarmSensorCC.d.ts.map +1 -0
- package/build/cc/AlarmSensorCC.js +378 -0
- package/build/cc/AlarmSensorCC.js.map +1 -0
- package/build/cc/AssociationCC.d.ts +123 -0
- package/build/cc/AssociationCC.d.ts.map +1 -0
- package/build/cc/AssociationCC.js +615 -0
- package/build/cc/AssociationCC.js.map +1 -0
- package/build/cc/AssociationGroupInfoCC.d.ts +97 -0
- package/build/cc/AssociationGroupInfoCC.d.ts.map +1 -0
- package/build/cc/AssociationGroupInfoCC.js +530 -0
- package/build/cc/AssociationGroupInfoCC.js.map +1 -0
- package/build/cc/BarrierOperatorCC.d.ts +75 -0
- package/build/cc/BarrierOperatorCC.d.ts.map +1 -0
- package/build/cc/BarrierOperatorCC.js +492 -0
- package/build/cc/BarrierOperatorCC.js.map +1 -0
- package/build/cc/BasicCC.d.ts +51 -0
- package/build/cc/BasicCC.d.ts.map +1 -0
- package/build/cc/BasicCC.js +344 -0
- package/build/cc/BasicCC.js.map +1 -0
- package/build/cc/BatteryCC.d.ts +56 -0
- package/build/cc/BatteryCC.d.ts.map +1 -0
- package/build/cc/BatteryCC.js +417 -0
- package/build/cc/BatteryCC.js.map +1 -0
- package/build/cc/BinarySensorCC.d.ts +52 -0
- package/build/cc/BinarySensorCC.d.ts.map +1 -0
- package/build/cc/BinarySensorCC.js +321 -0
- package/build/cc/BinarySensorCC.js.map +1 -0
- package/build/cc/BinarySwitchCC.d.ts +55 -0
- package/build/cc/BinarySwitchCC.d.ts.map +1 -0
- package/build/cc/BinarySwitchCC.js +327 -0
- package/build/cc/BinarySwitchCC.js.map +1 -0
- package/build/cc/CRC16CC.d.ts +28 -0
- package/build/cc/CRC16CC.d.ts.map +1 -0
- package/build/cc/CRC16CC.js +109 -0
- package/build/cc/CRC16CC.js.map +1 -0
- package/build/cc/CentralSceneCC.d.ts +69 -0
- package/build/cc/CentralSceneCC.d.ts.map +1 -0
- package/build/cc/CentralSceneCC.js +443 -0
- package/build/cc/CentralSceneCC.js.map +1 -0
- package/build/cc/ClimateControlScheduleCC.d.ts +78 -0
- package/build/cc/ClimateControlScheduleCC.d.ts.map +1 -0
- package/build/cc/ClimateControlScheduleCC.js +417 -0
- package/build/cc/ClimateControlScheduleCC.js.map +1 -0
- package/build/cc/ClockCC.d.ts +40 -0
- package/build/cc/ClockCC.d.ts.map +1 -0
- package/build/cc/ClockCC.js +185 -0
- package/build/cc/ClockCC.js.map +1 -0
- package/build/cc/ColorSwitchCC.d.ts +98 -0
- package/build/cc/ColorSwitchCC.d.ts.map +1 -0
- package/build/cc/ColorSwitchCC.js +1045 -0
- package/build/cc/ColorSwitchCC.js.map +1 -0
- package/build/cc/ConfigurationCC.d.ts +315 -0
- package/build/cc/ConfigurationCC.d.ts.map +1 -0
- package/build/cc/ConfigurationCC.js +2257 -0
- package/build/cc/ConfigurationCC.js.map +1 -0
- package/build/cc/DeviceResetLocallyCC.d.ts +9 -0
- package/build/cc/DeviceResetLocallyCC.d.ts.map +1 -0
- package/build/cc/DeviceResetLocallyCC.js +28 -0
- package/build/cc/DeviceResetLocallyCC.js.map +1 -0
- package/build/cc/DoorLockCC.d.ts +116 -0
- package/build/cc/DoorLockCC.d.ts.map +1 -0
- package/build/cc/DoorLockCC.js +1112 -0
- package/build/cc/DoorLockCC.js.map +1 -0
- package/build/cc/DoorLockLoggingCC.d.ts +41 -0
- package/build/cc/DoorLockLoggingCC.d.ts.map +1 -0
- package/build/cc/DoorLockLoggingCC.js +288 -0
- package/build/cc/DoorLockLoggingCC.js.map +1 -0
- package/build/cc/EntryControlCC.d.ts +71 -0
- package/build/cc/EntryControlCC.d.ts.map +1 -0
- package/build/cc/EntryControlCC.js +492 -0
- package/build/cc/EntryControlCC.js.map +1 -0
- package/build/cc/FirmwareUpdateMetaDataCC.d.ts +148 -0
- package/build/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -0
- package/build/cc/FirmwareUpdateMetaDataCC.js +727 -0
- package/build/cc/FirmwareUpdateMetaDataCC.js.map +1 -0
- package/build/cc/HailCC.d.ts +6 -0
- package/build/cc/HailCC.d.ts.map +1 -0
- package/build/cc/HailCC.js +23 -0
- package/build/cc/HailCC.js.map +1 -0
- package/build/cc/HumidityControlModeCC.d.ts +47 -0
- package/build/cc/HumidityControlModeCC.d.ts.map +1 -0
- package/build/cc/HumidityControlModeCC.js +288 -0
- package/build/cc/HumidityControlModeCC.js.map +1 -0
- package/build/cc/HumidityControlOperatingStateCC.d.ts +24 -0
- package/build/cc/HumidityControlOperatingStateCC.d.ts.map +1 -0
- package/build/cc/HumidityControlOperatingStateCC.js +129 -0
- package/build/cc/HumidityControlOperatingStateCC.js.map +1 -0
- package/build/cc/HumidityControlSetpointCC.d.ts +103 -0
- package/build/cc/HumidityControlSetpointCC.d.ts.map +1 -0
- package/build/cc/HumidityControlSetpointCC.js +626 -0
- package/build/cc/HumidityControlSetpointCC.js.map +1 -0
- package/build/cc/IndicatorCC.d.ts +88 -0
- package/build/cc/IndicatorCC.d.ts.map +1 -0
- package/build/cc/IndicatorCC.js +758 -0
- package/build/cc/IndicatorCC.js.map +1 -0
- package/build/cc/IrrigationCC.d.ts +278 -0
- package/build/cc/IrrigationCC.d.ts.map +1 -0
- package/build/cc/IrrigationCC.js +2062 -0
- package/build/cc/IrrigationCC.js.map +1 -0
- package/build/cc/LanguageCC.d.ts +41 -0
- package/build/cc/LanguageCC.d.ts.map +1 -0
- package/build/cc/LanguageCC.js +220 -0
- package/build/cc/LanguageCC.js.map +1 -0
- package/build/cc/LockCC.d.ts +41 -0
- package/build/cc/LockCC.d.ts.map +1 -0
- package/build/cc/LockCC.js +185 -0
- package/build/cc/LockCC.js.map +1 -0
- package/build/cc/ManufacturerProprietaryCC.d.ts +31 -0
- package/build/cc/ManufacturerProprietaryCC.d.ts.map +1 -0
- package/build/cc/ManufacturerProprietaryCC.js +275 -0
- package/build/cc/ManufacturerProprietaryCC.js.map +1 -0
- package/build/cc/ManufacturerSpecificCC.d.ts +59 -0
- package/build/cc/ManufacturerSpecificCC.d.ts.map +1 -0
- package/build/cc/ManufacturerSpecificCC.js +285 -0
- package/build/cc/ManufacturerSpecificCC.js.map +1 -0
- package/build/cc/MeterCC.d.ts +100 -0
- package/build/cc/MeterCC.d.ts.map +1 -0
- package/build/cc/MeterCC.js +820 -0
- package/build/cc/MeterCC.js.map +1 -0
- package/build/cc/MultiChannelAssociationCC.d.ts +127 -0
- package/build/cc/MultiChannelAssociationCC.d.ts.map +1 -0
- package/build/cc/MultiChannelAssociationCC.js +883 -0
- package/build/cc/MultiChannelAssociationCC.js.map +1 -0
- package/build/cc/MultiChannelCC.d.ts +164 -0
- package/build/cc/MultiChannelCC.d.ts.map +1 -0
- package/build/cc/MultiChannelCC.js +1004 -0
- package/build/cc/MultiChannelCC.js.map +1 -0
- package/build/cc/MultiCommandCC.d.ts +28 -0
- package/build/cc/MultiCommandCC.d.ts.map +1 -0
- package/build/cc/MultiCommandCC.js +137 -0
- package/build/cc/MultiCommandCC.js.map +1 -0
- package/build/cc/MultilevelSensorCC.d.ts +83 -0
- package/build/cc/MultilevelSensorCC.d.ts.map +1 -0
- package/build/cc/MultilevelSensorCC.js +633 -0
- package/build/cc/MultilevelSensorCC.js.map +1 -0
- package/build/cc/MultilevelSwitchCC.d.ts +86 -0
- package/build/cc/MultilevelSwitchCC.d.ts.map +1 -0
- package/build/cc/MultilevelSwitchCC.js +774 -0
- package/build/cc/MultilevelSwitchCC.js.map +1 -0
- package/build/cc/NoOperationCC.d.ts +17 -0
- package/build/cc/NoOperationCC.d.ts.map +1 -0
- package/build/cc/NoOperationCC.js +50 -0
- package/build/cc/NoOperationCC.js.map +1 -0
- package/build/cc/NodeNamingCC.d.ts +57 -0
- package/build/cc/NodeNamingCC.d.ts.map +1 -0
- package/build/cc/NodeNamingCC.js +313 -0
- package/build/cc/NodeNamingCC.js.map +1 -0
- package/build/cc/NotificationCC.d.ts +127 -0
- package/build/cc/NotificationCC.d.ts.map +1 -0
- package/build/cc/NotificationCC.js +1193 -0
- package/build/cc/NotificationCC.js.map +1 -0
- package/build/cc/PowerlevelCC.d.ts +63 -0
- package/build/cc/PowerlevelCC.d.ts.map +1 -0
- package/build/cc/PowerlevelCC.js +262 -0
- package/build/cc/PowerlevelCC.js.map +1 -0
- package/build/cc/ProtectionCC.d.ts +94 -0
- package/build/cc/ProtectionCC.d.ts.map +1 -0
- package/build/cc/ProtectionCC.js +630 -0
- package/build/cc/ProtectionCC.js.map +1 -0
- package/build/cc/SceneActivationCC.d.ts +34 -0
- package/build/cc/SceneActivationCC.d.ts.map +1 -0
- package/build/cc/SceneActivationCC.js +170 -0
- package/build/cc/SceneActivationCC.js.map +1 -0
- package/build/cc/SceneActuatorConfigurationCC.d.ts +52 -0
- package/build/cc/SceneActuatorConfigurationCC.d.ts.map +1 -0
- package/build/cc/SceneActuatorConfigurationCC.js +368 -0
- package/build/cc/SceneActuatorConfigurationCC.js.map +1 -0
- package/build/cc/SceneControllerConfigurationCC.d.ts +61 -0
- package/build/cc/SceneControllerConfigurationCC.d.ts.map +1 -0
- package/build/cc/SceneControllerConfigurationCC.js +444 -0
- package/build/cc/SceneControllerConfigurationCC.js.map +1 -0
- package/build/cc/Security2CC.d.ts +213 -0
- package/build/cc/Security2CC.d.ts.map +1 -0
- package/build/cc/Security2CC.js +1124 -0
- package/build/cc/Security2CC.js.map +1 -0
- package/build/cc/SecurityCC.d.ts +109 -0
- package/build/cc/SecurityCC.d.ts.map +1 -0
- package/build/cc/SecurityCC.js +609 -0
- package/build/cc/SecurityCC.js.map +1 -0
- package/build/cc/SoundSwitchCC.d.ts +87 -0
- package/build/cc/SoundSwitchCC.d.ts.map +1 -0
- package/build/cc/SoundSwitchCC.js +548 -0
- package/build/cc/SoundSwitchCC.js.map +1 -0
- package/build/cc/SupervisionCC.d.ts +63 -0
- package/build/cc/SupervisionCC.d.ts.map +1 -0
- package/build/cc/SupervisionCC.js +239 -0
- package/build/cc/SupervisionCC.js.map +1 -0
- package/build/cc/ThermostatFanModeCC.d.ts +53 -0
- package/build/cc/ThermostatFanModeCC.d.ts.map +1 -0
- package/build/cc/ThermostatFanModeCC.js +359 -0
- package/build/cc/ThermostatFanModeCC.js.map +1 -0
- package/build/cc/ThermostatFanStateCC.d.ts +24 -0
- package/build/cc/ThermostatFanStateCC.d.ts.map +1 -0
- package/build/cc/ThermostatFanStateCC.js +131 -0
- package/build/cc/ThermostatFanStateCC.js.map +1 -0
- package/build/cc/ThermostatModeCC.d.ts +58 -0
- package/build/cc/ThermostatModeCC.d.ts.map +1 -0
- package/build/cc/ThermostatModeCC.js +370 -0
- package/build/cc/ThermostatModeCC.js.map +1 -0
- package/build/cc/ThermostatOperatingStateCC.d.ts +24 -0
- package/build/cc/ThermostatOperatingStateCC.d.ts.map +1 -0
- package/build/cc/ThermostatOperatingStateCC.js +127 -0
- package/build/cc/ThermostatOperatingStateCC.js.map +1 -0
- package/build/cc/ThermostatSetbackCC.d.ts +42 -0
- package/build/cc/ThermostatSetbackCC.d.ts.map +1 -0
- package/build/cc/ThermostatSetbackCC.js +237 -0
- package/build/cc/ThermostatSetbackCC.js.map +1 -0
- package/build/cc/ThermostatSetpointCC.d.ts +98 -0
- package/build/cc/ThermostatSetpointCC.d.ts.map +1 -0
- package/build/cc/ThermostatSetpointCC.js +707 -0
- package/build/cc/ThermostatSetpointCC.js.map +1 -0
- package/build/cc/TimeCC.d.ts +78 -0
- package/build/cc/TimeCC.d.ts.map +1 -0
- package/build/cc/TimeCC.js +373 -0
- package/build/cc/TimeCC.js.map +1 -0
- package/build/cc/TimeParametersCC.d.ts +40 -0
- package/build/cc/TimeParametersCC.d.ts.map +1 -0
- package/build/cc/TimeParametersCC.js +275 -0
- package/build/cc/TimeParametersCC.js.map +1 -0
- package/build/cc/TransportServiceCC.d.ts +101 -0
- package/build/cc/TransportServiceCC.d.ts.map +1 -0
- package/build/cc/TransportServiceCC.js +404 -0
- package/build/cc/TransportServiceCC.js.map +1 -0
- package/build/cc/UserCodeCC.d.ts +219 -0
- package/build/cc/UserCodeCC.d.ts.map +1 -0
- package/build/cc/UserCodeCC.js +1526 -0
- package/build/cc/UserCodeCC.js.map +1 -0
- package/build/cc/VersionCC.d.ts +91 -0
- package/build/cc/VersionCC.d.ts.map +1 -0
- package/build/cc/VersionCC.js +654 -0
- package/build/cc/VersionCC.js.map +1 -0
- package/build/cc/WakeUpCC.d.ts +67 -0
- package/build/cc/WakeUpCC.d.ts.map +1 -0
- package/build/cc/WakeUpCC.js +425 -0
- package/build/cc/WakeUpCC.js.map +1 -0
- package/build/cc/ZWavePlusCC.d.ts +40 -0
- package/build/cc/ZWavePlusCC.d.ts.map +1 -0
- package/build/cc/ZWavePlusCC.js +269 -0
- package/build/cc/ZWavePlusCC.js.map +1 -0
- package/build/cc/index.d.ts +64 -0
- package/build/cc/index.d.ts.map +1 -0
- package/build/cc/index.js +496 -0
- package/build/cc/index.js.map +1 -0
- package/build/cc/manufacturerProprietary/FibaroCC.d.ts +62 -0
- package/build/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -0
- package/build/cc/manufacturerProprietary/FibaroCC.js +247 -0
- package/build/cc/manufacturerProprietary/FibaroCC.js.map +1 -0
- package/build/index.d.ts +11 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +48 -0
- package/build/index.js.map +1 -0
- package/build/index_safe.d.ts +4 -0
- package/build/index_safe.d.ts.map +1 -0
- package/build/index_safe.js +30 -0
- package/build/index_safe.js.map +1 -0
- package/build/lib/API.d.ts +176 -0
- package/build/lib/API.d.ts.map +1 -0
- package/build/lib/API.js +325 -0
- package/build/lib/API.js.map +1 -0
- package/build/lib/CommandClass.d.ts +341 -0
- package/build/lib/CommandClass.d.ts.map +1 -0
- package/build/lib/CommandClass.js +1088 -0
- package/build/lib/CommandClass.js.map +1 -0
- package/build/lib/EncapsulatingCommandClass.d.ts +35 -0
- package/build/lib/EncapsulatingCommandClass.d.ts.map +1 -0
- package/build/lib/EncapsulatingCommandClass.js +53 -0
- package/build/lib/EncapsulatingCommandClass.js.map +1 -0
- package/build/lib/ICommandClassContainer.d.ts +9 -0
- package/build/lib/ICommandClassContainer.d.ts.map +1 -0
- package/build/lib/ICommandClassContainer.js +12 -0
- package/build/lib/ICommandClassContainer.js.map +1 -0
- package/build/lib/NotificationEventPayload.d.ts +11 -0
- package/build/lib/NotificationEventPayload.d.ts.map +1 -0
- package/build/lib/NotificationEventPayload.js +11 -0
- package/build/lib/NotificationEventPayload.js.map +1 -0
- package/build/lib/Security2/Extension.d.ts +87 -0
- package/build/lib/Security2/Extension.d.ts.map +1 -0
- package/build/lib/Security2/Extension.js +235 -0
- package/build/lib/Security2/Extension.js.map +1 -0
- package/build/lib/Security2/shared.d.ts +31 -0
- package/build/lib/Security2/shared.d.ts.map +1 -0
- package/build/lib/Security2/shared.js +37 -0
- package/build/lib/Security2/shared.js.map +1 -0
- package/build/lib/_Types.d.ts +1446 -0
- package/build/lib/_Types.d.ts.map +1 -0
- package/build/lib/_Types.js +1334 -0
- package/build/lib/_Types.js.map +1 -0
- package/build/lib/serializers.d.ts +24 -0
- package/build/lib/serializers.d.ts.map +1 -0
- package/build/lib/serializers.js +66 -0
- package/build/lib/serializers.js.map +1 -0
- package/build/lib/utils.d.ts +13 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +675 -0
- package/build/lib/utils.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,1004 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.MultiChannelCCV1CommandEncapsulation = exports.MultiChannelCCV1Get = exports.MultiChannelCCV1Report = exports.MultiChannelCCCommandEncapsulation = exports.MultiChannelCCAggregatedMembersGet = exports.MultiChannelCCAggregatedMembersReport = exports.MultiChannelCCEndPointFind = exports.MultiChannelCCEndPointFindReport = exports.MultiChannelCCCapabilityGet = exports.MultiChannelCCCapabilityReport = exports.MultiChannelCCEndPointGet = exports.MultiChannelCCEndPointReport = exports.MultiChannelCC = exports.MultiChannelCCAPI = exports.getAggregatedCountValueId = exports.getIndividualCountValueId = exports.getIdenticalCapabilitiesValueId = exports.getCountIsDynamicValueId = exports.getEndpointDeviceClassValueId = exports.getEndpointCCsValueId = exports.getEndpointIndizesValueId = void 0;
|
|
10
|
+
function __assertType(argName, typeName, boundHasError) {
|
|
11
|
+
const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
|
|
12
|
+
if (boundHasError()) {
|
|
13
|
+
throw new ZWaveError(typeName ? `${argName} is not a ${typeName}` : `${argName} has the wrong type`, ZWaveErrorCodes.Argument_Invalid);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const __assertType__number = $o => {
|
|
17
|
+
function _number($o) {
|
|
18
|
+
return typeof $o !== "number" ? {} : null;
|
|
19
|
+
}
|
|
20
|
+
return _number($o);
|
|
21
|
+
};
|
|
22
|
+
const safe_1 = require("@zwave-js/core/safe");
|
|
23
|
+
const safe_2 = require("@zwave-js/shared/safe");
|
|
24
|
+
const API_1 = require("../lib/API");
|
|
25
|
+
const CommandClass_1 = require("../lib/CommandClass");
|
|
26
|
+
const _Types_1 = require("../lib/_Types");
|
|
27
|
+
// TODO: Handle removal reports of dynamic endpoints
|
|
28
|
+
// @noSetValueAPI
|
|
29
|
+
function getEndpointIndizesValueId() {
|
|
30
|
+
return {
|
|
31
|
+
commandClass: safe_1.CommandClasses["Multi Channel"],
|
|
32
|
+
property: "endpointIndizes",
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
exports.getEndpointIndizesValueId = getEndpointIndizesValueId;
|
|
36
|
+
function getEndpointCCsValueId(endpointIndex) {
|
|
37
|
+
return {
|
|
38
|
+
commandClass: safe_1.CommandClasses["Multi Channel"],
|
|
39
|
+
endpoint: endpointIndex,
|
|
40
|
+
property: "commandClasses",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.getEndpointCCsValueId = getEndpointCCsValueId;
|
|
44
|
+
function getEndpointDeviceClassValueId(endpointIndex) {
|
|
45
|
+
return {
|
|
46
|
+
commandClass: safe_1.CommandClasses["Multi Channel"],
|
|
47
|
+
endpoint: endpointIndex,
|
|
48
|
+
property: "deviceClass",
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.getEndpointDeviceClassValueId = getEndpointDeviceClassValueId;
|
|
52
|
+
function getCountIsDynamicValueId() {
|
|
53
|
+
return {
|
|
54
|
+
commandClass: safe_1.CommandClasses["Multi Channel"],
|
|
55
|
+
property: "countIsDynamic",
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
exports.getCountIsDynamicValueId = getCountIsDynamicValueId;
|
|
59
|
+
function getIdenticalCapabilitiesValueId() {
|
|
60
|
+
return {
|
|
61
|
+
commandClass: safe_1.CommandClasses["Multi Channel"],
|
|
62
|
+
property: "identicalCapabilities",
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
exports.getIdenticalCapabilitiesValueId = getIdenticalCapabilitiesValueId;
|
|
66
|
+
function getIndividualCountValueId() {
|
|
67
|
+
return {
|
|
68
|
+
commandClass: safe_1.CommandClasses["Multi Channel"],
|
|
69
|
+
property: "individualCount",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
exports.getIndividualCountValueId = getIndividualCountValueId;
|
|
73
|
+
function getAggregatedCountValueId() {
|
|
74
|
+
return {
|
|
75
|
+
commandClass: safe_1.CommandClasses["Multi Channel"],
|
|
76
|
+
property: "aggregatedCount",
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
exports.getAggregatedCountValueId = getAggregatedCountValueId;
|
|
80
|
+
/**
|
|
81
|
+
* Many devices unnecessarily use endpoints when they could (or do) provide all functionality via the root device.
|
|
82
|
+
* This function gives an estimate if this is the case (i.e. all endpoints have a different device class)
|
|
83
|
+
*/
|
|
84
|
+
function areAllEndpointsDifferent(applHost, node, endpointIndizes) {
|
|
85
|
+
// Endpoints are useless if all of them have different device classes
|
|
86
|
+
const deviceClasses = new Set();
|
|
87
|
+
for (const endpoint of endpointIndizes) {
|
|
88
|
+
const devClassValueId = getEndpointDeviceClassValueId(endpoint);
|
|
89
|
+
const deviceClass = applHost.getValueDB(node.id).getValue(devClassValueId);
|
|
90
|
+
if (deviceClass) {
|
|
91
|
+
deviceClasses.add(deviceClass.generic * 256 + deviceClass.specific);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return deviceClasses.size === endpointIndizes.length;
|
|
95
|
+
}
|
|
96
|
+
let MultiChannelCCAPI = class MultiChannelCCAPI extends API_1.CCAPI {
|
|
97
|
+
supportsCommand(cmd) {
|
|
98
|
+
switch (cmd) {
|
|
99
|
+
// Legacy commands:
|
|
100
|
+
case _Types_1.MultiChannelCommand.GetV1:
|
|
101
|
+
return this.isSinglecast() && this.version === 1;
|
|
102
|
+
case _Types_1.MultiChannelCommand.CommandEncapsulationV1:
|
|
103
|
+
return this.version === 1;
|
|
104
|
+
// The specs start at version 3 but according to OZW,
|
|
105
|
+
// these do seem to be supported in version 2
|
|
106
|
+
case _Types_1.MultiChannelCommand.EndPointGet:
|
|
107
|
+
case _Types_1.MultiChannelCommand.CapabilityGet:
|
|
108
|
+
return this.version >= 2 && this.isSinglecast();
|
|
109
|
+
case _Types_1.MultiChannelCommand.CommandEncapsulation:
|
|
110
|
+
return this.version >= 2;
|
|
111
|
+
case _Types_1.MultiChannelCommand.EndPointFind:
|
|
112
|
+
return this.version >= 3 && this.isSinglecast();
|
|
113
|
+
case _Types_1.MultiChannelCommand.AggregatedMembersGet:
|
|
114
|
+
return this.version >= 4 && this.isSinglecast();
|
|
115
|
+
}
|
|
116
|
+
return super.supportsCommand(cmd);
|
|
117
|
+
}
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
119
|
+
async getEndpoints() {
|
|
120
|
+
this.assertSupportsCommand(_Types_1.MultiChannelCommand, _Types_1.MultiChannelCommand.EndPointGet);
|
|
121
|
+
const cc = new MultiChannelCCEndPointGet(this.applHost, {
|
|
122
|
+
nodeId: this.endpoint.nodeId,
|
|
123
|
+
endpoint: this.endpoint.index,
|
|
124
|
+
});
|
|
125
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
126
|
+
if (response) {
|
|
127
|
+
return {
|
|
128
|
+
isDynamicEndpointCount: response.countIsDynamic,
|
|
129
|
+
identicalCapabilities: response.identicalCapabilities,
|
|
130
|
+
individualEndpointCount: response.individualCount,
|
|
131
|
+
aggregatedEndpointCount: response.aggregatedCount,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async getEndpointCapabilities(endpoint) {
|
|
136
|
+
__assertType("endpoint", "number", __assertType__number.bind(void 0, endpoint));
|
|
137
|
+
this.assertSupportsCommand(_Types_1.MultiChannelCommand, _Types_1.MultiChannelCommand.CapabilityGet);
|
|
138
|
+
const cc = new MultiChannelCCCapabilityGet(this.applHost, {
|
|
139
|
+
nodeId: this.endpoint.nodeId,
|
|
140
|
+
endpoint: this.endpoint.index,
|
|
141
|
+
requestedEndpoint: endpoint,
|
|
142
|
+
});
|
|
143
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
144
|
+
if (response) {
|
|
145
|
+
const generic = this.applHost.configManager.lookupGenericDeviceClass(response.genericDeviceClass);
|
|
146
|
+
const specific = this.applHost.configManager.lookupSpecificDeviceClass(response.genericDeviceClass, response.specificDeviceClass);
|
|
147
|
+
return {
|
|
148
|
+
isDynamic: response.isDynamic,
|
|
149
|
+
wasRemoved: response.wasRemoved,
|
|
150
|
+
supportedCCs: response.supportedCCs,
|
|
151
|
+
generic,
|
|
152
|
+
specific,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async findEndpoints(genericClass, specificClass) {
|
|
157
|
+
__assertType("genericClass", "number", __assertType__number.bind(void 0, genericClass));
|
|
158
|
+
__assertType("specificClass", "number", __assertType__number.bind(void 0, specificClass));
|
|
159
|
+
this.assertSupportsCommand(_Types_1.MultiChannelCommand, _Types_1.MultiChannelCommand.EndPointFind);
|
|
160
|
+
const cc = new MultiChannelCCEndPointFind(this.applHost, {
|
|
161
|
+
nodeId: this.endpoint.nodeId,
|
|
162
|
+
endpoint: this.endpoint.index,
|
|
163
|
+
genericClass,
|
|
164
|
+
specificClass,
|
|
165
|
+
});
|
|
166
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
167
|
+
return response === null || response === void 0 ? void 0 : response.foundEndpoints;
|
|
168
|
+
}
|
|
169
|
+
async getAggregatedMembers(endpoint) {
|
|
170
|
+
__assertType("endpoint", "number", __assertType__number.bind(void 0, endpoint));
|
|
171
|
+
this.assertSupportsCommand(_Types_1.MultiChannelCommand, _Types_1.MultiChannelCommand.AggregatedMembersGet);
|
|
172
|
+
const cc = new MultiChannelCCAggregatedMembersGet(this.applHost, {
|
|
173
|
+
nodeId: this.endpoint.nodeId,
|
|
174
|
+
endpoint: this.endpoint.index,
|
|
175
|
+
requestedEndpoint: endpoint,
|
|
176
|
+
});
|
|
177
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
178
|
+
return response === null || response === void 0 ? void 0 : response.members;
|
|
179
|
+
}
|
|
180
|
+
// @noValidateArgs - Encapsulation is used internally and too frequently that we
|
|
181
|
+
// want to pay the cost of validating each call
|
|
182
|
+
async sendEncapsulated(options) {
|
|
183
|
+
this.assertSupportsCommand(_Types_1.MultiChannelCommand, _Types_1.MultiChannelCommand.CommandEncapsulation);
|
|
184
|
+
const cc = new MultiChannelCCCommandEncapsulation(this.applHost, {
|
|
185
|
+
nodeId: this.endpoint.nodeId,
|
|
186
|
+
...options,
|
|
187
|
+
});
|
|
188
|
+
await this.applHost.sendCommand(cc, this.commandOptions);
|
|
189
|
+
}
|
|
190
|
+
async getEndpointCountV1(ccId) {
|
|
191
|
+
__assertType("ccId", "CommandClasses", __assertType__number.bind(void 0, ccId));
|
|
192
|
+
this.assertSupportsCommand(_Types_1.MultiChannelCommand, _Types_1.MultiChannelCommand.GetV1);
|
|
193
|
+
const cc = new MultiChannelCCV1Get(this.applHost, {
|
|
194
|
+
nodeId: this.endpoint.nodeId,
|
|
195
|
+
requestedCC: ccId,
|
|
196
|
+
});
|
|
197
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
198
|
+
return response === null || response === void 0 ? void 0 : response.endpointCount;
|
|
199
|
+
}
|
|
200
|
+
// @noValidateArgs - Encapsulation is used internally and too frequently that we
|
|
201
|
+
// want to pay the cost of validating each call
|
|
202
|
+
async sendEncapsulatedV1(encapsulated) {
|
|
203
|
+
this.assertSupportsCommand(_Types_1.MultiChannelCommand, _Types_1.MultiChannelCommand.CommandEncapsulationV1);
|
|
204
|
+
const cc = new MultiChannelCCV1CommandEncapsulation(this.applHost, {
|
|
205
|
+
nodeId: this.endpoint.nodeId,
|
|
206
|
+
encapsulated,
|
|
207
|
+
});
|
|
208
|
+
await this.applHost.sendCommand(cc, this.commandOptions);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
MultiChannelCCAPI = __decorate([
|
|
212
|
+
(0, CommandClass_1.API)(safe_1.CommandClasses["Multi Channel"])
|
|
213
|
+
], MultiChannelCCAPI);
|
|
214
|
+
exports.MultiChannelCCAPI = MultiChannelCCAPI;
|
|
215
|
+
let MultiChannelCC = class MultiChannelCC extends CommandClass_1.CommandClass {
|
|
216
|
+
constructor(host, options) {
|
|
217
|
+
super(host, options);
|
|
218
|
+
this.registerValue(getEndpointIndizesValueId().property, {
|
|
219
|
+
internal: true,
|
|
220
|
+
});
|
|
221
|
+
this.registerValue(getEndpointCCsValueId(0).property, {
|
|
222
|
+
internal: true,
|
|
223
|
+
});
|
|
224
|
+
this.registerValue(getEndpointDeviceClassValueId(0).property, {
|
|
225
|
+
internal: true,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/** Tests if a command targets a specific endpoint and thus requires encapsulation */
|
|
229
|
+
static requiresEncapsulation(cc) {
|
|
230
|
+
return (cc.endpointIndex !== 0 &&
|
|
231
|
+
!(cc instanceof MultiChannelCCCommandEncapsulation) &&
|
|
232
|
+
!(cc instanceof MultiChannelCCV1CommandEncapsulation));
|
|
233
|
+
}
|
|
234
|
+
/** Encapsulates a command that targets a specific endpoint */
|
|
235
|
+
static encapsulate(host, cc) {
|
|
236
|
+
const ccVersion = host.getSafeCCVersionForNode(safe_1.CommandClasses["Multi Channel"], cc.nodeId);
|
|
237
|
+
if (ccVersion === 1) {
|
|
238
|
+
return new MultiChannelCCV1CommandEncapsulation(host, {
|
|
239
|
+
nodeId: cc.nodeId,
|
|
240
|
+
encapsulated: cc,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
return new MultiChannelCCCommandEncapsulation(host, {
|
|
245
|
+
nodeId: cc.nodeId,
|
|
246
|
+
encapsulated: cc,
|
|
247
|
+
destination: cc.endpointIndex,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
skipEndpointInterview() {
|
|
252
|
+
// The endpoints are discovered by querying the root device
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
async interview(applHost) {
|
|
256
|
+
var _a, _b, _c;
|
|
257
|
+
const node = this.getNode(applHost);
|
|
258
|
+
applHost.controllerLog.logNode(node.id, {
|
|
259
|
+
endpoint: this.endpointIndex,
|
|
260
|
+
message: `Interviewing ${this.ccName}...`,
|
|
261
|
+
direction: "none",
|
|
262
|
+
});
|
|
263
|
+
// Special interview procedure for legacy nodes
|
|
264
|
+
if (this.version === 1)
|
|
265
|
+
return this.interviewV1(applHost);
|
|
266
|
+
const endpoint = node.getEndpoint(this.endpointIndex);
|
|
267
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses["Multi Channel"], applHost, endpoint).withOptions({
|
|
268
|
+
priority: safe_1.MessagePriority.NodeQuery,
|
|
269
|
+
});
|
|
270
|
+
const valueDB = this.getValueDB(applHost);
|
|
271
|
+
// Step 1: Retrieve general information about end points
|
|
272
|
+
applHost.controllerLog.logNode(node.id, {
|
|
273
|
+
endpoint: this.endpointIndex,
|
|
274
|
+
message: "querying device endpoint information...",
|
|
275
|
+
direction: "outbound",
|
|
276
|
+
});
|
|
277
|
+
const multiResponse = await api.getEndpoints();
|
|
278
|
+
if (!multiResponse) {
|
|
279
|
+
applHost.controllerLog.logNode(node.id, {
|
|
280
|
+
endpoint: this.endpointIndex,
|
|
281
|
+
message: "Querying device endpoint information timed out, aborting interview...",
|
|
282
|
+
level: "warn",
|
|
283
|
+
});
|
|
284
|
+
return this.throwMissingCriticalInterviewResponse();
|
|
285
|
+
}
|
|
286
|
+
let logMessage = `received response for device endpoints:
|
|
287
|
+
endpoint count (individual): ${multiResponse.individualEndpointCount}
|
|
288
|
+
count is dynamic: ${multiResponse.isDynamicEndpointCount}
|
|
289
|
+
identical capabilities: ${multiResponse.identicalCapabilities}`;
|
|
290
|
+
if (multiResponse.aggregatedEndpointCount != undefined) {
|
|
291
|
+
logMessage += `\nendpoint count (aggregated): ${multiResponse.aggregatedEndpointCount}`;
|
|
292
|
+
}
|
|
293
|
+
applHost.controllerLog.logNode(node.id, {
|
|
294
|
+
endpoint: this.endpointIndex,
|
|
295
|
+
message: logMessage,
|
|
296
|
+
direction: "inbound",
|
|
297
|
+
});
|
|
298
|
+
let allEndpoints = [];
|
|
299
|
+
const addSequentialEndpoints = () => {
|
|
300
|
+
var _a;
|
|
301
|
+
for (let i = 1; i <=
|
|
302
|
+
multiResponse.individualEndpointCount +
|
|
303
|
+
((_a = multiResponse.aggregatedEndpointCount) !== null && _a !== void 0 ? _a : 0); i++) {
|
|
304
|
+
allEndpoints.push(i);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
if (api.supportsCommand(_Types_1.MultiChannelCommand.EndPointFind)) {
|
|
308
|
+
// Step 2a: Find all endpoints
|
|
309
|
+
applHost.controllerLog.logNode(node.id, {
|
|
310
|
+
endpoint: this.endpointIndex,
|
|
311
|
+
message: "querying all endpoints...",
|
|
312
|
+
direction: "outbound",
|
|
313
|
+
});
|
|
314
|
+
const foundEndpoints = await api.findEndpoints(0xff, 0xff);
|
|
315
|
+
if (foundEndpoints)
|
|
316
|
+
allEndpoints.push(...foundEndpoints);
|
|
317
|
+
if (!allEndpoints.length) {
|
|
318
|
+
// Create a sequential list of endpoints
|
|
319
|
+
applHost.controllerLog.logNode(node.id, {
|
|
320
|
+
endpoint: this.endpointIndex,
|
|
321
|
+
message: `Endpoint query returned no results, assuming that endpoints are sequential`,
|
|
322
|
+
direction: "inbound",
|
|
323
|
+
});
|
|
324
|
+
addSequentialEndpoints();
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
applHost.controllerLog.logNode(node.id, {
|
|
328
|
+
endpoint: this.endpointIndex,
|
|
329
|
+
message: `received endpoints: ${allEndpoints
|
|
330
|
+
.map(String)
|
|
331
|
+
.join(", ")}`,
|
|
332
|
+
direction: "inbound",
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
// Step 2b: Assume that the endpoints are in sequential order
|
|
338
|
+
applHost.controllerLog.logNode(node.id, {
|
|
339
|
+
endpoint: this.endpointIndex,
|
|
340
|
+
message: `does not support EndPointFind, assuming that endpoints are sequential`,
|
|
341
|
+
direction: "none",
|
|
342
|
+
});
|
|
343
|
+
addSequentialEndpoints();
|
|
344
|
+
}
|
|
345
|
+
// Step 3: Query endpoints
|
|
346
|
+
let hasQueriedCapabilities = false;
|
|
347
|
+
for (const endpoint of allEndpoints) {
|
|
348
|
+
if (endpoint > multiResponse.individualEndpointCount &&
|
|
349
|
+
this.version >= 4) {
|
|
350
|
+
// Find members of aggregated end point
|
|
351
|
+
applHost.controllerLog.logNode(node.id, {
|
|
352
|
+
endpoint: this.endpointIndex,
|
|
353
|
+
message: `querying members of aggregated endpoint #${endpoint}...`,
|
|
354
|
+
direction: "outbound",
|
|
355
|
+
});
|
|
356
|
+
const members = await api.getAggregatedMembers(endpoint);
|
|
357
|
+
if (members) {
|
|
358
|
+
applHost.controllerLog.logNode(node.id, {
|
|
359
|
+
endpoint: this.endpointIndex,
|
|
360
|
+
message: `aggregated endpoint #${endpoint} has members ${members
|
|
361
|
+
.map(String)
|
|
362
|
+
.join(", ")}`,
|
|
363
|
+
direction: "inbound",
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
// When the device reports identical capabilities for all endpoints,
|
|
368
|
+
// we don't need to query them all
|
|
369
|
+
if (multiResponse.identicalCapabilities && hasQueriedCapabilities) {
|
|
370
|
+
applHost.controllerLog.logNode(node.id, {
|
|
371
|
+
endpoint: this.endpointIndex,
|
|
372
|
+
message: `all endpoints identical, skipping capability query for endpoint #${endpoint}...`,
|
|
373
|
+
direction: "none",
|
|
374
|
+
});
|
|
375
|
+
// copy the capabilities from the first endpoint
|
|
376
|
+
const devClass = valueDB.getValue(getEndpointDeviceClassValueId(allEndpoints[0]));
|
|
377
|
+
valueDB.setValue(getEndpointDeviceClassValueId(endpoint), devClass);
|
|
378
|
+
const ep1Caps = valueDB.getValue(getEndpointCCsValueId(allEndpoints[0]));
|
|
379
|
+
valueDB.setValue(getEndpointCCsValueId(endpoint), [...ep1Caps]);
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
applHost.controllerLog.logNode(node.id, {
|
|
383
|
+
endpoint: this.endpointIndex,
|
|
384
|
+
message: `querying capabilities for endpoint #${endpoint}...`,
|
|
385
|
+
direction: "outbound",
|
|
386
|
+
});
|
|
387
|
+
const caps = await api.getEndpointCapabilities(endpoint);
|
|
388
|
+
if (caps) {
|
|
389
|
+
hasQueriedCapabilities = true;
|
|
390
|
+
logMessage = `received response for endpoint capabilities (#${endpoint}):
|
|
391
|
+
generic device class: ${caps.generic.label}
|
|
392
|
+
specific device class: ${caps.specific.label}
|
|
393
|
+
is dynamic end point: ${caps.isDynamic}
|
|
394
|
+
supported CCs:`;
|
|
395
|
+
for (const cc of caps.supportedCCs) {
|
|
396
|
+
const ccName = safe_1.CommandClasses[cc];
|
|
397
|
+
logMessage += `\n · ${ccName ? ccName : (0, safe_2.num2hex)(cc)}`;
|
|
398
|
+
}
|
|
399
|
+
applHost.controllerLog.logNode(node.id, {
|
|
400
|
+
endpoint: this.endpointIndex,
|
|
401
|
+
message: logMessage,
|
|
402
|
+
direction: "inbound",
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
applHost.controllerLog.logNode(node.id, {
|
|
407
|
+
endpoint: this.endpointIndex,
|
|
408
|
+
message: `Querying endpoint #${endpoint} capabilities timed out, aborting interview...`,
|
|
409
|
+
level: "warn",
|
|
410
|
+
});
|
|
411
|
+
return this.throwMissingCriticalInterviewResponse();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// Now that all endpoints have been interviewed, remember which ones are there
|
|
415
|
+
// But first figure out if they seem unnecessary and if they do, which ones should be preserved
|
|
416
|
+
if (!multiResponse.identicalCapabilities &&
|
|
417
|
+
areAllEndpointsDifferent(applHost, node, allEndpoints)) {
|
|
418
|
+
const preserve = (_c = (_b = (_a = applHost.getDeviceConfig) === null || _a === void 0 ? void 0 : _a.call(applHost, node.id)) === null || _b === void 0 ? void 0 : _b.compat) === null || _c === void 0 ? void 0 : _c.preserveEndpoints;
|
|
419
|
+
if (!preserve) {
|
|
420
|
+
allEndpoints = [];
|
|
421
|
+
applHost.controllerLog.logNode(node.id, {
|
|
422
|
+
message: `Endpoints seem unnecessary b/c they have different device classes, ignoring all...`,
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
else if (preserve === "*") {
|
|
426
|
+
// preserve all endpoints, do nothing
|
|
427
|
+
applHost.controllerLog.logNode(node.id, {
|
|
428
|
+
message: `Endpoints seem unnecessary, but are configured to be preserved.`,
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
allEndpoints = allEndpoints.filter((ep) => preserve.includes(ep));
|
|
433
|
+
applHost.controllerLog.logNode(node.id, {
|
|
434
|
+
message: `Endpoints seem unnecessary, but endpoints ${allEndpoints.join(", ")} are configured to be preserved.`,
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
valueDB.setValue(getEndpointIndizesValueId(), allEndpoints);
|
|
439
|
+
// Remember that the interview is complete
|
|
440
|
+
this.setInterviewComplete(applHost, true);
|
|
441
|
+
}
|
|
442
|
+
async interviewV1(applHost) {
|
|
443
|
+
const node = this.getNode(applHost);
|
|
444
|
+
const endpoint = this.getEndpoint(applHost);
|
|
445
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses["Multi Channel"], applHost, endpoint);
|
|
446
|
+
const valueDB = this.getValueDB(applHost);
|
|
447
|
+
// V1 works the opposite way - we scan all CCs and remember how many
|
|
448
|
+
// endpoints they have
|
|
449
|
+
const supportedCCs = [...node.getCCs()]
|
|
450
|
+
// Don't query CCs the node only controls
|
|
451
|
+
.filter(([, info]) => info.isSupported)
|
|
452
|
+
.map(([cc]) => cc)
|
|
453
|
+
// Don't query CCs that want to skip the endpoint interview
|
|
454
|
+
.filter((cc) => {
|
|
455
|
+
var _a;
|
|
456
|
+
return !((_a = CommandClass_1.CommandClass.createInstanceUnchecked(applHost, node, cc)) === null || _a === void 0 ? void 0 : _a.skipEndpointInterview());
|
|
457
|
+
});
|
|
458
|
+
const endpointCounts = new Map();
|
|
459
|
+
for (const ccId of supportedCCs) {
|
|
460
|
+
applHost.controllerLog.logNode(node.id, {
|
|
461
|
+
message: `Querying endpoint count for CommandClass ${(0, safe_1.getCCName)(ccId)}...`,
|
|
462
|
+
direction: "outbound",
|
|
463
|
+
});
|
|
464
|
+
const endpointCount = await api.getEndpointCountV1(ccId);
|
|
465
|
+
if (endpointCount != undefined) {
|
|
466
|
+
endpointCounts.set(ccId, endpointCount);
|
|
467
|
+
applHost.controllerLog.logNode(node.id, {
|
|
468
|
+
message: `CommandClass ${(0, safe_1.getCCName)(ccId)} has ${endpointCount} endpoints`,
|
|
469
|
+
direction: "inbound",
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
// Store the collected information
|
|
474
|
+
// We have only individual and no dynamic and no aggregated endpoints
|
|
475
|
+
const numEndpoints = Math.max(...endpointCounts.values());
|
|
476
|
+
valueDB.setValue(getCountIsDynamicValueId(), false);
|
|
477
|
+
valueDB.setValue(getAggregatedCountValueId(), 0);
|
|
478
|
+
valueDB.setValue(getIndividualCountValueId(), numEndpoints);
|
|
479
|
+
// Since we queried all CCs separately, we can assume that all
|
|
480
|
+
// endpoints have different capabilities
|
|
481
|
+
valueDB.setValue(getIdenticalCapabilitiesValueId(), false);
|
|
482
|
+
for (let endpoint = 1; endpoint <= numEndpoints; endpoint++) {
|
|
483
|
+
// Check which CCs exist on this endpoint
|
|
484
|
+
const endpointCCs = [...endpointCounts.entries()]
|
|
485
|
+
.filter(([, ccEndpoints]) => ccEndpoints >= endpoint)
|
|
486
|
+
.map(([ccId]) => ccId);
|
|
487
|
+
// And store it per endpoint
|
|
488
|
+
valueDB.setValue(getEndpointCCsValueId(endpoint), endpointCCs);
|
|
489
|
+
}
|
|
490
|
+
// Remember that the interview is complete
|
|
491
|
+
this.setInterviewComplete(applHost, true);
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
MultiChannelCC = __decorate([
|
|
495
|
+
(0, CommandClass_1.commandClass)(safe_1.CommandClasses["Multi Channel"]),
|
|
496
|
+
(0, CommandClass_1.implementedVersion)(4)
|
|
497
|
+
], MultiChannelCC);
|
|
498
|
+
exports.MultiChannelCC = MultiChannelCC;
|
|
499
|
+
let MultiChannelCCEndPointReport = class MultiChannelCCEndPointReport extends MultiChannelCC {
|
|
500
|
+
constructor(host, options) {
|
|
501
|
+
super(host, options);
|
|
502
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2);
|
|
503
|
+
this._countIsDynamic = !!(this.payload[0] & 0b10000000);
|
|
504
|
+
this._identicalCapabilities = !!(this.payload[0] & 0b01000000);
|
|
505
|
+
this._individualCount = this.payload[1] & 0b01111111;
|
|
506
|
+
if (this.version >= 4 && this.payload.length >= 3) {
|
|
507
|
+
this._aggregatedCount = this.payload[2] & 0b01111111;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
get countIsDynamic() {
|
|
511
|
+
return this._countIsDynamic;
|
|
512
|
+
}
|
|
513
|
+
get identicalCapabilities() {
|
|
514
|
+
return this._identicalCapabilities;
|
|
515
|
+
}
|
|
516
|
+
get individualCount() {
|
|
517
|
+
return this._individualCount;
|
|
518
|
+
}
|
|
519
|
+
get aggregatedCount() {
|
|
520
|
+
return this._aggregatedCount;
|
|
521
|
+
}
|
|
522
|
+
toLogEntry(applHost) {
|
|
523
|
+
const message = {
|
|
524
|
+
"endpoint count (individual)": this.individualCount,
|
|
525
|
+
"count is dynamic": this.countIsDynamic,
|
|
526
|
+
"identical capabilities": this.identicalCapabilities,
|
|
527
|
+
};
|
|
528
|
+
if (this.aggregatedCount != undefined) {
|
|
529
|
+
message["endpoint count (aggregated)"] = this.aggregatedCount;
|
|
530
|
+
}
|
|
531
|
+
const ret = {
|
|
532
|
+
...super.toLogEntry(applHost),
|
|
533
|
+
message,
|
|
534
|
+
};
|
|
535
|
+
return ret;
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
__decorate([
|
|
539
|
+
(0, CommandClass_1.ccValue)({ internal: true })
|
|
540
|
+
], MultiChannelCCEndPointReport.prototype, "countIsDynamic", null);
|
|
541
|
+
__decorate([
|
|
542
|
+
(0, CommandClass_1.ccValue)({ internal: true })
|
|
543
|
+
], MultiChannelCCEndPointReport.prototype, "identicalCapabilities", null);
|
|
544
|
+
__decorate([
|
|
545
|
+
(0, CommandClass_1.ccValue)({ internal: true })
|
|
546
|
+
], MultiChannelCCEndPointReport.prototype, "individualCount", null);
|
|
547
|
+
__decorate([
|
|
548
|
+
(0, CommandClass_1.ccValue)({ internal: true })
|
|
549
|
+
], MultiChannelCCEndPointReport.prototype, "aggregatedCount", null);
|
|
550
|
+
MultiChannelCCEndPointReport = __decorate([
|
|
551
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.EndPointReport)
|
|
552
|
+
], MultiChannelCCEndPointReport);
|
|
553
|
+
exports.MultiChannelCCEndPointReport = MultiChannelCCEndPointReport;
|
|
554
|
+
let MultiChannelCCEndPointGet = class MultiChannelCCEndPointGet extends MultiChannelCC {
|
|
555
|
+
};
|
|
556
|
+
MultiChannelCCEndPointGet = __decorate([
|
|
557
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.EndPointGet),
|
|
558
|
+
(0, CommandClass_1.expectedCCResponse)(MultiChannelCCEndPointReport)
|
|
559
|
+
], MultiChannelCCEndPointGet);
|
|
560
|
+
exports.MultiChannelCCEndPointGet = MultiChannelCCEndPointGet;
|
|
561
|
+
let MultiChannelCCCapabilityReport = class MultiChannelCCCapabilityReport extends MultiChannelCC {
|
|
562
|
+
constructor(host, options) {
|
|
563
|
+
super(host, options);
|
|
564
|
+
// Only validate the bytes we expect to see here
|
|
565
|
+
// parseNodeInformationFrame does its own validation
|
|
566
|
+
(0, safe_1.validatePayload)(this.payload.length >= 1);
|
|
567
|
+
this.endpointIndex = this.payload[0] & 0b01111111;
|
|
568
|
+
const NIF = (0, safe_1.parseNodeInformationFrame)(this.payload.slice(1));
|
|
569
|
+
this.isDynamic = !!(this.payload[0] & 0b10000000);
|
|
570
|
+
this.genericDeviceClass = NIF.generic;
|
|
571
|
+
this.specificDeviceClass = NIF.specific;
|
|
572
|
+
this.supportedCCs = NIF.supportedCCs;
|
|
573
|
+
// TODO: does this include controlledCCs aswell?
|
|
574
|
+
// Removal reports have very specific information
|
|
575
|
+
this.wasRemoved =
|
|
576
|
+
this.isDynamic &&
|
|
577
|
+
this.genericDeviceClass === 0xff && // "Non-Interoperable"
|
|
578
|
+
this.specificDeviceClass === 0x00;
|
|
579
|
+
}
|
|
580
|
+
persistValues(applHost) {
|
|
581
|
+
if (!super.persistValues(applHost))
|
|
582
|
+
return false;
|
|
583
|
+
const valueDB = this.getValueDB(applHost);
|
|
584
|
+
const deviceClassValueId = getEndpointDeviceClassValueId(this.endpointIndex);
|
|
585
|
+
const ccsValueId = getEndpointCCsValueId(this.endpointIndex);
|
|
586
|
+
if (this.wasRemoved) {
|
|
587
|
+
valueDB.removeValue(deviceClassValueId);
|
|
588
|
+
valueDB.removeValue(ccsValueId);
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
valueDB.setValue(deviceClassValueId, {
|
|
592
|
+
generic: this.genericDeviceClass,
|
|
593
|
+
specific: this.specificDeviceClass,
|
|
594
|
+
});
|
|
595
|
+
valueDB.setValue(ccsValueId, this.supportedCCs);
|
|
596
|
+
}
|
|
597
|
+
return true;
|
|
598
|
+
}
|
|
599
|
+
toLogEntry(applHost) {
|
|
600
|
+
const generic = applHost.configManager.lookupGenericDeviceClass(this.genericDeviceClass);
|
|
601
|
+
const specific = applHost.configManager.lookupSpecificDeviceClass(this.genericDeviceClass, this.specificDeviceClass);
|
|
602
|
+
return {
|
|
603
|
+
...super.toLogEntry(applHost),
|
|
604
|
+
message: {
|
|
605
|
+
"endpoint index": this.endpointIndex,
|
|
606
|
+
"generic device class": generic.label,
|
|
607
|
+
"specific device class": specific.label,
|
|
608
|
+
"is dynamic end point": this.isDynamic,
|
|
609
|
+
"supported CCs": this.supportedCCs
|
|
610
|
+
.map((cc) => `\n· ${(0, safe_1.getCCName)(cc)}`)
|
|
611
|
+
.join(""),
|
|
612
|
+
},
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
MultiChannelCCCapabilityReport = __decorate([
|
|
617
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.CapabilityReport)
|
|
618
|
+
], MultiChannelCCCapabilityReport);
|
|
619
|
+
exports.MultiChannelCCCapabilityReport = MultiChannelCCCapabilityReport;
|
|
620
|
+
let MultiChannelCCCapabilityGet = class MultiChannelCCCapabilityGet extends MultiChannelCC {
|
|
621
|
+
constructor(host, options) {
|
|
622
|
+
super(host, options);
|
|
623
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
624
|
+
// TODO: Deserialize payload
|
|
625
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
this.requestedEndpoint = options.requestedEndpoint;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
serialize() {
|
|
632
|
+
this.payload = Buffer.from([this.requestedEndpoint & 0b01111111]);
|
|
633
|
+
return super.serialize();
|
|
634
|
+
}
|
|
635
|
+
toLogEntry(applHost) {
|
|
636
|
+
return {
|
|
637
|
+
...super.toLogEntry(applHost),
|
|
638
|
+
message: { endpoint: this.requestedEndpoint },
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
MultiChannelCCCapabilityGet = __decorate([
|
|
643
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.CapabilityGet),
|
|
644
|
+
(0, CommandClass_1.expectedCCResponse)(MultiChannelCCCapabilityReport)
|
|
645
|
+
], MultiChannelCCCapabilityGet);
|
|
646
|
+
exports.MultiChannelCCCapabilityGet = MultiChannelCCCapabilityGet;
|
|
647
|
+
let MultiChannelCCEndPointFindReport = class MultiChannelCCEndPointFindReport extends MultiChannelCC {
|
|
648
|
+
constructor(host, options) {
|
|
649
|
+
super(host, options);
|
|
650
|
+
(0, safe_1.validatePayload)(this.payload.length >= 3);
|
|
651
|
+
this._reportsToFollow = this.payload[0];
|
|
652
|
+
this._genericClass = this.payload[1];
|
|
653
|
+
this._specificClass = this.payload[2];
|
|
654
|
+
// Some devices omit the endpoint list althought that is not allowed in the specs
|
|
655
|
+
// therefore don't validatePayload here.
|
|
656
|
+
this._foundEndpoints = [...this.payload.slice(3)]
|
|
657
|
+
.map((e) => e & 0b01111111)
|
|
658
|
+
.filter((e) => e !== 0);
|
|
659
|
+
}
|
|
660
|
+
get genericClass() {
|
|
661
|
+
return this._genericClass;
|
|
662
|
+
}
|
|
663
|
+
get specificClass() {
|
|
664
|
+
return this._specificClass;
|
|
665
|
+
}
|
|
666
|
+
get foundEndpoints() {
|
|
667
|
+
return this._foundEndpoints;
|
|
668
|
+
}
|
|
669
|
+
get reportsToFollow() {
|
|
670
|
+
return this._reportsToFollow;
|
|
671
|
+
}
|
|
672
|
+
getPartialCCSessionId() {
|
|
673
|
+
// Distinguish sessions by the requested device classes
|
|
674
|
+
return {
|
|
675
|
+
genericClass: this.genericClass,
|
|
676
|
+
specificClass: this.specificClass,
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
expectMoreMessages() {
|
|
680
|
+
return this._reportsToFollow > 0;
|
|
681
|
+
}
|
|
682
|
+
mergePartialCCs(applHost, partials) {
|
|
683
|
+
// Concat the list of end points
|
|
684
|
+
this._foundEndpoints = [...partials, this]
|
|
685
|
+
.map((report) => report._foundEndpoints)
|
|
686
|
+
.reduce((prev, cur) => prev.concat(...cur), []);
|
|
687
|
+
}
|
|
688
|
+
toLogEntry(applHost) {
|
|
689
|
+
return {
|
|
690
|
+
...super.toLogEntry(applHost),
|
|
691
|
+
message: {
|
|
692
|
+
"generic device class": applHost.configManager.lookupGenericDeviceClass(this.genericClass).label,
|
|
693
|
+
"specific device class": applHost.configManager.lookupSpecificDeviceClass(this.genericClass, this.specificClass).label,
|
|
694
|
+
"found endpoints": this._foundEndpoints.join(", "),
|
|
695
|
+
"# of reports to follow": this._reportsToFollow,
|
|
696
|
+
},
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
MultiChannelCCEndPointFindReport = __decorate([
|
|
701
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.EndPointFindReport)
|
|
702
|
+
], MultiChannelCCEndPointFindReport);
|
|
703
|
+
exports.MultiChannelCCEndPointFindReport = MultiChannelCCEndPointFindReport;
|
|
704
|
+
let MultiChannelCCEndPointFind = class MultiChannelCCEndPointFind extends MultiChannelCC {
|
|
705
|
+
constructor(host, options) {
|
|
706
|
+
super(host, options);
|
|
707
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
708
|
+
// TODO: Deserialize payload
|
|
709
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
this.genericClass = options.genericClass;
|
|
713
|
+
this.specificClass = options.specificClass;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
serialize() {
|
|
717
|
+
this.payload = Buffer.from([this.genericClass, this.specificClass]);
|
|
718
|
+
return super.serialize();
|
|
719
|
+
}
|
|
720
|
+
toLogEntry(applHost) {
|
|
721
|
+
return {
|
|
722
|
+
...super.toLogEntry(applHost),
|
|
723
|
+
message: {
|
|
724
|
+
"generic device class": applHost.configManager.lookupGenericDeviceClass(this.genericClass).label,
|
|
725
|
+
"specific device class": applHost.configManager.lookupSpecificDeviceClass(this.genericClass, this.specificClass).label,
|
|
726
|
+
},
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
MultiChannelCCEndPointFind = __decorate([
|
|
731
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.EndPointFind),
|
|
732
|
+
(0, CommandClass_1.expectedCCResponse)(MultiChannelCCEndPointFindReport)
|
|
733
|
+
], MultiChannelCCEndPointFind);
|
|
734
|
+
exports.MultiChannelCCEndPointFind = MultiChannelCCEndPointFind;
|
|
735
|
+
let MultiChannelCCAggregatedMembersReport = class MultiChannelCCAggregatedMembersReport extends MultiChannelCC {
|
|
736
|
+
constructor(host, options) {
|
|
737
|
+
super(host, options);
|
|
738
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2);
|
|
739
|
+
const endpoint = this.payload[0] & 127;
|
|
740
|
+
const bitMaskLength = this.payload[1];
|
|
741
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2 + bitMaskLength);
|
|
742
|
+
const bitMask = this.payload.slice(2, 2 + bitMaskLength);
|
|
743
|
+
const members = (0, safe_1.parseBitMask)(bitMask);
|
|
744
|
+
this.aggregatedEndpointMembers = [endpoint, members];
|
|
745
|
+
}
|
|
746
|
+
get aggregatedEndpoint() {
|
|
747
|
+
return this.aggregatedEndpointMembers[0];
|
|
748
|
+
}
|
|
749
|
+
get members() {
|
|
750
|
+
return this.aggregatedEndpointMembers[1];
|
|
751
|
+
}
|
|
752
|
+
toLogEntry(applHost) {
|
|
753
|
+
return {
|
|
754
|
+
...super.toLogEntry(applHost),
|
|
755
|
+
message: {
|
|
756
|
+
endpoint: this.endpointIndex,
|
|
757
|
+
members: this.members.join(", "),
|
|
758
|
+
},
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
__decorate([
|
|
763
|
+
(0, CommandClass_1.ccKeyValuePair)({ internal: true })
|
|
764
|
+
], MultiChannelCCAggregatedMembersReport.prototype, "aggregatedEndpointMembers", void 0);
|
|
765
|
+
MultiChannelCCAggregatedMembersReport = __decorate([
|
|
766
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.AggregatedMembersReport)
|
|
767
|
+
], MultiChannelCCAggregatedMembersReport);
|
|
768
|
+
exports.MultiChannelCCAggregatedMembersReport = MultiChannelCCAggregatedMembersReport;
|
|
769
|
+
let MultiChannelCCAggregatedMembersGet = class MultiChannelCCAggregatedMembersGet extends MultiChannelCC {
|
|
770
|
+
constructor(host, options) {
|
|
771
|
+
super(host, options);
|
|
772
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
773
|
+
// TODO: Deserialize payload
|
|
774
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
775
|
+
}
|
|
776
|
+
else {
|
|
777
|
+
this.requestedEndpoint = options.requestedEndpoint;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
serialize() {
|
|
781
|
+
this.payload = Buffer.from([this.requestedEndpoint & 127]);
|
|
782
|
+
return super.serialize();
|
|
783
|
+
}
|
|
784
|
+
toLogEntry(applHost) {
|
|
785
|
+
return {
|
|
786
|
+
...super.toLogEntry(applHost),
|
|
787
|
+
message: { endpoint: this.requestedEndpoint },
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
MultiChannelCCAggregatedMembersGet = __decorate([
|
|
792
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.AggregatedMembersGet),
|
|
793
|
+
(0, CommandClass_1.expectedCCResponse)(MultiChannelCCAggregatedMembersReport)
|
|
794
|
+
], MultiChannelCCAggregatedMembersGet);
|
|
795
|
+
exports.MultiChannelCCAggregatedMembersGet = MultiChannelCCAggregatedMembersGet;
|
|
796
|
+
// SDS13783: A receiving node MAY respond to a Multi Channel encapsulated command if the Destination
|
|
797
|
+
// End Point field specifies a single End Point. In that case, the response MUST be Multi Channel
|
|
798
|
+
// encapsulated.
|
|
799
|
+
// A receiving node MUST NOT respond to a Multi Channel encapsulated command if the
|
|
800
|
+
// Destination End Point field specifies multiple End Points via bit mask addressing.
|
|
801
|
+
function getCCResponseForCommandEncapsulation(sent) {
|
|
802
|
+
if (typeof sent.destination === "number" &&
|
|
803
|
+
sent.encapsulated.expectsCCResponse()) {
|
|
804
|
+
// Allow both versions of the encapsulation command
|
|
805
|
+
// Our implementation check is a bit too strict, so change the return type
|
|
806
|
+
return [
|
|
807
|
+
MultiChannelCCCommandEncapsulation,
|
|
808
|
+
MultiChannelCCV1CommandEncapsulation,
|
|
809
|
+
];
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
function testResponseForCommandEncapsulation(sent, received) {
|
|
813
|
+
if (typeof sent.destination === "number" &&
|
|
814
|
+
sent.destination === received.endpointIndex) {
|
|
815
|
+
return "checkEncapsulated";
|
|
816
|
+
}
|
|
817
|
+
return false;
|
|
818
|
+
}
|
|
819
|
+
let MultiChannelCCCommandEncapsulation = class MultiChannelCCCommandEncapsulation extends MultiChannelCC {
|
|
820
|
+
constructor(host, options) {
|
|
821
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
822
|
+
super(host, options);
|
|
823
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
824
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2);
|
|
825
|
+
if ((_d = (_c = (_b = (_a = this.host).getDeviceConfig) === null || _b === void 0 ? void 0 : _b.call(_a, this.nodeId)) === null || _c === void 0 ? void 0 : _c.compat) === null || _d === void 0 ? void 0 : _d.treatDestinationEndpointAsSource) {
|
|
826
|
+
// This device incorrectly uses the destination field to indicate the source endpoint
|
|
827
|
+
this.endpointIndex = this.payload[1] & 127;
|
|
828
|
+
this.destination = 0;
|
|
829
|
+
}
|
|
830
|
+
else {
|
|
831
|
+
// Parse normally
|
|
832
|
+
this.endpointIndex = this.payload[0] & 127;
|
|
833
|
+
const isBitMask = !!(this.payload[1] & 128);
|
|
834
|
+
const destination = this.payload[1] & 127;
|
|
835
|
+
if (isBitMask) {
|
|
836
|
+
this.destination = (0, safe_1.parseBitMask)(Buffer.from([destination]));
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
this.destination = destination;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
// No need to validate further, each CC does it for itself
|
|
843
|
+
this.encapsulated = CommandClass_1.CommandClass.from(this.host, {
|
|
844
|
+
data: this.payload.slice(2),
|
|
845
|
+
fromEncapsulation: true,
|
|
846
|
+
encapCC: this,
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
else {
|
|
850
|
+
this.encapsulated = options.encapsulated;
|
|
851
|
+
options.encapsulated.encapsulatingCC = this;
|
|
852
|
+
this.destination = options.destination;
|
|
853
|
+
// If the encapsulated command requires security, so does this one
|
|
854
|
+
if (this.encapsulated.secure)
|
|
855
|
+
this.secure = true;
|
|
856
|
+
if ((_h = (_g = (_f = (_e = this.host).getDeviceConfig) === null || _f === void 0 ? void 0 : _f.call(_e, this.nodeId)) === null || _g === void 0 ? void 0 : _g.compat) === null || _h === void 0 ? void 0 : _h.treatDestinationEndpointAsSource) {
|
|
857
|
+
// This device incorrectly responds from the endpoint we've passed as our source endpoint
|
|
858
|
+
if (typeof this.destination === "number")
|
|
859
|
+
this.endpointIndex = this.destination;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
serialize() {
|
|
864
|
+
const destination = typeof this.destination === "number"
|
|
865
|
+
? // The destination is a single number
|
|
866
|
+
this.destination & 127
|
|
867
|
+
: // The destination is a bit mask
|
|
868
|
+
(0, safe_1.encodeBitMask)(this.destination, 7)[0] | 128;
|
|
869
|
+
this.payload = Buffer.concat([
|
|
870
|
+
Buffer.from([this.endpointIndex & 127, destination]),
|
|
871
|
+
this.encapsulated.serialize(),
|
|
872
|
+
]);
|
|
873
|
+
return super.serialize();
|
|
874
|
+
}
|
|
875
|
+
toLogEntry(applHost) {
|
|
876
|
+
return {
|
|
877
|
+
...super.toLogEntry(applHost),
|
|
878
|
+
message: {
|
|
879
|
+
source: this.endpointIndex,
|
|
880
|
+
destination: typeof this.destination === "number"
|
|
881
|
+
? this.destination
|
|
882
|
+
: this.destination.join(", "),
|
|
883
|
+
},
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
computeEncapsulationOverhead() {
|
|
887
|
+
// Multi Channel CC adds two bytes for the source and destination endpoint
|
|
888
|
+
return super.computeEncapsulationOverhead() + 2;
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
MultiChannelCCCommandEncapsulation = __decorate([
|
|
892
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.CommandEncapsulation),
|
|
893
|
+
(0, CommandClass_1.expectedCCResponse)(getCCResponseForCommandEncapsulation, testResponseForCommandEncapsulation)
|
|
894
|
+
], MultiChannelCCCommandEncapsulation);
|
|
895
|
+
exports.MultiChannelCCCommandEncapsulation = MultiChannelCCCommandEncapsulation;
|
|
896
|
+
let MultiChannelCCV1Report = class MultiChannelCCV1Report extends MultiChannelCC {
|
|
897
|
+
constructor(host, options) {
|
|
898
|
+
super(host, options);
|
|
899
|
+
// V1 won't be extended in the future, so do an exact check
|
|
900
|
+
(0, safe_1.validatePayload)(this.payload.length === 2);
|
|
901
|
+
this.requestedCC = this.payload[0];
|
|
902
|
+
this.endpointCount = this.payload[1];
|
|
903
|
+
}
|
|
904
|
+
toLogEntry(applHost) {
|
|
905
|
+
return {
|
|
906
|
+
...super.toLogEntry(applHost),
|
|
907
|
+
message: {
|
|
908
|
+
CC: (0, safe_1.getCCName)(this.requestedCC),
|
|
909
|
+
"# of endpoints": this.endpointCount,
|
|
910
|
+
},
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
MultiChannelCCV1Report = __decorate([
|
|
915
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.ReportV1)
|
|
916
|
+
], MultiChannelCCV1Report);
|
|
917
|
+
exports.MultiChannelCCV1Report = MultiChannelCCV1Report;
|
|
918
|
+
function testResponseForMultiChannelV1Get(sent, received) {
|
|
919
|
+
return sent.requestedCC === received.requestedCC;
|
|
920
|
+
}
|
|
921
|
+
let MultiChannelCCV1Get = class MultiChannelCCV1Get extends MultiChannelCC {
|
|
922
|
+
constructor(host, options) {
|
|
923
|
+
super(host, options);
|
|
924
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
925
|
+
// TODO: Deserialize payload
|
|
926
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
this.requestedCC = options.requestedCC;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
serialize() {
|
|
933
|
+
this.payload = Buffer.from([this.requestedCC]);
|
|
934
|
+
return super.serialize();
|
|
935
|
+
}
|
|
936
|
+
toLogEntry(applHost) {
|
|
937
|
+
return {
|
|
938
|
+
...super.toLogEntry(applHost),
|
|
939
|
+
message: { CC: (0, safe_1.getCCName)(this.requestedCC) },
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
MultiChannelCCV1Get = __decorate([
|
|
944
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.GetV1),
|
|
945
|
+
(0, CommandClass_1.expectedCCResponse)(MultiChannelCCV1Report, testResponseForMultiChannelV1Get)
|
|
946
|
+
], MultiChannelCCV1Get);
|
|
947
|
+
exports.MultiChannelCCV1Get = MultiChannelCCV1Get;
|
|
948
|
+
function getResponseForV1CommandEncapsulation(sent) {
|
|
949
|
+
if (sent.encapsulated.expectsCCResponse()) {
|
|
950
|
+
return MultiChannelCCV1CommandEncapsulation;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
function testResponseForV1CommandEncapsulation(sent, received) {
|
|
954
|
+
if (sent.endpointIndex === received.endpointIndex) {
|
|
955
|
+
return "checkEncapsulated";
|
|
956
|
+
}
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
959
|
+
let MultiChannelCCV1CommandEncapsulation = class MultiChannelCCV1CommandEncapsulation extends MultiChannelCC {
|
|
960
|
+
constructor(host, options) {
|
|
961
|
+
super(host, options);
|
|
962
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
963
|
+
(0, safe_1.validatePayload)(this.payload.length >= 1);
|
|
964
|
+
this.endpointIndex = this.payload[0];
|
|
965
|
+
// Some devices send invalid reports, i.e. MultiChannelCCV1CommandEncapsulation, but with V2+ binary format
|
|
966
|
+
// This would be a NoOp CC, but it makes no sense to encapsulate that.
|
|
967
|
+
const isV2withV1Header = this.payload.length >= 2 && this.payload[1] === 0x00;
|
|
968
|
+
// No need to validate further, each CC does it for itself
|
|
969
|
+
this.encapsulated = CommandClass_1.CommandClass.from(this.host, {
|
|
970
|
+
data: this.payload.slice(isV2withV1Header ? 2 : 1),
|
|
971
|
+
fromEncapsulation: true,
|
|
972
|
+
encapCC: this,
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
else {
|
|
976
|
+
this.encapsulated = options.encapsulated;
|
|
977
|
+
// No need to distinguish between source and destination in V1
|
|
978
|
+
this.endpointIndex = this.encapsulated.endpointIndex;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
serialize() {
|
|
982
|
+
this.payload = Buffer.concat([
|
|
983
|
+
Buffer.from([this.endpointIndex]),
|
|
984
|
+
this.encapsulated.serialize(),
|
|
985
|
+
]);
|
|
986
|
+
return super.serialize();
|
|
987
|
+
}
|
|
988
|
+
computeEncapsulationOverhead() {
|
|
989
|
+
// Multi Channel CC V1 adds one byte for the endpoint index
|
|
990
|
+
return super.computeEncapsulationOverhead() + 1;
|
|
991
|
+
}
|
|
992
|
+
toLogEntry(applHost) {
|
|
993
|
+
return {
|
|
994
|
+
...super.toLogEntry(applHost),
|
|
995
|
+
message: { source: this.endpointIndex },
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
MultiChannelCCV1CommandEncapsulation = __decorate([
|
|
1000
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultiChannelCommand.CommandEncapsulationV1),
|
|
1001
|
+
(0, CommandClass_1.expectedCCResponse)(getResponseForV1CommandEncapsulation, testResponseForV1CommandEncapsulation)
|
|
1002
|
+
], MultiChannelCCV1CommandEncapsulation);
|
|
1003
|
+
exports.MultiChannelCCV1CommandEncapsulation = MultiChannelCCV1CommandEncapsulation;
|
|
1004
|
+
//# sourceMappingURL=MultiChannelCC.js.map
|