@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,758 @@
|
|
|
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
|
+
var _a, _b;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.IndicatorCCSupportedGet = exports.IndicatorCCSupportedReport = exports.IndicatorCCGet = exports.IndicatorCCReport = exports.IndicatorCCSet = exports.IndicatorCC = exports.IndicatorCCAPI = exports.getIndicatorValueValueID = exports.getSupportedPropertyIDsValueID = exports.getSupportedIndicatorIDsValueID = void 0;
|
|
11
|
+
function __assertType(argName, typeName, boundHasError) {
|
|
12
|
+
const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
|
|
13
|
+
if (boundHasError()) {
|
|
14
|
+
throw new ZWaveError(typeName ? `${argName} is not a ${typeName}` : `${argName} has the wrong type`, ZWaveErrorCodes.Argument_Invalid);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const __assertType__optional_number = $o => {
|
|
18
|
+
function _number($o) {
|
|
19
|
+
return typeof $o !== "number" ? {} : null;
|
|
20
|
+
}
|
|
21
|
+
function optional__number($o) {
|
|
22
|
+
if ($o !== undefined) {
|
|
23
|
+
const error = _number($o);
|
|
24
|
+
if (error)
|
|
25
|
+
return error;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return optional__number($o);
|
|
30
|
+
};
|
|
31
|
+
const __assertType__su__number_sa__5_ea_5_5_5_eu = $o => {
|
|
32
|
+
function _number($o) {
|
|
33
|
+
return typeof $o !== "number" ? {} : null;
|
|
34
|
+
}
|
|
35
|
+
function _false($o) {
|
|
36
|
+
return $o !== false ? {} : null;
|
|
37
|
+
}
|
|
38
|
+
function _true($o) {
|
|
39
|
+
return $o !== true ? {} : null;
|
|
40
|
+
}
|
|
41
|
+
function su__number__7__8_eu($o) {
|
|
42
|
+
const conditions = [_number, _false, _true];
|
|
43
|
+
for (const condition of conditions) {
|
|
44
|
+
const error = condition($o);
|
|
45
|
+
if (!error)
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
function _5($o) {
|
|
51
|
+
if (typeof $o !== "object" || $o === null || Array.isArray($o))
|
|
52
|
+
return {};
|
|
53
|
+
if ("indicatorId" in $o && $o["indicatorId"] !== undefined) {
|
|
54
|
+
const error = _number($o["indicatorId"]);
|
|
55
|
+
if (error)
|
|
56
|
+
return error;
|
|
57
|
+
}
|
|
58
|
+
else
|
|
59
|
+
return {};
|
|
60
|
+
if ("propertyId" in $o && $o["propertyId"] !== undefined) {
|
|
61
|
+
const error = _number($o["propertyId"]);
|
|
62
|
+
if (error)
|
|
63
|
+
return error;
|
|
64
|
+
}
|
|
65
|
+
else
|
|
66
|
+
return {};
|
|
67
|
+
if ("value" in $o && $o["value"] !== undefined) {
|
|
68
|
+
const error = su__number__7__8_eu($o["value"]);
|
|
69
|
+
if (error)
|
|
70
|
+
return error;
|
|
71
|
+
}
|
|
72
|
+
else
|
|
73
|
+
return {};
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
function sa__5_ea_5($o) {
|
|
77
|
+
if (!Array.isArray($o))
|
|
78
|
+
return {};
|
|
79
|
+
for (let i = 0; i < $o.length; i++) {
|
|
80
|
+
const error = _5($o[i]);
|
|
81
|
+
if (error)
|
|
82
|
+
return error;
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
function su__number_sa__5_ea_5_5_5_eu($o) {
|
|
87
|
+
const conditions = [_number, sa__5_ea_5];
|
|
88
|
+
for (const condition of conditions) {
|
|
89
|
+
const error = condition($o);
|
|
90
|
+
if (!error)
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return {};
|
|
94
|
+
}
|
|
95
|
+
return su__number_sa__5_ea_5_5_5_eu($o);
|
|
96
|
+
};
|
|
97
|
+
const __assertType__number = $o => {
|
|
98
|
+
function _number($o) {
|
|
99
|
+
return typeof $o !== "number" ? {} : null;
|
|
100
|
+
}
|
|
101
|
+
return _number($o);
|
|
102
|
+
};
|
|
103
|
+
const safe_1 = require("@zwave-js/core/safe");
|
|
104
|
+
const safe_2 = require("@zwave-js/shared/safe");
|
|
105
|
+
const API_1 = require("../lib/API");
|
|
106
|
+
const CommandClass_1 = require("../lib/CommandClass");
|
|
107
|
+
const _Types_1 = require("../lib/_Types");
|
|
108
|
+
function getSupportedIndicatorIDsValueID(endpoint) {
|
|
109
|
+
return {
|
|
110
|
+
commandClass: safe_1.CommandClasses.Indicator,
|
|
111
|
+
endpoint,
|
|
112
|
+
property: "supportedIndicatorIds",
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
exports.getSupportedIndicatorIDsValueID = getSupportedIndicatorIDsValueID;
|
|
116
|
+
function getSupportedPropertyIDsValueID(endpoint, indicatorId) {
|
|
117
|
+
return {
|
|
118
|
+
commandClass: safe_1.CommandClasses.Indicator,
|
|
119
|
+
endpoint,
|
|
120
|
+
property: "supportedPropertyIDs",
|
|
121
|
+
propertyKey: indicatorId,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
exports.getSupportedPropertyIDsValueID = getSupportedPropertyIDsValueID;
|
|
125
|
+
function getIndicatorValueValueID(endpoint, indicatorId, propertyId) {
|
|
126
|
+
if (indicatorId === 0) {
|
|
127
|
+
// V1
|
|
128
|
+
return {
|
|
129
|
+
commandClass: safe_1.CommandClasses.Indicator,
|
|
130
|
+
endpoint,
|
|
131
|
+
property: "value",
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
// V2+
|
|
136
|
+
return {
|
|
137
|
+
commandClass: safe_1.CommandClasses.Indicator,
|
|
138
|
+
endpoint,
|
|
139
|
+
property: indicatorId,
|
|
140
|
+
propertyKey: propertyId,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.getIndicatorValueValueID = getIndicatorValueValueID;
|
|
145
|
+
/**
|
|
146
|
+
* Looks up the configured metadata for the given indicator and property
|
|
147
|
+
*/
|
|
148
|
+
function getIndicatorMetadata(configManager, indicatorId, propertyId) {
|
|
149
|
+
const label = configManager.lookupIndicator(indicatorId);
|
|
150
|
+
const prop = configManager.lookupProperty(propertyId);
|
|
151
|
+
if (!label && !prop) {
|
|
152
|
+
return {
|
|
153
|
+
...safe_1.ValueMetadata.UInt8,
|
|
154
|
+
ccSpecific: {
|
|
155
|
+
indicatorId,
|
|
156
|
+
propertyId,
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
else if (!prop) {
|
|
161
|
+
return {
|
|
162
|
+
...safe_1.ValueMetadata.UInt8,
|
|
163
|
+
label,
|
|
164
|
+
ccSpecific: {
|
|
165
|
+
indicatorId,
|
|
166
|
+
propertyId,
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
if (prop.type === "boolean") {
|
|
172
|
+
return {
|
|
173
|
+
...safe_1.ValueMetadata.Boolean,
|
|
174
|
+
label: `${label} - ${prop.label}`,
|
|
175
|
+
description: prop.description,
|
|
176
|
+
readable: !prop.readonly,
|
|
177
|
+
ccSpecific: {
|
|
178
|
+
indicatorId,
|
|
179
|
+
propertyId,
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
// UInt8
|
|
185
|
+
return {
|
|
186
|
+
...safe_1.ValueMetadata.UInt8,
|
|
187
|
+
label: `${label} - ${prop.label}`,
|
|
188
|
+
description: prop.description,
|
|
189
|
+
min: prop.min,
|
|
190
|
+
max: prop.max,
|
|
191
|
+
readable: !prop.readonly,
|
|
192
|
+
ccSpecific: {
|
|
193
|
+
indicatorId,
|
|
194
|
+
propertyId,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function getIndicatorName(configManager, indicatorId) {
|
|
201
|
+
var _c;
|
|
202
|
+
let indicatorName = "0 (default)";
|
|
203
|
+
if (indicatorId) {
|
|
204
|
+
indicatorName = `${(0, safe_2.num2hex)(indicatorId)} (${(_c = configManager.lookupIndicator(indicatorId)) !== null && _c !== void 0 ? _c : `Unknown`})`;
|
|
205
|
+
}
|
|
206
|
+
return indicatorName;
|
|
207
|
+
}
|
|
208
|
+
const MAX_INDICATOR_OBJECTS = 31;
|
|
209
|
+
let IndicatorCCAPI = class IndicatorCCAPI extends API_1.CCAPI {
|
|
210
|
+
constructor() {
|
|
211
|
+
super(...arguments);
|
|
212
|
+
this[_a] = async ({ property, propertyKey }, value) => {
|
|
213
|
+
if (property === "value") {
|
|
214
|
+
// V1 value
|
|
215
|
+
if (typeof value !== "number") {
|
|
216
|
+
(0, API_1.throwWrongValueType)(this.ccId, property, "number", typeof value);
|
|
217
|
+
}
|
|
218
|
+
await this.set(value);
|
|
219
|
+
}
|
|
220
|
+
else if (typeof property === "number" &&
|
|
221
|
+
typeof propertyKey === "number") {
|
|
222
|
+
const indicatorId = property;
|
|
223
|
+
const propertyId = propertyKey;
|
|
224
|
+
const expectedType = getIndicatorMetadata(this.applHost.configManager, indicatorId, propertyId).type;
|
|
225
|
+
// V2+ value
|
|
226
|
+
if (typeof value !== expectedType) {
|
|
227
|
+
(0, API_1.throwWrongValueType)(this.ccId, property, expectedType, typeof value);
|
|
228
|
+
}
|
|
229
|
+
await this.set([
|
|
230
|
+
{
|
|
231
|
+
indicatorId: property,
|
|
232
|
+
propertyId: propertyKey,
|
|
233
|
+
value: value,
|
|
234
|
+
},
|
|
235
|
+
]);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
(0, API_1.throwUnsupportedProperty)(this.ccId, property);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
this[_b] = async ({ property, }) => {
|
|
242
|
+
if (property === "value")
|
|
243
|
+
return this.get();
|
|
244
|
+
if (typeof property === "number") {
|
|
245
|
+
return this.get(property);
|
|
246
|
+
}
|
|
247
|
+
(0, API_1.throwUnsupportedProperty)(this.ccId, property);
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
supportsCommand(cmd) {
|
|
251
|
+
switch (cmd) {
|
|
252
|
+
case _Types_1.IndicatorCommand.Get:
|
|
253
|
+
return this.isSinglecast();
|
|
254
|
+
case _Types_1.IndicatorCommand.Set:
|
|
255
|
+
return true; // This is mandatory
|
|
256
|
+
case _Types_1.IndicatorCommand.SupportedGet:
|
|
257
|
+
return this.version >= 2 && this.isSinglecast();
|
|
258
|
+
}
|
|
259
|
+
return super.supportsCommand(cmd);
|
|
260
|
+
}
|
|
261
|
+
async get(indicatorId) {
|
|
262
|
+
__assertType("indicatorId", "(optional) number", __assertType__optional_number.bind(void 0, indicatorId));
|
|
263
|
+
this.assertSupportsCommand(_Types_1.IndicatorCommand, _Types_1.IndicatorCommand.Get);
|
|
264
|
+
const cc = new IndicatorCCGet(this.applHost, {
|
|
265
|
+
nodeId: this.endpoint.nodeId,
|
|
266
|
+
endpoint: this.endpoint.index,
|
|
267
|
+
indicatorId,
|
|
268
|
+
});
|
|
269
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
270
|
+
if (!response)
|
|
271
|
+
return;
|
|
272
|
+
if (response.values)
|
|
273
|
+
return response.values;
|
|
274
|
+
return response.value;
|
|
275
|
+
}
|
|
276
|
+
async set(value) {
|
|
277
|
+
__assertType("value", undefined, __assertType__su__number_sa__5_ea_5_5_5_eu.bind(void 0, value));
|
|
278
|
+
this.assertSupportsCommand(_Types_1.IndicatorCommand, _Types_1.IndicatorCommand.Set);
|
|
279
|
+
const cc = new IndicatorCCSet(this.applHost, {
|
|
280
|
+
nodeId: this.endpoint.nodeId,
|
|
281
|
+
endpoint: this.endpoint.index,
|
|
282
|
+
...(typeof value === "number" ? { value } : { values: value }),
|
|
283
|
+
});
|
|
284
|
+
await this.applHost.sendCommand(cc, this.commandOptions);
|
|
285
|
+
}
|
|
286
|
+
async getSupported(indicatorId) {
|
|
287
|
+
__assertType("indicatorId", "number", __assertType__number.bind(void 0, indicatorId));
|
|
288
|
+
this.assertSupportsCommand(_Types_1.IndicatorCommand, _Types_1.IndicatorCommand.SupportedGet);
|
|
289
|
+
const cc = new IndicatorCCSupportedGet(this.applHost, {
|
|
290
|
+
nodeId: this.endpoint.nodeId,
|
|
291
|
+
endpoint: this.endpoint.index,
|
|
292
|
+
indicatorId,
|
|
293
|
+
});
|
|
294
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
295
|
+
if (response) {
|
|
296
|
+
return {
|
|
297
|
+
// Include the actual indicator ID if 0x00 was requested
|
|
298
|
+
...(indicatorId === 0x00
|
|
299
|
+
? { indicatorId: response.indicatorId }
|
|
300
|
+
: undefined),
|
|
301
|
+
supportedProperties: response.supportedProperties,
|
|
302
|
+
nextIndicatorId: response.nextIndicatorId,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Instructs the node to identify itself. Available starting with V3 of this CC.
|
|
308
|
+
*/
|
|
309
|
+
async identify() {
|
|
310
|
+
if (this.version <= 3) {
|
|
311
|
+
throw new safe_1.ZWaveError(`The identify command is only supported in Version 3 and above`, safe_1.ZWaveErrorCodes.CC_NotSupported);
|
|
312
|
+
}
|
|
313
|
+
await this.set([
|
|
314
|
+
{
|
|
315
|
+
indicatorId: 0x50,
|
|
316
|
+
propertyId: 0x03,
|
|
317
|
+
value: 0x08,
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
indicatorId: 0x50,
|
|
321
|
+
propertyId: 0x04,
|
|
322
|
+
value: 0x03,
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
indicatorId: 0x50,
|
|
326
|
+
propertyId: 0x05,
|
|
327
|
+
value: 0x06,
|
|
328
|
+
},
|
|
329
|
+
]);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
_a = API_1.SET_VALUE, _b = API_1.POLL_VALUE;
|
|
333
|
+
IndicatorCCAPI = __decorate([
|
|
334
|
+
(0, CommandClass_1.API)(safe_1.CommandClasses.Indicator)
|
|
335
|
+
], IndicatorCCAPI);
|
|
336
|
+
exports.IndicatorCCAPI = IndicatorCCAPI;
|
|
337
|
+
let IndicatorCC = class IndicatorCC extends CommandClass_1.CommandClass {
|
|
338
|
+
constructor(host, options) {
|
|
339
|
+
super(host, options);
|
|
340
|
+
this.registerValue(getSupportedIndicatorIDsValueID(undefined).property, { internal: true });
|
|
341
|
+
this.registerValue(getSupportedPropertyIDsValueID(undefined, 0).property, { internal: true });
|
|
342
|
+
}
|
|
343
|
+
async interview(applHost) {
|
|
344
|
+
var _c;
|
|
345
|
+
const node = this.getNode(applHost);
|
|
346
|
+
const endpoint = this.getEndpoint(applHost);
|
|
347
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses.Indicator, applHost, endpoint).withOptions({
|
|
348
|
+
priority: safe_1.MessagePriority.NodeQuery,
|
|
349
|
+
});
|
|
350
|
+
const valueDB = this.getValueDB(applHost);
|
|
351
|
+
applHost.controllerLog.logNode(node.id, {
|
|
352
|
+
endpoint: this.endpointIndex,
|
|
353
|
+
message: `Interviewing ${this.ccName}...`,
|
|
354
|
+
direction: "none",
|
|
355
|
+
});
|
|
356
|
+
if (this.version > 1) {
|
|
357
|
+
applHost.controllerLog.logNode(node.id, {
|
|
358
|
+
endpoint: this.endpointIndex,
|
|
359
|
+
message: "scanning supported indicator IDs...",
|
|
360
|
+
direction: "outbound",
|
|
361
|
+
});
|
|
362
|
+
// Query ID 0 to get the first supported ID
|
|
363
|
+
let curId = 0x00;
|
|
364
|
+
const supportedIndicatorIds = [];
|
|
365
|
+
do {
|
|
366
|
+
const supportedResponse = await api.getSupported(curId);
|
|
367
|
+
if (!supportedResponse) {
|
|
368
|
+
applHost.controllerLog.logNode(node.id, {
|
|
369
|
+
endpoint: this.endpointIndex,
|
|
370
|
+
message: "Time out while scanning supported indicator IDs, skipping interview...",
|
|
371
|
+
level: "warn",
|
|
372
|
+
});
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
supportedIndicatorIds.push((_c = supportedResponse.indicatorId) !== null && _c !== void 0 ? _c : curId);
|
|
376
|
+
curId = supportedResponse.nextIndicatorId;
|
|
377
|
+
} while (curId !== 0x00);
|
|
378
|
+
// The IDs are not stored by the report CCs so store them here once we have all of them
|
|
379
|
+
valueDB.setValue(getSupportedIndicatorIDsValueID(this.endpointIndex), supportedIndicatorIds);
|
|
380
|
+
const logMessage = `supported indicator IDs: ${supportedIndicatorIds.join(", ")}`;
|
|
381
|
+
applHost.controllerLog.logNode(node.id, {
|
|
382
|
+
endpoint: this.endpointIndex,
|
|
383
|
+
message: logMessage,
|
|
384
|
+
direction: "inbound",
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
// Query current values
|
|
388
|
+
await this.refreshValues(applHost);
|
|
389
|
+
// Remember that the interview is complete
|
|
390
|
+
this.setInterviewComplete(applHost, true);
|
|
391
|
+
}
|
|
392
|
+
async refreshValues(applHost) {
|
|
393
|
+
var _c;
|
|
394
|
+
const node = this.getNode(applHost);
|
|
395
|
+
const endpoint = this.getEndpoint(applHost);
|
|
396
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses.Indicator, applHost, endpoint).withOptions({
|
|
397
|
+
priority: safe_1.MessagePriority.NodeQuery,
|
|
398
|
+
});
|
|
399
|
+
const valueDB = this.getValueDB(applHost);
|
|
400
|
+
if (this.version === 1) {
|
|
401
|
+
applHost.controllerLog.logNode(node.id, {
|
|
402
|
+
endpoint: this.endpointIndex,
|
|
403
|
+
message: "requesting current indicator value...",
|
|
404
|
+
direction: "outbound",
|
|
405
|
+
});
|
|
406
|
+
await api.get();
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
const supportedIndicatorIds = (_c = valueDB.getValue(getSupportedIndicatorIDsValueID(this.endpointIndex))) !== null && _c !== void 0 ? _c : [];
|
|
410
|
+
for (const indicatorId of supportedIndicatorIds) {
|
|
411
|
+
applHost.controllerLog.logNode(node.id, {
|
|
412
|
+
endpoint: this.endpointIndex,
|
|
413
|
+
message: `requesting current indicator value (id = ${(0, safe_2.num2hex)(indicatorId)})...`,
|
|
414
|
+
direction: "outbound",
|
|
415
|
+
});
|
|
416
|
+
await api.get(indicatorId);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
translatePropertyKey(applHost, property, propertyKey) {
|
|
421
|
+
if (property === "value") {
|
|
422
|
+
// CC version 1 only has a single value that doesn't need to be translated
|
|
423
|
+
return undefined;
|
|
424
|
+
}
|
|
425
|
+
else if (typeof property === "number" &&
|
|
426
|
+
typeof propertyKey === "number") {
|
|
427
|
+
// The indicator property is our property key
|
|
428
|
+
const prop = applHost.configManager.lookupProperty(propertyKey);
|
|
429
|
+
if (prop)
|
|
430
|
+
return prop.label;
|
|
431
|
+
}
|
|
432
|
+
return super.translatePropertyKey(applHost, property, propertyKey);
|
|
433
|
+
}
|
|
434
|
+
translateProperty(applHost, property, propertyKey) {
|
|
435
|
+
if (typeof property === "number" && typeof propertyKey === "number") {
|
|
436
|
+
// The indicator corresponds to our property
|
|
437
|
+
const label = applHost.configManager.lookupIndicator(property);
|
|
438
|
+
if (label)
|
|
439
|
+
return label;
|
|
440
|
+
}
|
|
441
|
+
return super.translateProperty(applHost, property, propertyKey);
|
|
442
|
+
}
|
|
443
|
+
supportsV2Indicators(applHost) {
|
|
444
|
+
const valueDB = this.getValueDB(applHost);
|
|
445
|
+
// First test if there are any indicator ids defined
|
|
446
|
+
const supportedIndicatorIds = valueDB.getValue(getSupportedIndicatorIDsValueID(this.endpointIndex));
|
|
447
|
+
if (!(supportedIndicatorIds === null || supportedIndicatorIds === void 0 ? void 0 : supportedIndicatorIds.length))
|
|
448
|
+
return false;
|
|
449
|
+
// Then test if there are any property ids defined
|
|
450
|
+
return supportedIndicatorIds.some((indicatorId) => {
|
|
451
|
+
var _c;
|
|
452
|
+
return !!((_c = valueDB.getValue(getSupportedPropertyIDsValueID(this.endpointIndex, indicatorId))) === null || _c === void 0 ? void 0 : _c.length);
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
IndicatorCC = __decorate([
|
|
457
|
+
(0, CommandClass_1.commandClass)(safe_1.CommandClasses.Indicator),
|
|
458
|
+
(0, CommandClass_1.implementedVersion)(3)
|
|
459
|
+
], IndicatorCC);
|
|
460
|
+
exports.IndicatorCC = IndicatorCC;
|
|
461
|
+
let IndicatorCCSet = class IndicatorCCSet extends IndicatorCC {
|
|
462
|
+
constructor(host, options) {
|
|
463
|
+
super(host, options);
|
|
464
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
465
|
+
// TODO: Deserialize payload
|
|
466
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
if (this.version === 1) {
|
|
470
|
+
if (!("value" in options)) {
|
|
471
|
+
throw new safe_1.ZWaveError(`Node ${this.nodeId} only supports IndicatorCC V1 which requires a single value to be set`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
472
|
+
}
|
|
473
|
+
this.indicator0Value = options.value;
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
if ("value" in options) {
|
|
477
|
+
this.indicator0Value = options.value;
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
if (options.values.length > MAX_INDICATOR_OBJECTS) {
|
|
481
|
+
throw new safe_1.ZWaveError(`Only ${MAX_INDICATOR_OBJECTS} indicator values can be set at a time!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
482
|
+
}
|
|
483
|
+
this.values = options.values;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
serialize() {
|
|
489
|
+
if (this.indicator0Value != undefined) {
|
|
490
|
+
this.payload = Buffer.from([this.indicator0Value]);
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
const values = this.values;
|
|
494
|
+
const objCount = values.length & MAX_INDICATOR_OBJECTS;
|
|
495
|
+
const valuesFlat = values
|
|
496
|
+
.slice(0, objCount + 1)
|
|
497
|
+
.map((o) => [
|
|
498
|
+
o.indicatorId,
|
|
499
|
+
o.propertyId,
|
|
500
|
+
typeof o.value === "number"
|
|
501
|
+
? o.value
|
|
502
|
+
: o.value
|
|
503
|
+
? 0xff
|
|
504
|
+
: 0x00,
|
|
505
|
+
])
|
|
506
|
+
.reduce((acc, cur) => acc.concat(...cur), []);
|
|
507
|
+
this.payload = Buffer.concat([
|
|
508
|
+
Buffer.from([0, objCount]),
|
|
509
|
+
Buffer.from(valuesFlat),
|
|
510
|
+
]);
|
|
511
|
+
}
|
|
512
|
+
return super.serialize();
|
|
513
|
+
}
|
|
514
|
+
toLogEntry(applHost) {
|
|
515
|
+
const message = {};
|
|
516
|
+
if (this.indicator0Value != undefined) {
|
|
517
|
+
message["indicator 0 value"] = this.indicator0Value;
|
|
518
|
+
}
|
|
519
|
+
if (this.values != undefined) {
|
|
520
|
+
message.values = `${this.values
|
|
521
|
+
.map((v) => `
|
|
522
|
+
· indicatorId: ${v.indicatorId}
|
|
523
|
+
propertyId: ${v.propertyId}
|
|
524
|
+
value: ${v.value}`)
|
|
525
|
+
.join("")}`;
|
|
526
|
+
}
|
|
527
|
+
return {
|
|
528
|
+
...super.toLogEntry(applHost),
|
|
529
|
+
message,
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
IndicatorCCSet = __decorate([
|
|
534
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IndicatorCommand.Set)
|
|
535
|
+
], IndicatorCCSet);
|
|
536
|
+
exports.IndicatorCCSet = IndicatorCCSet;
|
|
537
|
+
let IndicatorCCReport = class IndicatorCCReport extends IndicatorCC {
|
|
538
|
+
constructor(host, options) {
|
|
539
|
+
super(host, options);
|
|
540
|
+
(0, safe_1.validatePayload)(this.payload.length >= 1);
|
|
541
|
+
const objCount = this.payload.length >= 2 ? this.payload[1] & 0b11111 : 0;
|
|
542
|
+
if (objCount === 0) {
|
|
543
|
+
this.value = this.payload[0];
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2 + 3 * objCount);
|
|
547
|
+
this.values = [];
|
|
548
|
+
for (let i = 0; i < objCount; i++) {
|
|
549
|
+
const offset = 2 + 3 * i;
|
|
550
|
+
const value = {
|
|
551
|
+
indicatorId: this.payload[offset],
|
|
552
|
+
propertyId: this.payload[offset + 1],
|
|
553
|
+
value: this.payload[offset + 2],
|
|
554
|
+
};
|
|
555
|
+
this.values.push(value);
|
|
556
|
+
}
|
|
557
|
+
// TODO: Think if we want this:
|
|
558
|
+
// // If not all Property IDs are included in the command for the actual Indicator ID,
|
|
559
|
+
// // a controlling node MUST assume non-specified Property IDs values to be 0x00.
|
|
560
|
+
// const indicatorId = this.values[0].indicatorId;
|
|
561
|
+
// const supportedIndicatorProperties =
|
|
562
|
+
// valueDB.getValue<number[]>(
|
|
563
|
+
// getSupportedPropertyIDsValueID(
|
|
564
|
+
// this.endpointIndex,
|
|
565
|
+
// indicatorId,
|
|
566
|
+
// ),
|
|
567
|
+
// ) ?? [];
|
|
568
|
+
// // Find out which ones are missing
|
|
569
|
+
// const missingIndicatorProperties = supportedIndicatorProperties.filter(
|
|
570
|
+
// prop =>
|
|
571
|
+
// !this.values!.find(({ propertyId }) => prop === propertyId),
|
|
572
|
+
// );
|
|
573
|
+
// // And assume they are 0 (false)
|
|
574
|
+
// for (const missing of missingIndicatorProperties) {
|
|
575
|
+
// this.setIndicatorValue({
|
|
576
|
+
// indicatorId,
|
|
577
|
+
// propertyId: missing,
|
|
578
|
+
// value: 0,
|
|
579
|
+
// });
|
|
580
|
+
// }
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
persistValues(applHost) {
|
|
584
|
+
if (!super.persistValues(applHost))
|
|
585
|
+
return false;
|
|
586
|
+
const valueDB = this.getValueDB(applHost);
|
|
587
|
+
if (this.value != undefined) {
|
|
588
|
+
if (!this.supportsV2Indicators(applHost)) {
|
|
589
|
+
// Publish the value
|
|
590
|
+
const valueId = getIndicatorValueValueID(this.endpointIndex, 0, 1);
|
|
591
|
+
valueDB.setMetadata(valueId, {
|
|
592
|
+
...safe_1.ValueMetadata.UInt8,
|
|
593
|
+
label: "Indicator value",
|
|
594
|
+
ccSpecific: {
|
|
595
|
+
indicatorId: 0,
|
|
596
|
+
},
|
|
597
|
+
});
|
|
598
|
+
valueDB.setValue(valueId, this.value);
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
if (this.isSinglecast()) {
|
|
602
|
+
// Don't!
|
|
603
|
+
applHost.controllerLog.logNode(this.nodeId, {
|
|
604
|
+
message: `ignoring V1 indicator report because the node supports V2 indicators`,
|
|
605
|
+
direction: "none",
|
|
606
|
+
endpoint: this.endpointIndex,
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
else if (this.values) {
|
|
612
|
+
for (const value of this.values) {
|
|
613
|
+
this.setIndicatorValue(applHost, value);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return true;
|
|
617
|
+
}
|
|
618
|
+
setIndicatorValue(applHost, value) {
|
|
619
|
+
const valueDB = this.getValueDB(applHost);
|
|
620
|
+
const metadata = getIndicatorMetadata(applHost.configManager, value.indicatorId, value.propertyId);
|
|
621
|
+
// Some values need to be converted
|
|
622
|
+
if (metadata.type === "boolean") {
|
|
623
|
+
value.value = !!value.value;
|
|
624
|
+
}
|
|
625
|
+
// Publish the value
|
|
626
|
+
const valueId = getIndicatorValueValueID(this.endpointIndex, value.indicatorId, value.propertyId);
|
|
627
|
+
valueDB.setMetadata(valueId, metadata);
|
|
628
|
+
valueDB.setValue(valueId, value.value);
|
|
629
|
+
}
|
|
630
|
+
toLogEntry(applHost) {
|
|
631
|
+
const message = {};
|
|
632
|
+
if (this.value != undefined) {
|
|
633
|
+
message["indicator 0 value"] = this.value;
|
|
634
|
+
}
|
|
635
|
+
if (this.values != undefined) {
|
|
636
|
+
message.values = `${this.values
|
|
637
|
+
.map((v) => `
|
|
638
|
+
· indicatorId: ${v.indicatorId}
|
|
639
|
+
propertyId: ${v.propertyId}
|
|
640
|
+
value: ${v.value}`)
|
|
641
|
+
.join("")}`;
|
|
642
|
+
}
|
|
643
|
+
return {
|
|
644
|
+
...super.toLogEntry(applHost),
|
|
645
|
+
message,
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
IndicatorCCReport = __decorate([
|
|
650
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IndicatorCommand.Report)
|
|
651
|
+
], IndicatorCCReport);
|
|
652
|
+
exports.IndicatorCCReport = IndicatorCCReport;
|
|
653
|
+
let IndicatorCCGet = class IndicatorCCGet extends IndicatorCC {
|
|
654
|
+
constructor(host, options) {
|
|
655
|
+
super(host, options);
|
|
656
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
657
|
+
// TODO: Deserialize payload
|
|
658
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
659
|
+
}
|
|
660
|
+
else {
|
|
661
|
+
this.indicatorId = options.indicatorId;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
serialize() {
|
|
665
|
+
if (this.indicatorId != undefined) {
|
|
666
|
+
this.payload = Buffer.from([this.indicatorId]);
|
|
667
|
+
}
|
|
668
|
+
return super.serialize();
|
|
669
|
+
}
|
|
670
|
+
toLogEntry(applHost) {
|
|
671
|
+
return {
|
|
672
|
+
...super.toLogEntry(applHost),
|
|
673
|
+
message: {
|
|
674
|
+
indicator: getIndicatorName(applHost.configManager, this.indicatorId),
|
|
675
|
+
},
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
IndicatorCCGet = __decorate([
|
|
680
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IndicatorCommand.Get),
|
|
681
|
+
(0, CommandClass_1.expectedCCResponse)(IndicatorCCReport)
|
|
682
|
+
], IndicatorCCGet);
|
|
683
|
+
exports.IndicatorCCGet = IndicatorCCGet;
|
|
684
|
+
let IndicatorCCSupportedReport = class IndicatorCCSupportedReport extends IndicatorCC {
|
|
685
|
+
constructor(host, options) {
|
|
686
|
+
super(host, options);
|
|
687
|
+
(0, safe_1.validatePayload)(this.payload.length >= 3);
|
|
688
|
+
this.indicatorId = this.payload[0];
|
|
689
|
+
this.nextIndicatorId = this.payload[1];
|
|
690
|
+
const bitMaskLength = this.payload[2] & 0b11111;
|
|
691
|
+
if (bitMaskLength === 0) {
|
|
692
|
+
this.supportedProperties = [];
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
(0, safe_1.validatePayload)(this.payload.length >= 3 + bitMaskLength);
|
|
696
|
+
// The bit mask starts at 0, but bit 0 is not used
|
|
697
|
+
this.supportedProperties = (0, safe_1.parseBitMask)(this.payload.slice(3, 3 + bitMaskLength), 0).filter((v) => v !== 0);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
persistValues(applHost) {
|
|
701
|
+
if (!super.persistValues(applHost))
|
|
702
|
+
return false;
|
|
703
|
+
if (this.indicatorId !== 0x00) {
|
|
704
|
+
// Remember which property IDs are supported
|
|
705
|
+
this.getValueDB(applHost).setValue(getSupportedPropertyIDsValueID(this.endpointIndex, this.indicatorId), this.supportedProperties);
|
|
706
|
+
}
|
|
707
|
+
return true;
|
|
708
|
+
}
|
|
709
|
+
toLogEntry(applHost) {
|
|
710
|
+
return {
|
|
711
|
+
...super.toLogEntry(applHost),
|
|
712
|
+
message: {
|
|
713
|
+
indicator: getIndicatorName(applHost.configManager, this.indicatorId),
|
|
714
|
+
"supported properties": `${this.supportedProperties
|
|
715
|
+
.map((id) => {
|
|
716
|
+
var _c, _d;
|
|
717
|
+
return (_d = (_c = applHost.configManager.lookupProperty(id)) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : `Unknown (${(0, safe_2.num2hex)(id)})`;
|
|
718
|
+
})
|
|
719
|
+
.join(", ")}`,
|
|
720
|
+
"next indicator": getIndicatorName(applHost.configManager, this.nextIndicatorId),
|
|
721
|
+
},
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
IndicatorCCSupportedReport = __decorate([
|
|
726
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IndicatorCommand.SupportedReport)
|
|
727
|
+
], IndicatorCCSupportedReport);
|
|
728
|
+
exports.IndicatorCCSupportedReport = IndicatorCCSupportedReport;
|
|
729
|
+
let IndicatorCCSupportedGet = class IndicatorCCSupportedGet extends IndicatorCC {
|
|
730
|
+
constructor(host, options) {
|
|
731
|
+
super(host, options);
|
|
732
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
733
|
+
// TODO: Deserialize payload
|
|
734
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
735
|
+
}
|
|
736
|
+
else {
|
|
737
|
+
this.indicatorId = options.indicatorId;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
serialize() {
|
|
741
|
+
this.payload = Buffer.from([this.indicatorId]);
|
|
742
|
+
return super.serialize();
|
|
743
|
+
}
|
|
744
|
+
toLogEntry(applHost) {
|
|
745
|
+
return {
|
|
746
|
+
...super.toLogEntry(applHost),
|
|
747
|
+
message: {
|
|
748
|
+
indicator: getIndicatorName(applHost.configManager, this.indicatorId),
|
|
749
|
+
},
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
IndicatorCCSupportedGet = __decorate([
|
|
754
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IndicatorCommand.SupportedGet),
|
|
755
|
+
(0, CommandClass_1.expectedCCResponse)(IndicatorCCSupportedReport)
|
|
756
|
+
], IndicatorCCSupportedGet);
|
|
757
|
+
exports.IndicatorCCSupportedGet = IndicatorCCSupportedGet;
|
|
758
|
+
//# sourceMappingURL=IndicatorCC.js.map
|