@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,774 @@
|
|
|
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.MultilevelSwitchCCSupportedGet = exports.MultilevelSwitchCCSupportedReport = exports.MultilevelSwitchCCStopLevelChange = exports.MultilevelSwitchCCStartLevelChange = exports.MultilevelSwitchCCGet = exports.MultilevelSwitchCCReport = exports.MultilevelSwitchCCSet = exports.MultilevelSwitchCC = exports.MultilevelSwitchCCAPI = exports.getCompatEventValueId = 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__number = $o => {
|
|
18
|
+
function _number($o) {
|
|
19
|
+
return typeof $o !== "number" ? {} : null;
|
|
20
|
+
}
|
|
21
|
+
return _number($o);
|
|
22
|
+
};
|
|
23
|
+
const __assertType__optional_su__string__2_eu = $o => {
|
|
24
|
+
function _string($o) {
|
|
25
|
+
return typeof $o !== "string" ? {} : null;
|
|
26
|
+
}
|
|
27
|
+
function _2($o) {
|
|
28
|
+
return !($o instanceof require("@zwave-js/core/safe").Duration) ? {} : null;
|
|
29
|
+
}
|
|
30
|
+
function su__string__2_eu($o) {
|
|
31
|
+
const conditions = [_string, _2];
|
|
32
|
+
for (const condition of conditions) {
|
|
33
|
+
const error = condition($o);
|
|
34
|
+
if (!error)
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return {};
|
|
38
|
+
}
|
|
39
|
+
function optional_su__string__2_eu($o) {
|
|
40
|
+
if ($o !== undefined) {
|
|
41
|
+
const error = su__string__2_eu($o);
|
|
42
|
+
if (error)
|
|
43
|
+
return error;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return optional_su__string__2_eu($o);
|
|
48
|
+
};
|
|
49
|
+
const __assertType__MultilevelSwitchCCStartLevelChangeOptions = $o => {
|
|
50
|
+
function _8($o) {
|
|
51
|
+
return $o !== "up" ? {} : null;
|
|
52
|
+
}
|
|
53
|
+
function _9($o) {
|
|
54
|
+
return $o !== "down" ? {} : null;
|
|
55
|
+
}
|
|
56
|
+
function su__8__9_eu($o) {
|
|
57
|
+
const conditions = [_8, _9];
|
|
58
|
+
for (const condition of conditions) {
|
|
59
|
+
const error = condition($o);
|
|
60
|
+
if (!error)
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return {};
|
|
64
|
+
}
|
|
65
|
+
function _2($o) {
|
|
66
|
+
if (typeof $o !== "object" || $o === null || Array.isArray($o))
|
|
67
|
+
return {};
|
|
68
|
+
if ("direction" in $o && $o["direction"] !== undefined) {
|
|
69
|
+
const error = su__8__9_eu($o["direction"]);
|
|
70
|
+
if (error)
|
|
71
|
+
return error;
|
|
72
|
+
}
|
|
73
|
+
else
|
|
74
|
+
return {};
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
function _true($o) {
|
|
78
|
+
return $o !== true ? {} : null;
|
|
79
|
+
}
|
|
80
|
+
function _number($o) {
|
|
81
|
+
return typeof $o !== "number" ? {} : null;
|
|
82
|
+
}
|
|
83
|
+
function _3($o) {
|
|
84
|
+
if (typeof $o !== "object" || $o === null || Array.isArray($o))
|
|
85
|
+
return {};
|
|
86
|
+
if ("ignoreStartLevel" in $o && $o["ignoreStartLevel"] !== undefined) {
|
|
87
|
+
const error = _true($o["ignoreStartLevel"]);
|
|
88
|
+
if (error)
|
|
89
|
+
return error;
|
|
90
|
+
}
|
|
91
|
+
else
|
|
92
|
+
return {};
|
|
93
|
+
if ("startLevel" in $o && $o["startLevel"] !== undefined) {
|
|
94
|
+
const error = _number($o["startLevel"]);
|
|
95
|
+
if (error)
|
|
96
|
+
return error;
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
function _string($o) {
|
|
101
|
+
return typeof $o !== "string" ? {} : null;
|
|
102
|
+
}
|
|
103
|
+
function _12($o) {
|
|
104
|
+
return !($o instanceof require("@zwave-js/core/safe").Duration) ? {} : null;
|
|
105
|
+
}
|
|
106
|
+
function su__string__12_eu($o) {
|
|
107
|
+
const conditions = [_string, _12];
|
|
108
|
+
for (const condition of conditions) {
|
|
109
|
+
const error = condition($o);
|
|
110
|
+
if (!error)
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
return {};
|
|
114
|
+
}
|
|
115
|
+
function _4($o) {
|
|
116
|
+
if (typeof $o !== "object" || $o === null || Array.isArray($o))
|
|
117
|
+
return {};
|
|
118
|
+
if ("duration" in $o && $o["duration"] !== undefined) {
|
|
119
|
+
const error = su__string__12_eu($o["duration"]);
|
|
120
|
+
if (error)
|
|
121
|
+
return error;
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
function si__2__3__4_ei($o) {
|
|
126
|
+
const conditions = [_2, _3, _4];
|
|
127
|
+
for (const condition of conditions) {
|
|
128
|
+
const error = condition($o);
|
|
129
|
+
if (error)
|
|
130
|
+
return error;
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
function _false($o) {
|
|
135
|
+
return $o !== false ? {} : null;
|
|
136
|
+
}
|
|
137
|
+
function _6($o) {
|
|
138
|
+
if (typeof $o !== "object" || $o === null || Array.isArray($o))
|
|
139
|
+
return {};
|
|
140
|
+
if ("ignoreStartLevel" in $o && $o["ignoreStartLevel"] !== undefined) {
|
|
141
|
+
const error = _false($o["ignoreStartLevel"]);
|
|
142
|
+
if (error)
|
|
143
|
+
return error;
|
|
144
|
+
}
|
|
145
|
+
else
|
|
146
|
+
return {};
|
|
147
|
+
if ("startLevel" in $o && $o["startLevel"] !== undefined) {
|
|
148
|
+
const error = _number($o["startLevel"]);
|
|
149
|
+
if (error)
|
|
150
|
+
return error;
|
|
151
|
+
}
|
|
152
|
+
else
|
|
153
|
+
return {};
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
function si__2__6__4_ei($o) {
|
|
157
|
+
const conditions = [_2, _6, _4];
|
|
158
|
+
for (const condition of conditions) {
|
|
159
|
+
const error = condition($o);
|
|
160
|
+
if (error)
|
|
161
|
+
return error;
|
|
162
|
+
}
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
function su_si__2__3__4_ei_si__2__6__4_ei_eu($o) {
|
|
166
|
+
const conditions = [si__2__3__4_ei, si__2__6__4_ei];
|
|
167
|
+
for (const condition of conditions) {
|
|
168
|
+
const error = condition($o);
|
|
169
|
+
if (!error)
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
return {};
|
|
173
|
+
}
|
|
174
|
+
return su_si__2__3__4_ei_si__2__6__4_ei_eu($o);
|
|
175
|
+
};
|
|
176
|
+
const safe_1 = require("@zwave-js/core/safe");
|
|
177
|
+
const safe_2 = require("@zwave-js/shared/safe");
|
|
178
|
+
const API_1 = require("../lib/API");
|
|
179
|
+
const CommandClass_1 = require("../lib/CommandClass");
|
|
180
|
+
const _Types_1 = require("../lib/_Types");
|
|
181
|
+
/**
|
|
182
|
+
* Translates a switch type into two actions that may be performed. Unknown types default to Down/Up
|
|
183
|
+
*/
|
|
184
|
+
function switchTypeToActions(switchType) {
|
|
185
|
+
if (!switchType.includes("/"))
|
|
186
|
+
switchType = _Types_1.SwitchType[0x02]; // Down/Up
|
|
187
|
+
return switchType.split("/", 2);
|
|
188
|
+
}
|
|
189
|
+
const switchTypeProperties = Object.keys(_Types_1.SwitchType)
|
|
190
|
+
.filter((key) => key.indexOf("/") > -1)
|
|
191
|
+
.map((key) => switchTypeToActions(key))
|
|
192
|
+
.reduce((acc, cur) => acc.concat(...cur), []);
|
|
193
|
+
function getCurrentValueValueId(endpoint) {
|
|
194
|
+
return {
|
|
195
|
+
commandClass: safe_1.CommandClasses["Multilevel Switch"],
|
|
196
|
+
endpoint,
|
|
197
|
+
property: "currentValue",
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/** Returns the ValueID used to remember whether a node supports supervision on the start/stop level change commands*/
|
|
201
|
+
function getSuperviseStartStopLevelChangeValueId() {
|
|
202
|
+
return {
|
|
203
|
+
commandClass: safe_1.CommandClasses["Multilevel Switch"],
|
|
204
|
+
property: "superviseStartStopLevelChange",
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function getCompatEventValueId(endpoint) {
|
|
208
|
+
return {
|
|
209
|
+
commandClass: safe_1.CommandClasses["Multilevel Switch"],
|
|
210
|
+
endpoint,
|
|
211
|
+
property: "event",
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
exports.getCompatEventValueId = getCompatEventValueId;
|
|
215
|
+
let MultilevelSwitchCCAPI = class MultilevelSwitchCCAPI extends API_1.CCAPI {
|
|
216
|
+
constructor() {
|
|
217
|
+
super(...arguments);
|
|
218
|
+
this[_a] = async ({ property }, value, options) => {
|
|
219
|
+
var _c, _d, _e, _f;
|
|
220
|
+
if (property === "targetValue") {
|
|
221
|
+
if (typeof value !== "number") {
|
|
222
|
+
(0, API_1.throwWrongValueType)(this.ccId, property, "number", typeof value);
|
|
223
|
+
}
|
|
224
|
+
const duration = safe_1.Duration.from(options === null || options === void 0 ? void 0 : options.transitionDuration);
|
|
225
|
+
const completed = await this.set(value, duration);
|
|
226
|
+
// If the command did not fail, assume that it succeeded and update the currentValue accordingly
|
|
227
|
+
// so UIs have immediate feedback
|
|
228
|
+
if (completed) {
|
|
229
|
+
if (this.isSinglecast()) {
|
|
230
|
+
// Only update currentValue for valid target values
|
|
231
|
+
if (!this.applHost.options.disableOptimisticValueUpdate &&
|
|
232
|
+
value >= 0 &&
|
|
233
|
+
value <= 99) {
|
|
234
|
+
(_c = this.tryGetValueDB()) === null || _c === void 0 ? void 0 : _c.setValue(getCurrentValueValueId(this.endpoint.index), value);
|
|
235
|
+
}
|
|
236
|
+
// Verify the current value after a delay, unless the device supports Supervision and we know the actual value
|
|
237
|
+
if (value === 255 ||
|
|
238
|
+
!((_d = this.endpoint
|
|
239
|
+
.getNodeUnsafe()) === null || _d === void 0 ? void 0 : _d.supportsCC(safe_1.CommandClasses.Supervision))) {
|
|
240
|
+
// We query currentValue instead of targetValue to make sure that unsolicited updates cancel the scheduled poll
|
|
241
|
+
if (property === "targetValue")
|
|
242
|
+
property = "currentValue";
|
|
243
|
+
this.schedulePoll({ property }, value === 255 ? undefined : value, { duration });
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else if (this.isMulticast()) {
|
|
247
|
+
// Only update currentValue for valid target values
|
|
248
|
+
if (!this.applHost.options.disableOptimisticValueUpdate &&
|
|
249
|
+
value >= 0 &&
|
|
250
|
+
value <= 99) {
|
|
251
|
+
// Figure out which nodes were affected by this command
|
|
252
|
+
const affectedNodes = this.endpoint.node.physicalNodes.filter((node) => {
|
|
253
|
+
var _c;
|
|
254
|
+
return (_c = node
|
|
255
|
+
.getEndpoint(this.endpoint.index)) === null || _c === void 0 ? void 0 : _c.supportsCC(this.ccId);
|
|
256
|
+
});
|
|
257
|
+
// and optimistically update the currentValue
|
|
258
|
+
for (const node of affectedNodes) {
|
|
259
|
+
(_e = this.applHost
|
|
260
|
+
.tryGetValueDB(node.id)) === null || _e === void 0 ? void 0 : _e.setValue(getCurrentValueValueId(this.endpoint.index), value);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
else if (value === 255) {
|
|
264
|
+
// We generally don't want to poll for multicasts because of how much traffic it can cause
|
|
265
|
+
// However, when setting the value 255 (ON), we don't know the actual state
|
|
266
|
+
// We query currentValue instead of targetValue to make sure that unsolicited updates cancel the scheduled poll
|
|
267
|
+
if (property === "targetValue")
|
|
268
|
+
property = "currentValue";
|
|
269
|
+
this.schedulePoll({ property }, undefined, {
|
|
270
|
+
duration,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
else if (switchTypeProperties.includes(property)) {
|
|
277
|
+
// Since the switch only supports one of the switch types, we would
|
|
278
|
+
// need to check if the correct one is used. But since the names are
|
|
279
|
+
// purely cosmetic, we just accept all of them
|
|
280
|
+
if (typeof value !== "boolean") {
|
|
281
|
+
(0, API_1.throwWrongValueType)(this.ccId, property, "number", typeof value);
|
|
282
|
+
}
|
|
283
|
+
if (value) {
|
|
284
|
+
// The property names are organized so that positive motions are
|
|
285
|
+
// at odd indices and negative motions at even indices
|
|
286
|
+
const direction = switchTypeProperties.indexOf(property) % 2 === 0
|
|
287
|
+
? "down"
|
|
288
|
+
: "up";
|
|
289
|
+
// Singlecast only: Try to retrieve the current value to use as the start level,
|
|
290
|
+
// even if the target node is going to ignore it. There might
|
|
291
|
+
// be some bugged devices that ignore the ignore start level flag.
|
|
292
|
+
const startLevel = (_f = this.tryGetValueDB()) === null || _f === void 0 ? void 0 : _f.getValue(getCurrentValueValueId(this.endpoint.index));
|
|
293
|
+
// And perform the level change
|
|
294
|
+
const duration = safe_1.Duration.from(options === null || options === void 0 ? void 0 : options.transitionDuration);
|
|
295
|
+
await this.startLevelChange({
|
|
296
|
+
direction,
|
|
297
|
+
ignoreStartLevel: true,
|
|
298
|
+
startLevel,
|
|
299
|
+
duration,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
await this.stopLevelChange();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
(0, API_1.throwUnsupportedProperty)(this.ccId, property);
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
this[_b] = async ({ property, }) => {
|
|
311
|
+
var _c;
|
|
312
|
+
switch (property) {
|
|
313
|
+
case "currentValue":
|
|
314
|
+
case "targetValue":
|
|
315
|
+
case "duration":
|
|
316
|
+
return (_c = (await this.get())) === null || _c === void 0 ? void 0 : _c[property];
|
|
317
|
+
default:
|
|
318
|
+
(0, API_1.throwUnsupportedProperty)(this.ccId, property);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
supportsCommand(cmd) {
|
|
323
|
+
switch (cmd) {
|
|
324
|
+
case _Types_1.MultilevelSwitchCommand.Get:
|
|
325
|
+
return this.isSinglecast();
|
|
326
|
+
case _Types_1.MultilevelSwitchCommand.Set:
|
|
327
|
+
case _Types_1.MultilevelSwitchCommand.StartLevelChange:
|
|
328
|
+
case _Types_1.MultilevelSwitchCommand.StopLevelChange:
|
|
329
|
+
return true; // This is mandatory
|
|
330
|
+
case _Types_1.MultilevelSwitchCommand.SupportedGet:
|
|
331
|
+
return this.version >= 3 && this.isSinglecast();
|
|
332
|
+
}
|
|
333
|
+
return super.supportsCommand(cmd);
|
|
334
|
+
}
|
|
335
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
336
|
+
async get() {
|
|
337
|
+
this.assertSupportsCommand(_Types_1.MultilevelSwitchCommand, _Types_1.MultilevelSwitchCommand.Get);
|
|
338
|
+
const cc = new MultilevelSwitchCCGet(this.applHost, {
|
|
339
|
+
nodeId: this.endpoint.nodeId,
|
|
340
|
+
endpoint: this.endpoint.index,
|
|
341
|
+
});
|
|
342
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
343
|
+
if (response) {
|
|
344
|
+
return (0, safe_2.pick)(response, ["currentValue", "targetValue", "duration"]);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Sets the switch to a new value
|
|
349
|
+
* @param targetValue The new target value for the switch
|
|
350
|
+
* @param duration The duration after which the target value should be reached. Can be a Duration instance or a user-friendly duration string like `"1m17s"`. Only supported in V2 and above.
|
|
351
|
+
* @returns A promise indicating whether the command was completed
|
|
352
|
+
*/
|
|
353
|
+
async set(targetValue, duration) {
|
|
354
|
+
__assertType("targetValue", "number", __assertType__number.bind(void 0, targetValue));
|
|
355
|
+
__assertType("duration", undefined, __assertType__optional_su__string__2_eu.bind(void 0, duration));
|
|
356
|
+
this.assertSupportsCommand(_Types_1.MultilevelSwitchCommand, _Types_1.MultilevelSwitchCommand.Set);
|
|
357
|
+
const cc = new MultilevelSwitchCCSet(this.applHost, {
|
|
358
|
+
nodeId: this.endpoint.nodeId,
|
|
359
|
+
endpoint: this.endpoint.index,
|
|
360
|
+
targetValue,
|
|
361
|
+
duration,
|
|
362
|
+
});
|
|
363
|
+
await this.applHost.sendCommand(cc, this.commandOptions);
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
async startLevelChange(options) {
|
|
367
|
+
__assertType("options", "MultilevelSwitchCCStartLevelChangeOptions", __assertType__MultilevelSwitchCCStartLevelChangeOptions.bind(void 0, options));
|
|
368
|
+
this.assertSupportsCommand(_Types_1.MultilevelSwitchCommand, _Types_1.MultilevelSwitchCommand.StartLevelChange);
|
|
369
|
+
const cc = new MultilevelSwitchCCStartLevelChange(this.applHost, {
|
|
370
|
+
nodeId: this.endpoint.nodeId,
|
|
371
|
+
endpoint: this.endpoint.index,
|
|
372
|
+
...options,
|
|
373
|
+
});
|
|
374
|
+
// let mayUseSupervision: boolean;
|
|
375
|
+
// if (this.endpoint.virtual) {
|
|
376
|
+
// // We cannot use supervision when communicating with multiple nodes
|
|
377
|
+
// mayUseSupervision = false;
|
|
378
|
+
// } else {
|
|
379
|
+
// // For singlecast, try to use supervision unless we know it is not supported
|
|
380
|
+
// const superviseValueId = getSuperviseStartStopLevelChangeValueId();
|
|
381
|
+
// const valueDB = this.getValueDB();
|
|
382
|
+
// mayUseSupervision = valueDB.getValue(superviseValueId) !== false;
|
|
383
|
+
// if (mayUseSupervision) {
|
|
384
|
+
// // Try to supervise the command execution
|
|
385
|
+
// const supervisionResult =
|
|
386
|
+
// await this.applHost.trySendCommandSupervised(cc);
|
|
387
|
+
// if (supervisionResult?.status === SupervisionStatus.Fail) {
|
|
388
|
+
// throw new ZWaveError(
|
|
389
|
+
// "startLevelChange failed",
|
|
390
|
+
// ZWaveErrorCodes.SupervisionCC_CommandFailed,
|
|
391
|
+
// );
|
|
392
|
+
// } else if (
|
|
393
|
+
// supervisionResult?.status === SupervisionStatus.NoSupport
|
|
394
|
+
// ) {
|
|
395
|
+
// // Remember that we shouldn't use supervision for that
|
|
396
|
+
// valueDB.setValue(superviseValueId, false);
|
|
397
|
+
// mayUseSupervision = false;
|
|
398
|
+
// }
|
|
399
|
+
// }
|
|
400
|
+
// }
|
|
401
|
+
// if (!mayUseSupervision) {
|
|
402
|
+
await this.applHost.sendCommand(cc);
|
|
403
|
+
}
|
|
404
|
+
async stopLevelChange() {
|
|
405
|
+
this.assertSupportsCommand(_Types_1.MultilevelSwitchCommand, _Types_1.MultilevelSwitchCommand.StopLevelChange);
|
|
406
|
+
const cc = new MultilevelSwitchCCStopLevelChange(this.applHost, {
|
|
407
|
+
nodeId: this.endpoint.nodeId,
|
|
408
|
+
endpoint: this.endpoint.index,
|
|
409
|
+
});
|
|
410
|
+
// let mayUseSupervision: boolean;
|
|
411
|
+
// if (this.endpoint.virtual) {
|
|
412
|
+
// // We cannot use supervision when communicating with multiple nodes
|
|
413
|
+
// mayUseSupervision = false;
|
|
414
|
+
// } else {
|
|
415
|
+
// // For singlecast, try to use supervision unless we know it is not supported
|
|
416
|
+
// const valueDB = this.getValueDB();
|
|
417
|
+
// const superviseValueId = getSuperviseStartStopLevelChangeValueId();
|
|
418
|
+
// mayUseSupervision =
|
|
419
|
+
// valueDB.getValue<boolean>(superviseValueId) !== false;
|
|
420
|
+
// if (mayUseSupervision) {
|
|
421
|
+
// // Try to supervise the command execution
|
|
422
|
+
// const supervisionResult =
|
|
423
|
+
// await this.applHost.trySendCommandSupervised(cc);
|
|
424
|
+
// if (supervisionResult?.status === SupervisionStatus.Fail) {
|
|
425
|
+
// throw new ZWaveError(
|
|
426
|
+
// "stopLevelChange failed",
|
|
427
|
+
// ZWaveErrorCodes.SupervisionCC_CommandFailed,
|
|
428
|
+
// );
|
|
429
|
+
// } else if (
|
|
430
|
+
// supervisionResult?.status === SupervisionStatus.NoSupport
|
|
431
|
+
// ) {
|
|
432
|
+
// // Remember that we shouldn't use supervision for that
|
|
433
|
+
// valueDB.setValue(superviseValueId, false);
|
|
434
|
+
// mayUseSupervision = false;
|
|
435
|
+
// }
|
|
436
|
+
// }
|
|
437
|
+
// }
|
|
438
|
+
// if (!mayUseSupervision) {
|
|
439
|
+
await this.applHost.sendCommand(cc);
|
|
440
|
+
// }
|
|
441
|
+
}
|
|
442
|
+
async getSupported() {
|
|
443
|
+
this.assertSupportsCommand(_Types_1.MultilevelSwitchCommand, _Types_1.MultilevelSwitchCommand.SupportedGet);
|
|
444
|
+
const cc = new MultilevelSwitchCCSupportedGet(this.applHost, {
|
|
445
|
+
nodeId: this.endpoint.nodeId,
|
|
446
|
+
endpoint: this.endpoint.index,
|
|
447
|
+
});
|
|
448
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
449
|
+
return response === null || response === void 0 ? void 0 : response.switchType;
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
_a = API_1.SET_VALUE, _b = API_1.POLL_VALUE;
|
|
453
|
+
MultilevelSwitchCCAPI = __decorate([
|
|
454
|
+
(0, CommandClass_1.API)(safe_1.CommandClasses["Multilevel Switch"])
|
|
455
|
+
], MultilevelSwitchCCAPI);
|
|
456
|
+
exports.MultilevelSwitchCCAPI = MultilevelSwitchCCAPI;
|
|
457
|
+
let MultilevelSwitchCC = class MultilevelSwitchCC extends CommandClass_1.CommandClass {
|
|
458
|
+
constructor(host, options) {
|
|
459
|
+
super(host, options);
|
|
460
|
+
this.registerValue(getSuperviseStartStopLevelChangeValueId().property, {
|
|
461
|
+
internal: true,
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
async interview(applHost) {
|
|
465
|
+
var _c, _d, _e;
|
|
466
|
+
const node = this.getNode(applHost);
|
|
467
|
+
const endpoint = this.getEndpoint(applHost);
|
|
468
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses["Multilevel Switch"], applHost, endpoint).withOptions({
|
|
469
|
+
priority: safe_1.MessagePriority.NodeQuery,
|
|
470
|
+
});
|
|
471
|
+
applHost.controllerLog.logNode(node.id, {
|
|
472
|
+
endpoint: this.endpointIndex,
|
|
473
|
+
message: `Interviewing ${this.ccName}...`,
|
|
474
|
+
direction: "none",
|
|
475
|
+
});
|
|
476
|
+
if (this.version >= 3) {
|
|
477
|
+
// Find out which kind of switch this is
|
|
478
|
+
applHost.controllerLog.logNode(node.id, {
|
|
479
|
+
endpoint: this.endpointIndex,
|
|
480
|
+
message: "requesting switch type...",
|
|
481
|
+
direction: "outbound",
|
|
482
|
+
});
|
|
483
|
+
const switchType = await api.getSupported();
|
|
484
|
+
if (switchType != undefined) {
|
|
485
|
+
applHost.controllerLog.logNode(node.id, {
|
|
486
|
+
endpoint: this.endpointIndex,
|
|
487
|
+
message: `has switch type ${(0, safe_2.getEnumMemberName)(_Types_1.SwitchType, switchType)}`,
|
|
488
|
+
direction: "inbound",
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
// requesting the switch type automatically creates the up/down actions
|
|
494
|
+
// We need to do this manually for V1 and V2
|
|
495
|
+
this.createMetadataForLevelChangeActions(applHost);
|
|
496
|
+
}
|
|
497
|
+
await this.refreshValues(applHost);
|
|
498
|
+
// create compat event value if necessary
|
|
499
|
+
if ((_e = (_d = (_c = applHost.getDeviceConfig) === null || _c === void 0 ? void 0 : _c.call(applHost, node.id)) === null || _d === void 0 ? void 0 : _d.compat) === null || _e === void 0 ? void 0 : _e.treatMultilevelSwitchSetAsEvent) {
|
|
500
|
+
const valueId = getCompatEventValueId(this.endpointIndex);
|
|
501
|
+
const valueDB = this.getValueDB(applHost);
|
|
502
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
503
|
+
valueDB.setMetadata(valueId, {
|
|
504
|
+
...safe_1.ValueMetadata.ReadOnlyUInt8,
|
|
505
|
+
label: "Event value",
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
// Remember that the interview is complete
|
|
510
|
+
this.setInterviewComplete(applHost, true);
|
|
511
|
+
}
|
|
512
|
+
async refreshValues(applHost) {
|
|
513
|
+
const node = this.getNode(applHost);
|
|
514
|
+
const endpoint = this.getEndpoint(applHost);
|
|
515
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses["Multilevel Switch"], applHost, endpoint).withOptions({
|
|
516
|
+
priority: safe_1.MessagePriority.NodeQuery,
|
|
517
|
+
});
|
|
518
|
+
applHost.controllerLog.logNode(node.id, {
|
|
519
|
+
endpoint: this.endpointIndex,
|
|
520
|
+
message: "requesting current switch state...",
|
|
521
|
+
direction: "outbound",
|
|
522
|
+
});
|
|
523
|
+
await api.get();
|
|
524
|
+
}
|
|
525
|
+
setMappedBasicValue(applHost, value) {
|
|
526
|
+
this.getValueDB(applHost).setValue({
|
|
527
|
+
commandClass: this.ccId,
|
|
528
|
+
endpoint: this.endpointIndex,
|
|
529
|
+
property: "currentValue",
|
|
530
|
+
}, value);
|
|
531
|
+
return true;
|
|
532
|
+
}
|
|
533
|
+
createMetadataForLevelChangeActions(applHost,
|
|
534
|
+
// SDS13781: The Primary Switch Type SHOULD be 0x02 (Up/Down)
|
|
535
|
+
switchType = _Types_1.SwitchType["Down/Up"]) {
|
|
536
|
+
const valueDB = this.getValueDB(applHost);
|
|
537
|
+
// Create metadata for the control values if necessary
|
|
538
|
+
const switchTypeName = (0, safe_2.getEnumMemberName)(_Types_1.SwitchType, switchType);
|
|
539
|
+
const [down, up] = switchTypeToActions(switchTypeName);
|
|
540
|
+
const upValueId = {
|
|
541
|
+
commandClass: this.ccId,
|
|
542
|
+
endpoint: this.endpointIndex,
|
|
543
|
+
property: up,
|
|
544
|
+
};
|
|
545
|
+
const downValueId = {
|
|
546
|
+
commandClass: this.ccId,
|
|
547
|
+
endpoint: this.endpointIndex,
|
|
548
|
+
property: down,
|
|
549
|
+
};
|
|
550
|
+
if (!valueDB.hasMetadata(upValueId)) {
|
|
551
|
+
valueDB.setMetadata(upValueId, {
|
|
552
|
+
...safe_1.ValueMetadata.Boolean,
|
|
553
|
+
label: `Perform a level change (${up})`,
|
|
554
|
+
valueChangeOptions: ["transitionDuration"],
|
|
555
|
+
ccSpecific: { switchType },
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
if (!valueDB.hasMetadata(downValueId)) {
|
|
559
|
+
valueDB.setMetadata(downValueId, {
|
|
560
|
+
...safe_1.ValueMetadata.Boolean,
|
|
561
|
+
label: `Perform a level change (${down})`,
|
|
562
|
+
valueChangeOptions: ["transitionDuration"],
|
|
563
|
+
ccSpecific: { switchType },
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
MultilevelSwitchCC = __decorate([
|
|
569
|
+
(0, CommandClass_1.commandClass)(safe_1.CommandClasses["Multilevel Switch"]),
|
|
570
|
+
(0, CommandClass_1.implementedVersion)(4)
|
|
571
|
+
], MultilevelSwitchCC);
|
|
572
|
+
exports.MultilevelSwitchCC = MultilevelSwitchCC;
|
|
573
|
+
let MultilevelSwitchCCSet = class MultilevelSwitchCCSet extends MultilevelSwitchCC {
|
|
574
|
+
constructor(host, options) {
|
|
575
|
+
super(host, options);
|
|
576
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
577
|
+
(0, safe_1.validatePayload)(this.payload.length >= 1);
|
|
578
|
+
this.targetValue = this.payload[0];
|
|
579
|
+
if (this.payload.length >= 2) {
|
|
580
|
+
this.duration = safe_1.Duration.parseReport(this.payload[1]);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
this.targetValue = options.targetValue;
|
|
585
|
+
this.duration = safe_1.Duration.from(options.duration);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
serialize() {
|
|
589
|
+
const payload = [this.targetValue];
|
|
590
|
+
if (this.version >= 2 && this.duration) {
|
|
591
|
+
payload.push(this.duration.serializeSet());
|
|
592
|
+
}
|
|
593
|
+
this.payload = Buffer.from(payload);
|
|
594
|
+
return super.serialize();
|
|
595
|
+
}
|
|
596
|
+
toLogEntry(applHost) {
|
|
597
|
+
const message = {
|
|
598
|
+
"target value": this.targetValue,
|
|
599
|
+
};
|
|
600
|
+
if (this.duration) {
|
|
601
|
+
message.duration = this.duration.toString();
|
|
602
|
+
}
|
|
603
|
+
return {
|
|
604
|
+
...super.toLogEntry(applHost),
|
|
605
|
+
message,
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
MultilevelSwitchCCSet = __decorate([
|
|
610
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultilevelSwitchCommand.Set)
|
|
611
|
+
], MultilevelSwitchCCSet);
|
|
612
|
+
exports.MultilevelSwitchCCSet = MultilevelSwitchCCSet;
|
|
613
|
+
let MultilevelSwitchCCReport = class MultilevelSwitchCCReport extends MultilevelSwitchCC {
|
|
614
|
+
constructor(host, options) {
|
|
615
|
+
super(host, options);
|
|
616
|
+
(0, safe_1.validatePayload)(this.payload.length >= 1);
|
|
617
|
+
this._currentValue = (0, safe_1.parseMaybeNumber)(this.payload[0]);
|
|
618
|
+
if (this.version >= 4 && this.payload.length >= 3) {
|
|
619
|
+
this.targetValue = (0, safe_1.parseNumber)(this.payload[1]);
|
|
620
|
+
this.duration = safe_1.Duration.parseReport(this.payload[2]);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
persistValues(applHost) {
|
|
624
|
+
if (this.currentValue === safe_1.unknownNumber &&
|
|
625
|
+
!applHost.options.preserveUnknownValues) {
|
|
626
|
+
this._currentValue = undefined;
|
|
627
|
+
}
|
|
628
|
+
return super.persistValues(applHost);
|
|
629
|
+
}
|
|
630
|
+
get currentValue() {
|
|
631
|
+
return this._currentValue;
|
|
632
|
+
}
|
|
633
|
+
toLogEntry(applHost) {
|
|
634
|
+
const message = {
|
|
635
|
+
"current value": this.currentValue,
|
|
636
|
+
};
|
|
637
|
+
if (this.targetValue != undefined && this.duration) {
|
|
638
|
+
message["target value"] = this.targetValue;
|
|
639
|
+
message.duration = this.duration.toString();
|
|
640
|
+
}
|
|
641
|
+
return {
|
|
642
|
+
...super.toLogEntry(applHost),
|
|
643
|
+
message,
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
__decorate([
|
|
648
|
+
(0, CommandClass_1.ccValue)({ forceCreation: true }),
|
|
649
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
650
|
+
...safe_1.ValueMetadata.Level,
|
|
651
|
+
label: "Target value",
|
|
652
|
+
valueChangeOptions: ["transitionDuration"],
|
|
653
|
+
})
|
|
654
|
+
], MultilevelSwitchCCReport.prototype, "targetValue", void 0);
|
|
655
|
+
__decorate([
|
|
656
|
+
(0, CommandClass_1.ccValue)(),
|
|
657
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
658
|
+
...safe_1.ValueMetadata.ReadOnlyDuration,
|
|
659
|
+
label: "Remaining duration",
|
|
660
|
+
})
|
|
661
|
+
], MultilevelSwitchCCReport.prototype, "duration", void 0);
|
|
662
|
+
__decorate([
|
|
663
|
+
(0, CommandClass_1.ccValue)(),
|
|
664
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
665
|
+
...safe_1.ValueMetadata.ReadOnlyLevel,
|
|
666
|
+
label: "Current value",
|
|
667
|
+
})
|
|
668
|
+
], MultilevelSwitchCCReport.prototype, "currentValue", null);
|
|
669
|
+
MultilevelSwitchCCReport = __decorate([
|
|
670
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultilevelSwitchCommand.Report)
|
|
671
|
+
], MultilevelSwitchCCReport);
|
|
672
|
+
exports.MultilevelSwitchCCReport = MultilevelSwitchCCReport;
|
|
673
|
+
let MultilevelSwitchCCGet = class MultilevelSwitchCCGet extends MultilevelSwitchCC {
|
|
674
|
+
};
|
|
675
|
+
MultilevelSwitchCCGet = __decorate([
|
|
676
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultilevelSwitchCommand.Get),
|
|
677
|
+
(0, CommandClass_1.expectedCCResponse)(MultilevelSwitchCCReport)
|
|
678
|
+
], MultilevelSwitchCCGet);
|
|
679
|
+
exports.MultilevelSwitchCCGet = MultilevelSwitchCCGet;
|
|
680
|
+
let MultilevelSwitchCCStartLevelChange = class MultilevelSwitchCCStartLevelChange extends MultilevelSwitchCC {
|
|
681
|
+
constructor(host, options) {
|
|
682
|
+
var _c;
|
|
683
|
+
super(host, options);
|
|
684
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
685
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2);
|
|
686
|
+
const ignoreStartLevel = (this.payload[0] & 32) >>> 5;
|
|
687
|
+
this.ignoreStartLevel = !!ignoreStartLevel;
|
|
688
|
+
const direction = (this.payload[0] & 64) >>> 6;
|
|
689
|
+
this.direction = direction ? "down" : "up";
|
|
690
|
+
this.startLevel = this.payload[1];
|
|
691
|
+
if (this.payload.length >= 3) {
|
|
692
|
+
this.duration = safe_1.Duration.parseSet(this.payload[2]);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
this.duration = safe_1.Duration.from(options.duration);
|
|
697
|
+
this.ignoreStartLevel = options.ignoreStartLevel;
|
|
698
|
+
this.startLevel = (_c = options.startLevel) !== null && _c !== void 0 ? _c : 0;
|
|
699
|
+
this.direction = options.direction;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
serialize() {
|
|
703
|
+
const controlByte = (_Types_1.LevelChangeDirection[this.direction] << 6) |
|
|
704
|
+
(this.ignoreStartLevel ? 32 : 0);
|
|
705
|
+
const payload = [controlByte, this.startLevel];
|
|
706
|
+
if (this.version >= 2 && this.duration) {
|
|
707
|
+
payload.push(this.duration.serializeSet());
|
|
708
|
+
}
|
|
709
|
+
this.payload = Buffer.from(payload);
|
|
710
|
+
return super.serialize();
|
|
711
|
+
}
|
|
712
|
+
toLogEntry(applHost) {
|
|
713
|
+
const message = {
|
|
714
|
+
startLevel: `${this.startLevel}${this.ignoreStartLevel ? " (ignored)" : ""}`,
|
|
715
|
+
direction: this.direction,
|
|
716
|
+
};
|
|
717
|
+
if (this.duration) {
|
|
718
|
+
message.duration = this.duration.toString();
|
|
719
|
+
}
|
|
720
|
+
return {
|
|
721
|
+
...super.toLogEntry(applHost),
|
|
722
|
+
message,
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
MultilevelSwitchCCStartLevelChange = __decorate([
|
|
727
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultilevelSwitchCommand.StartLevelChange)
|
|
728
|
+
], MultilevelSwitchCCStartLevelChange);
|
|
729
|
+
exports.MultilevelSwitchCCStartLevelChange = MultilevelSwitchCCStartLevelChange;
|
|
730
|
+
let MultilevelSwitchCCStopLevelChange = class MultilevelSwitchCCStopLevelChange extends MultilevelSwitchCC {
|
|
731
|
+
};
|
|
732
|
+
MultilevelSwitchCCStopLevelChange = __decorate([
|
|
733
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultilevelSwitchCommand.StopLevelChange)
|
|
734
|
+
], MultilevelSwitchCCStopLevelChange);
|
|
735
|
+
exports.MultilevelSwitchCCStopLevelChange = MultilevelSwitchCCStopLevelChange;
|
|
736
|
+
let MultilevelSwitchCCSupportedReport = class MultilevelSwitchCCSupportedReport extends MultilevelSwitchCC {
|
|
737
|
+
constructor(host, options) {
|
|
738
|
+
super(host, options);
|
|
739
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2);
|
|
740
|
+
this._switchType = this.payload[0] & 0b11111;
|
|
741
|
+
}
|
|
742
|
+
get switchType() {
|
|
743
|
+
return this._switchType;
|
|
744
|
+
}
|
|
745
|
+
persistValues(applHost) {
|
|
746
|
+
if (!super.persistValues(applHost))
|
|
747
|
+
return false;
|
|
748
|
+
this.createMetadataForLevelChangeActions(applHost, this._switchType);
|
|
749
|
+
return true;
|
|
750
|
+
}
|
|
751
|
+
toLogEntry(applHost) {
|
|
752
|
+
return {
|
|
753
|
+
...super.toLogEntry(applHost),
|
|
754
|
+
message: {
|
|
755
|
+
"switch type": (0, safe_2.getEnumMemberName)(_Types_1.SwitchType, this.switchType),
|
|
756
|
+
},
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
__decorate([
|
|
761
|
+
(0, CommandClass_1.ccValue)({ internal: true })
|
|
762
|
+
], MultilevelSwitchCCSupportedReport.prototype, "switchType", null);
|
|
763
|
+
MultilevelSwitchCCSupportedReport = __decorate([
|
|
764
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultilevelSwitchCommand.SupportedReport)
|
|
765
|
+
], MultilevelSwitchCCSupportedReport);
|
|
766
|
+
exports.MultilevelSwitchCCSupportedReport = MultilevelSwitchCCSupportedReport;
|
|
767
|
+
let MultilevelSwitchCCSupportedGet = class MultilevelSwitchCCSupportedGet extends MultilevelSwitchCC {
|
|
768
|
+
};
|
|
769
|
+
MultilevelSwitchCCSupportedGet = __decorate([
|
|
770
|
+
(0, CommandClass_1.CCCommand)(_Types_1.MultilevelSwitchCommand.SupportedGet),
|
|
771
|
+
(0, CommandClass_1.expectedCCResponse)(MultilevelSwitchCCSupportedReport)
|
|
772
|
+
], MultilevelSwitchCCSupportedGet);
|
|
773
|
+
exports.MultilevelSwitchCCSupportedGet = MultilevelSwitchCCSupportedGet;
|
|
774
|
+
//# sourceMappingURL=MultilevelSwitchCC.js.map
|