@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,2062 @@
|
|
|
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
|
+
var IrrigationCC_1;
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.IrrigationCCValveInfoGet = exports.IrrigationCCValveInfoReport = exports.IrrigationCCSystemConfigGet = exports.IrrigationCCSystemConfigReport = exports.IrrigationCCSystemConfigSet = exports.IrrigationCCSystemStatusGet = exports.IrrigationCCSystemStatusReport = exports.IrrigationCCSystemInfoGet = exports.IrrigationCCSystemInfoReport = exports.IrrigationCC = exports.IrrigationCCAPI = exports.getShutoffValueMetadata = exports.getShutoffValueId = exports.getValveRunStartStopValueMetadata = exports.getValveRunStartStopValueId = exports.getValveRunDurationValueMetadata = exports.getValveRunDurationValueId = exports.getUseMoistureSensorValueMetadata = exports.getUseMoistureSensorValueId = exports.getUseRainSensorValueMetadata = exports.getUseRainSensorValueId = exports.getLowFlowThresholdValueMetadata = exports.getLowFlowThresholdValueId = exports.getHighFlowThresholdValueMetadata = exports.getHighFlowThresholdValueId = exports.getMaximumFlowValueMetadata = exports.getMaximumFlowValueId = exports.getNominalCurrentLowThresholdValueMetadata = exports.getNominalCurrentLowThresholdValueId = exports.getNominalCurrentHighThresholdValueMetadata = exports.getNominalCurrentHighThresholdValueId = exports.getValveErrorLowFlowValueMetadata = exports.getValveErrorLowFlowValueId = exports.getValveErrorHighFlowValueMetadata = exports.getValveErrorHighFlowValueId = exports.getValveErrorMaximumFlowValueMetadata = exports.getValveErrorMaximumFlowValueId = exports.getValveErrorLowCurrentValueMetadata = exports.getValveErrorLowCurrentValueId = exports.getValveErrorHighCurrentValueMetadata = exports.getValveErrorHighCurrentValueId = exports.getValveErrorShortCircuitValueMetadata = exports.getValveErrorShortCircuitValueId = exports.getValveNominalCurrentValueMetadata = exports.getValveNominalCurrentValueId = exports.getValveConnectedValueMetadata = exports.getValveConnectedValueId = exports.getMaxValveTableSizeValueId = exports.getSupportsMasterValveValueId = exports.getNumValvesValueId = void 0;
|
|
12
|
+
exports.IrrigationCCSystemShutoff = exports.IrrigationCCValveTableRun = exports.IrrigationCCValveTableGet = exports.IrrigationCCValveTableReport = exports.IrrigationCCValveTableSet = exports.IrrigationCCValveRun = exports.IrrigationCCValveConfigGet = exports.IrrigationCCValveConfigReport = exports.IrrigationCCValveConfigSet = void 0;
|
|
13
|
+
function __assertType(argName, typeName, boundHasError) {
|
|
14
|
+
const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
|
|
15
|
+
if (boundHasError()) {
|
|
16
|
+
throw new ZWaveError(typeName ? `${argName} is not a ${typeName}` : `${argName} has the wrong type`, ZWaveErrorCodes.Argument_Invalid);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const __assertType__IrrigationCCSystemConfigSetOptions = $o => {
|
|
20
|
+
function _number($o) {
|
|
21
|
+
return typeof $o !== "number" ? {} : null;
|
|
22
|
+
}
|
|
23
|
+
function su__2__3_eu($o) {
|
|
24
|
+
return ![0, 1].includes($o) ? {} : null;
|
|
25
|
+
}
|
|
26
|
+
function _0($o) {
|
|
27
|
+
if (typeof $o !== "object" || $o === null || Array.isArray($o))
|
|
28
|
+
return {};
|
|
29
|
+
if ("masterValveDelay" in $o && $o["masterValveDelay"] !== undefined) {
|
|
30
|
+
const error = _number($o["masterValveDelay"]);
|
|
31
|
+
if (error)
|
|
32
|
+
return error;
|
|
33
|
+
}
|
|
34
|
+
else
|
|
35
|
+
return {};
|
|
36
|
+
if ("highPressureThreshold" in $o && $o["highPressureThreshold"] !== undefined) {
|
|
37
|
+
const error = _number($o["highPressureThreshold"]);
|
|
38
|
+
if (error)
|
|
39
|
+
return error;
|
|
40
|
+
}
|
|
41
|
+
else
|
|
42
|
+
return {};
|
|
43
|
+
if ("lowPressureThreshold" in $o && $o["lowPressureThreshold"] !== undefined) {
|
|
44
|
+
const error = _number($o["lowPressureThreshold"]);
|
|
45
|
+
if (error)
|
|
46
|
+
return error;
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
return {};
|
|
50
|
+
if ("rainSensorPolarity" in $o && $o["rainSensorPolarity"] !== undefined) {
|
|
51
|
+
const error = su__2__3_eu($o["rainSensorPolarity"]);
|
|
52
|
+
if (error)
|
|
53
|
+
return error;
|
|
54
|
+
}
|
|
55
|
+
if ("moistureSensorPolarity" in $o && $o["moistureSensorPolarity"] !== undefined) {
|
|
56
|
+
const error = su__2__3_eu($o["moistureSensorPolarity"]);
|
|
57
|
+
if (error)
|
|
58
|
+
return error;
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return _0($o);
|
|
63
|
+
};
|
|
64
|
+
const __assertType__ValveId = $o => {
|
|
65
|
+
function _number($o) {
|
|
66
|
+
return typeof $o !== "number" ? {} : null;
|
|
67
|
+
}
|
|
68
|
+
function _2($o) {
|
|
69
|
+
return $o !== "master" ? {} : null;
|
|
70
|
+
}
|
|
71
|
+
function su__number__2_eu($o) {
|
|
72
|
+
const conditions = [_number, _2];
|
|
73
|
+
for (const condition of conditions) {
|
|
74
|
+
const error = condition($o);
|
|
75
|
+
if (!error)
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
return su__number__2_eu($o);
|
|
81
|
+
};
|
|
82
|
+
const __assertType__IrrigationCCValveConfigSetOptions = $o => {
|
|
83
|
+
function _number($o) {
|
|
84
|
+
return typeof $o !== "number" ? {} : null;
|
|
85
|
+
}
|
|
86
|
+
function _3($o) {
|
|
87
|
+
return $o !== "master" ? {} : null;
|
|
88
|
+
}
|
|
89
|
+
function su__number__3_eu($o) {
|
|
90
|
+
const conditions = [_number, _3];
|
|
91
|
+
for (const condition of conditions) {
|
|
92
|
+
const error = condition($o);
|
|
93
|
+
if (!error)
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
return {};
|
|
97
|
+
}
|
|
98
|
+
function _boolean($o) {
|
|
99
|
+
return typeof $o !== "boolean" ? {} : null;
|
|
100
|
+
}
|
|
101
|
+
function _0($o) {
|
|
102
|
+
if (typeof $o !== "object" || $o === null || Array.isArray($o))
|
|
103
|
+
return {};
|
|
104
|
+
if ("valveId" in $o && $o["valveId"] !== undefined) {
|
|
105
|
+
const error = su__number__3_eu($o["valveId"]);
|
|
106
|
+
if (error)
|
|
107
|
+
return error;
|
|
108
|
+
}
|
|
109
|
+
else
|
|
110
|
+
return {};
|
|
111
|
+
if ("nominalCurrentHighThreshold" in $o && $o["nominalCurrentHighThreshold"] !== undefined) {
|
|
112
|
+
const error = _number($o["nominalCurrentHighThreshold"]);
|
|
113
|
+
if (error)
|
|
114
|
+
return error;
|
|
115
|
+
}
|
|
116
|
+
else
|
|
117
|
+
return {};
|
|
118
|
+
if ("nominalCurrentLowThreshold" in $o && $o["nominalCurrentLowThreshold"] !== undefined) {
|
|
119
|
+
const error = _number($o["nominalCurrentLowThreshold"]);
|
|
120
|
+
if (error)
|
|
121
|
+
return error;
|
|
122
|
+
}
|
|
123
|
+
else
|
|
124
|
+
return {};
|
|
125
|
+
if ("maximumFlow" in $o && $o["maximumFlow"] !== undefined) {
|
|
126
|
+
const error = _number($o["maximumFlow"]);
|
|
127
|
+
if (error)
|
|
128
|
+
return error;
|
|
129
|
+
}
|
|
130
|
+
else
|
|
131
|
+
return {};
|
|
132
|
+
if ("highFlowThreshold" in $o && $o["highFlowThreshold"] !== undefined) {
|
|
133
|
+
const error = _number($o["highFlowThreshold"]);
|
|
134
|
+
if (error)
|
|
135
|
+
return error;
|
|
136
|
+
}
|
|
137
|
+
else
|
|
138
|
+
return {};
|
|
139
|
+
if ("lowFlowThreshold" in $o && $o["lowFlowThreshold"] !== undefined) {
|
|
140
|
+
const error = _number($o["lowFlowThreshold"]);
|
|
141
|
+
if (error)
|
|
142
|
+
return error;
|
|
143
|
+
}
|
|
144
|
+
else
|
|
145
|
+
return {};
|
|
146
|
+
if ("useRainSensor" in $o && $o["useRainSensor"] !== undefined) {
|
|
147
|
+
const error = _boolean($o["useRainSensor"]);
|
|
148
|
+
if (error)
|
|
149
|
+
return error;
|
|
150
|
+
}
|
|
151
|
+
else
|
|
152
|
+
return {};
|
|
153
|
+
if ("useMoistureSensor" in $o && $o["useMoistureSensor"] !== undefined) {
|
|
154
|
+
const error = _boolean($o["useMoistureSensor"]);
|
|
155
|
+
if (error)
|
|
156
|
+
return error;
|
|
157
|
+
}
|
|
158
|
+
else
|
|
159
|
+
return {};
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
return _0($o);
|
|
163
|
+
};
|
|
164
|
+
const __assertType__number = $o => {
|
|
165
|
+
function _number($o) {
|
|
166
|
+
return typeof $o !== "number" ? {} : null;
|
|
167
|
+
}
|
|
168
|
+
return _number($o);
|
|
169
|
+
};
|
|
170
|
+
const __assertType__sa__2_ea_2 = $o => {
|
|
171
|
+
function _number($o) {
|
|
172
|
+
return typeof $o !== "number" ? {} : null;
|
|
173
|
+
}
|
|
174
|
+
function _2($o) {
|
|
175
|
+
if (typeof $o !== "object" || $o === null || Array.isArray($o))
|
|
176
|
+
return {};
|
|
177
|
+
if ("valveId" in $o && $o["valveId"] !== undefined) {
|
|
178
|
+
const error = _number($o["valveId"]);
|
|
179
|
+
if (error)
|
|
180
|
+
return error;
|
|
181
|
+
}
|
|
182
|
+
else
|
|
183
|
+
return {};
|
|
184
|
+
if ("duration" in $o && $o["duration"] !== undefined) {
|
|
185
|
+
const error = _number($o["duration"]);
|
|
186
|
+
if (error)
|
|
187
|
+
return error;
|
|
188
|
+
}
|
|
189
|
+
else
|
|
190
|
+
return {};
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
function sa__2_ea_2($o) {
|
|
194
|
+
if (!Array.isArray($o))
|
|
195
|
+
return {};
|
|
196
|
+
for (let i = 0; i < $o.length; i++) {
|
|
197
|
+
const error = _2($o[i]);
|
|
198
|
+
if (error)
|
|
199
|
+
return error;
|
|
200
|
+
}
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
return sa__2_ea_2($o);
|
|
204
|
+
};
|
|
205
|
+
const __assertType__sa__number_ea_2 = $o => {
|
|
206
|
+
function _number($o) {
|
|
207
|
+
return typeof $o !== "number" ? {} : null;
|
|
208
|
+
}
|
|
209
|
+
function sa__number_ea_2($o) {
|
|
210
|
+
if (!Array.isArray($o))
|
|
211
|
+
return {};
|
|
212
|
+
for (let i = 0; i < $o.length; i++) {
|
|
213
|
+
const error = _number($o[i]);
|
|
214
|
+
if (error)
|
|
215
|
+
return error;
|
|
216
|
+
}
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
return sa__number_ea_2($o);
|
|
220
|
+
};
|
|
221
|
+
const safe_1 = require("@zwave-js/core/safe");
|
|
222
|
+
const safe_2 = require("@zwave-js/shared/safe");
|
|
223
|
+
const strings_1 = require("alcalzone-shared/strings");
|
|
224
|
+
const API_1 = require("../lib/API");
|
|
225
|
+
const CommandClass_1 = require("../lib/CommandClass");
|
|
226
|
+
const _Types_1 = require("../lib/_Types");
|
|
227
|
+
function testResponseForIrrigationCommandWithValveId(sent, received) {
|
|
228
|
+
return received.valveId === sent.valveId;
|
|
229
|
+
}
|
|
230
|
+
function valveIdToMetadataPrefix(valveId) {
|
|
231
|
+
if (valveId === "master")
|
|
232
|
+
return "Master valve";
|
|
233
|
+
return `Valve ${(0, strings_1.padStart)(valveId.toString(), 3, "0")}`;
|
|
234
|
+
}
|
|
235
|
+
function getNumValvesValueId(endpointIndex) {
|
|
236
|
+
return {
|
|
237
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
238
|
+
endpoint: endpointIndex,
|
|
239
|
+
property: "numValves",
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
exports.getNumValvesValueId = getNumValvesValueId;
|
|
243
|
+
function getSupportsMasterValveValueId(endpointIndex) {
|
|
244
|
+
return {
|
|
245
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
246
|
+
endpoint: endpointIndex,
|
|
247
|
+
property: "supportsMasterValve",
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
exports.getSupportsMasterValveValueId = getSupportsMasterValveValueId;
|
|
251
|
+
function getMaxValveTableSizeValueId(endpointIndex) {
|
|
252
|
+
return {
|
|
253
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
254
|
+
endpoint: endpointIndex,
|
|
255
|
+
property: "maxValveTableSize",
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
exports.getMaxValveTableSizeValueId = getMaxValveTableSizeValueId;
|
|
259
|
+
function getValveConnectedValueId(valveId, endpointIndex) {
|
|
260
|
+
return {
|
|
261
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
262
|
+
endpoint: endpointIndex,
|
|
263
|
+
property: valveId,
|
|
264
|
+
propertyKey: "connected",
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
exports.getValveConnectedValueId = getValveConnectedValueId;
|
|
268
|
+
function getValveConnectedValueMetadata(valveId) {
|
|
269
|
+
return {
|
|
270
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
271
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Connected`,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
exports.getValveConnectedValueMetadata = getValveConnectedValueMetadata;
|
|
275
|
+
function getValveNominalCurrentValueId(valveId, endpointIndex) {
|
|
276
|
+
return {
|
|
277
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
278
|
+
endpoint: endpointIndex,
|
|
279
|
+
property: valveId,
|
|
280
|
+
propertyKey: "nominalCurrent",
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
exports.getValveNominalCurrentValueId = getValveNominalCurrentValueId;
|
|
284
|
+
function getValveNominalCurrentValueMetadata(valveId) {
|
|
285
|
+
return {
|
|
286
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
287
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Nominal current`,
|
|
288
|
+
unit: "mA",
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
exports.getValveNominalCurrentValueMetadata = getValveNominalCurrentValueMetadata;
|
|
292
|
+
function getValveErrorShortCircuitValueId(valveId, endpointIndex) {
|
|
293
|
+
return {
|
|
294
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
295
|
+
endpoint: endpointIndex,
|
|
296
|
+
property: valveId,
|
|
297
|
+
propertyKey: "errorShortCircuit",
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
exports.getValveErrorShortCircuitValueId = getValveErrorShortCircuitValueId;
|
|
301
|
+
function getValveErrorShortCircuitValueMetadata(valveId) {
|
|
302
|
+
return {
|
|
303
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
304
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Error - Short circuit detected`,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
exports.getValveErrorShortCircuitValueMetadata = getValveErrorShortCircuitValueMetadata;
|
|
308
|
+
function getValveErrorHighCurrentValueId(valveId, endpointIndex) {
|
|
309
|
+
return {
|
|
310
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
311
|
+
endpoint: endpointIndex,
|
|
312
|
+
property: valveId,
|
|
313
|
+
propertyKey: "errorHighCurrent",
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
exports.getValveErrorHighCurrentValueId = getValveErrorHighCurrentValueId;
|
|
317
|
+
function getValveErrorHighCurrentValueMetadata(valveId) {
|
|
318
|
+
return {
|
|
319
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
320
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Error - Current above high threshold`,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
exports.getValveErrorHighCurrentValueMetadata = getValveErrorHighCurrentValueMetadata;
|
|
324
|
+
function getValveErrorLowCurrentValueId(valveId, endpointIndex) {
|
|
325
|
+
return {
|
|
326
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
327
|
+
endpoint: endpointIndex,
|
|
328
|
+
property: valveId,
|
|
329
|
+
propertyKey: "errorLowCurrent",
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
exports.getValveErrorLowCurrentValueId = getValveErrorLowCurrentValueId;
|
|
333
|
+
function getValveErrorLowCurrentValueMetadata(valveId) {
|
|
334
|
+
return {
|
|
335
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
336
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Error - Current below low threshold`,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
exports.getValveErrorLowCurrentValueMetadata = getValveErrorLowCurrentValueMetadata;
|
|
340
|
+
function getValveErrorMaximumFlowValueId(valveId, endpointIndex) {
|
|
341
|
+
return {
|
|
342
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
343
|
+
endpoint: endpointIndex,
|
|
344
|
+
property: valveId,
|
|
345
|
+
propertyKey: "errorMaximumFlow",
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
exports.getValveErrorMaximumFlowValueId = getValveErrorMaximumFlowValueId;
|
|
349
|
+
function getValveErrorMaximumFlowValueMetadata(valveId) {
|
|
350
|
+
return {
|
|
351
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
352
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Error - Maximum flow detected`,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
exports.getValveErrorMaximumFlowValueMetadata = getValveErrorMaximumFlowValueMetadata;
|
|
356
|
+
function getValveErrorHighFlowValueId(valveId, endpointIndex) {
|
|
357
|
+
return {
|
|
358
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
359
|
+
endpoint: endpointIndex,
|
|
360
|
+
property: valveId,
|
|
361
|
+
propertyKey: "errorHighFlow",
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
exports.getValveErrorHighFlowValueId = getValveErrorHighFlowValueId;
|
|
365
|
+
function getValveErrorHighFlowValueMetadata(valveId) {
|
|
366
|
+
return {
|
|
367
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
368
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Error - Flow above high threshold`,
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
exports.getValveErrorHighFlowValueMetadata = getValveErrorHighFlowValueMetadata;
|
|
372
|
+
function getValveErrorLowFlowValueId(valveId, endpointIndex) {
|
|
373
|
+
return {
|
|
374
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
375
|
+
endpoint: endpointIndex,
|
|
376
|
+
property: valveId,
|
|
377
|
+
propertyKey: "errorLowFlow",
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
exports.getValveErrorLowFlowValueId = getValveErrorLowFlowValueId;
|
|
381
|
+
function getValveErrorLowFlowValueMetadata(valveId) {
|
|
382
|
+
return {
|
|
383
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
384
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Error - Flow below high threshold`,
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
exports.getValveErrorLowFlowValueMetadata = getValveErrorLowFlowValueMetadata;
|
|
388
|
+
function getNominalCurrentHighThresholdValueId(valveId, endpointIndex) {
|
|
389
|
+
return {
|
|
390
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
391
|
+
endpoint: endpointIndex,
|
|
392
|
+
property: valveId,
|
|
393
|
+
propertyKey: "nominalCurrentHighThreshold",
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
exports.getNominalCurrentHighThresholdValueId = getNominalCurrentHighThresholdValueId;
|
|
397
|
+
function getNominalCurrentHighThresholdValueMetadata(valveId) {
|
|
398
|
+
return {
|
|
399
|
+
...safe_1.ValueMetadata.Number,
|
|
400
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Nominal current - high threshold`,
|
|
401
|
+
min: 0,
|
|
402
|
+
max: 2550,
|
|
403
|
+
unit: "mA",
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
exports.getNominalCurrentHighThresholdValueMetadata = getNominalCurrentHighThresholdValueMetadata;
|
|
407
|
+
function getNominalCurrentLowThresholdValueId(valveId, endpointIndex) {
|
|
408
|
+
return {
|
|
409
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
410
|
+
endpoint: endpointIndex,
|
|
411
|
+
property: valveId,
|
|
412
|
+
propertyKey: "nominalCurrentLowThreshold",
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
exports.getNominalCurrentLowThresholdValueId = getNominalCurrentLowThresholdValueId;
|
|
416
|
+
function getNominalCurrentLowThresholdValueMetadata(valveId) {
|
|
417
|
+
return {
|
|
418
|
+
...safe_1.ValueMetadata.Number,
|
|
419
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Nominal current - low threshold`,
|
|
420
|
+
min: 0,
|
|
421
|
+
max: 2550,
|
|
422
|
+
unit: "mA",
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
exports.getNominalCurrentLowThresholdValueMetadata = getNominalCurrentLowThresholdValueMetadata;
|
|
426
|
+
function getMaximumFlowValueId(valveId, endpointIndex) {
|
|
427
|
+
return {
|
|
428
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
429
|
+
endpoint: endpointIndex,
|
|
430
|
+
property: valveId,
|
|
431
|
+
propertyKey: "maximumFlow",
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
exports.getMaximumFlowValueId = getMaximumFlowValueId;
|
|
435
|
+
function getMaximumFlowValueMetadata(valveId) {
|
|
436
|
+
return {
|
|
437
|
+
...safe_1.ValueMetadata.Number,
|
|
438
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Maximum flow`,
|
|
439
|
+
min: 0,
|
|
440
|
+
unit: "l/h",
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
exports.getMaximumFlowValueMetadata = getMaximumFlowValueMetadata;
|
|
444
|
+
function getHighFlowThresholdValueId(valveId, endpointIndex) {
|
|
445
|
+
return {
|
|
446
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
447
|
+
endpoint: endpointIndex,
|
|
448
|
+
property: valveId,
|
|
449
|
+
propertyKey: "highFlowThreshold",
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
exports.getHighFlowThresholdValueId = getHighFlowThresholdValueId;
|
|
453
|
+
function getHighFlowThresholdValueMetadata(valveId) {
|
|
454
|
+
return {
|
|
455
|
+
...safe_1.ValueMetadata.Number,
|
|
456
|
+
label: `${valveIdToMetadataPrefix(valveId)}: High flow threshold`,
|
|
457
|
+
min: 0,
|
|
458
|
+
unit: "l/h",
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
exports.getHighFlowThresholdValueMetadata = getHighFlowThresholdValueMetadata;
|
|
462
|
+
function getLowFlowThresholdValueId(valveId, endpointIndex) {
|
|
463
|
+
return {
|
|
464
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
465
|
+
endpoint: endpointIndex,
|
|
466
|
+
property: valveId,
|
|
467
|
+
propertyKey: "lowFlowThreshold",
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
exports.getLowFlowThresholdValueId = getLowFlowThresholdValueId;
|
|
471
|
+
function getLowFlowThresholdValueMetadata(valveId) {
|
|
472
|
+
return {
|
|
473
|
+
...safe_1.ValueMetadata.Number,
|
|
474
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Low flow threshold`,
|
|
475
|
+
min: 0,
|
|
476
|
+
unit: "l/h",
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
exports.getLowFlowThresholdValueMetadata = getLowFlowThresholdValueMetadata;
|
|
480
|
+
function getUseRainSensorValueId(valveId, endpointIndex) {
|
|
481
|
+
return {
|
|
482
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
483
|
+
endpoint: endpointIndex,
|
|
484
|
+
property: valveId,
|
|
485
|
+
propertyKey: "useRainSensor",
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
exports.getUseRainSensorValueId = getUseRainSensorValueId;
|
|
489
|
+
function getUseRainSensorValueMetadata(valveId) {
|
|
490
|
+
return {
|
|
491
|
+
...safe_1.ValueMetadata.Boolean,
|
|
492
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Use rain sensor`,
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
exports.getUseRainSensorValueMetadata = getUseRainSensorValueMetadata;
|
|
496
|
+
function getUseMoistureSensorValueId(valveId, endpointIndex) {
|
|
497
|
+
return {
|
|
498
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
499
|
+
endpoint: endpointIndex,
|
|
500
|
+
property: valveId,
|
|
501
|
+
propertyKey: "useMoistureSensor",
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
exports.getUseMoistureSensorValueId = getUseMoistureSensorValueId;
|
|
505
|
+
function getUseMoistureSensorValueMetadata(valveId) {
|
|
506
|
+
return {
|
|
507
|
+
...safe_1.ValueMetadata.Boolean,
|
|
508
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Use moisture sensor`,
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
exports.getUseMoistureSensorValueMetadata = getUseMoistureSensorValueMetadata;
|
|
512
|
+
function getValveRunDurationValueId(valveId, endpointIndex) {
|
|
513
|
+
return {
|
|
514
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
515
|
+
endpoint: endpointIndex,
|
|
516
|
+
property: valveId,
|
|
517
|
+
propertyKey: "duration",
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
exports.getValveRunDurationValueId = getValveRunDurationValueId;
|
|
521
|
+
function getValveRunDurationValueMetadata(valveId) {
|
|
522
|
+
return {
|
|
523
|
+
...safe_1.ValueMetadata.Number,
|
|
524
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Run duration`,
|
|
525
|
+
min: 1,
|
|
526
|
+
max: 0xffff,
|
|
527
|
+
unit: "s",
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
exports.getValveRunDurationValueMetadata = getValveRunDurationValueMetadata;
|
|
531
|
+
function getValveRunStartStopValueId(valveId, endpointIndex) {
|
|
532
|
+
return {
|
|
533
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
534
|
+
endpoint: endpointIndex,
|
|
535
|
+
property: valveId,
|
|
536
|
+
propertyKey: "startStop",
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
exports.getValveRunStartStopValueId = getValveRunStartStopValueId;
|
|
540
|
+
function getValveRunStartStopValueMetadata(valveId) {
|
|
541
|
+
return {
|
|
542
|
+
...safe_1.ValueMetadata.Boolean,
|
|
543
|
+
label: `${valveIdToMetadataPrefix(valveId)}: Start/Stop`,
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
exports.getValveRunStartStopValueMetadata = getValveRunStartStopValueMetadata;
|
|
547
|
+
function getShutoffValueId(endpointIndex) {
|
|
548
|
+
return {
|
|
549
|
+
commandClass: safe_1.CommandClasses.Irrigation,
|
|
550
|
+
endpoint: endpointIndex,
|
|
551
|
+
property: "shutoff",
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
exports.getShutoffValueId = getShutoffValueId;
|
|
555
|
+
function getShutoffValueMetadata() {
|
|
556
|
+
return {
|
|
557
|
+
...safe_1.ValueMetadata.WriteOnlyBoolean,
|
|
558
|
+
label: `Shutoff`,
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
exports.getShutoffValueMetadata = getShutoffValueMetadata;
|
|
562
|
+
const systemConfigProperties = [
|
|
563
|
+
"masterValveDelay",
|
|
564
|
+
"highPressureThreshold",
|
|
565
|
+
"lowPressureThreshold",
|
|
566
|
+
"rainSensorPolarity",
|
|
567
|
+
"moistureSensorPolarity",
|
|
568
|
+
];
|
|
569
|
+
const valveConfigPropertyKeys = [
|
|
570
|
+
"nominalCurrentHighThreshold",
|
|
571
|
+
"nominalCurrentLowThreshold",
|
|
572
|
+
"maximumFlow",
|
|
573
|
+
"highFlowThreshold",
|
|
574
|
+
"lowFlowThreshold",
|
|
575
|
+
"useRainSensor",
|
|
576
|
+
"useMoistureSensor",
|
|
577
|
+
];
|
|
578
|
+
let IrrigationCCAPI = class IrrigationCCAPI extends API_1.CCAPI {
|
|
579
|
+
constructor() {
|
|
580
|
+
super(...arguments);
|
|
581
|
+
this[_a] = async ({ property, propertyKey }, value) => {
|
|
582
|
+
const valueDB = this.getValueDB();
|
|
583
|
+
if (systemConfigProperties.includes(property)) {
|
|
584
|
+
const options = {};
|
|
585
|
+
for (const prop of systemConfigProperties) {
|
|
586
|
+
if (prop === property)
|
|
587
|
+
continue;
|
|
588
|
+
const valueId = {
|
|
589
|
+
commandClass: this.ccId,
|
|
590
|
+
endpoint: this.endpoint.index,
|
|
591
|
+
property: prop,
|
|
592
|
+
};
|
|
593
|
+
const cachedVal = valueDB.getValue(valueId);
|
|
594
|
+
if (cachedVal == undefined) {
|
|
595
|
+
throw new safe_1.ZWaveError(`The "${property}" property cannot be changed before ${prop} is known!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
596
|
+
}
|
|
597
|
+
options[prop] = cachedVal;
|
|
598
|
+
}
|
|
599
|
+
options[property] =
|
|
600
|
+
value;
|
|
601
|
+
await this.setSystemConfig(options);
|
|
602
|
+
}
|
|
603
|
+
else if (property === "shutoff") {
|
|
604
|
+
await this.shutoffSystem(0);
|
|
605
|
+
}
|
|
606
|
+
else if (property === "master" ||
|
|
607
|
+
(typeof property === "number" && property >= 1)) {
|
|
608
|
+
// This is a value of a valve
|
|
609
|
+
if (propertyKey == undefined) {
|
|
610
|
+
(0, API_1.throwMissingPropertyKey)(this.ccId, property);
|
|
611
|
+
}
|
|
612
|
+
if (valveConfigPropertyKeys.includes(propertyKey)) {
|
|
613
|
+
const options = {
|
|
614
|
+
valveId: property,
|
|
615
|
+
};
|
|
616
|
+
for (const prop of valveConfigPropertyKeys) {
|
|
617
|
+
if (prop === propertyKey)
|
|
618
|
+
continue;
|
|
619
|
+
const valueId = {
|
|
620
|
+
commandClass: this.ccId,
|
|
621
|
+
endpoint: this.endpoint.index,
|
|
622
|
+
property,
|
|
623
|
+
propertyKey: prop,
|
|
624
|
+
};
|
|
625
|
+
const cachedVal = valueDB.getValue(valueId);
|
|
626
|
+
if (cachedVal == undefined) {
|
|
627
|
+
throw new safe_1.ZWaveError(`The "${property}_${propertyKey}" property cannot be changed before ${property}_${prop} is known!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
628
|
+
}
|
|
629
|
+
options[prop] = cachedVal;
|
|
630
|
+
}
|
|
631
|
+
options[propertyKey] = value;
|
|
632
|
+
await this.setValveConfig(options);
|
|
633
|
+
}
|
|
634
|
+
else if (propertyKey === "duration") {
|
|
635
|
+
// The run duration needs to be set separately from triggering the run
|
|
636
|
+
// So this is okay
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
else if (propertyKey === "startStop") {
|
|
640
|
+
// Trigger or stop a valve run, depending on the value
|
|
641
|
+
if (typeof value !== "boolean") {
|
|
642
|
+
(0, API_1.throwWrongValueType)(this.ccId, property, "boolean", typeof value);
|
|
643
|
+
}
|
|
644
|
+
if (value) {
|
|
645
|
+
// Start a valve run
|
|
646
|
+
const duration = valueDB.getValue(getValveRunDurationValueId(property, this.endpoint.index));
|
|
647
|
+
if (duration == undefined) {
|
|
648
|
+
throw new safe_1.ZWaveError(`Cannot start a valve run without specifying a duration first!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
649
|
+
}
|
|
650
|
+
await this.runValve(property, duration);
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
// Stop a valve run
|
|
654
|
+
await this.shutoffValve(property);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
else {
|
|
658
|
+
(0, API_1.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
this[_b] = async ({ property, propertyKey, }) => {
|
|
663
|
+
var _c, _d, _e, _f;
|
|
664
|
+
switch (property) {
|
|
665
|
+
case "systemVoltage":
|
|
666
|
+
case "flowSensorActive":
|
|
667
|
+
case "pressureSensorActive":
|
|
668
|
+
case "rainSensorActive":
|
|
669
|
+
case "moistureSensorActive":
|
|
670
|
+
case "flow":
|
|
671
|
+
case "pressure":
|
|
672
|
+
case "shutoffDuration":
|
|
673
|
+
case "errorNotProgrammed":
|
|
674
|
+
case "errorEmergencyShutdown":
|
|
675
|
+
case "errorHighPressure":
|
|
676
|
+
case "errorLowPressure":
|
|
677
|
+
case "errorValve":
|
|
678
|
+
case "masterValveOpen":
|
|
679
|
+
case "firstOpenZoneId":
|
|
680
|
+
return (_c = (await this.getSystemStatus())) === null || _c === void 0 ? void 0 : _c[property];
|
|
681
|
+
case "masterValveDelay":
|
|
682
|
+
case "highPressureThreshold":
|
|
683
|
+
case "lowPressureThreshold":
|
|
684
|
+
case "rainSensorPolarity":
|
|
685
|
+
case "moistureSensorPolarity":
|
|
686
|
+
return (_d = (await this.getSystemConfig())) === null || _d === void 0 ? void 0 : _d[property];
|
|
687
|
+
}
|
|
688
|
+
if (property === "master" ||
|
|
689
|
+
(typeof property === "number" && property >= 1)) {
|
|
690
|
+
// This is a value of a valve
|
|
691
|
+
switch (propertyKey) {
|
|
692
|
+
case "connected":
|
|
693
|
+
case "nominalCurrent":
|
|
694
|
+
case "errorShortCircuit":
|
|
695
|
+
case "errorHighCurrent":
|
|
696
|
+
case "errorLowCurrent":
|
|
697
|
+
case "errorMaximumFlow":
|
|
698
|
+
case "errorHighFlow":
|
|
699
|
+
case "errorLowFlow":
|
|
700
|
+
return (_e = (await this.getValveInfo(property))) === null || _e === void 0 ? void 0 : _e[propertyKey];
|
|
701
|
+
case "nominalCurrentHighThreshold":
|
|
702
|
+
case "nominalCurrentLowThreshold":
|
|
703
|
+
case "maximumFlow":
|
|
704
|
+
case "highFlowThreshold":
|
|
705
|
+
case "lowFlowThreshold":
|
|
706
|
+
case "useRainSensor":
|
|
707
|
+
case "useMoistureSensor":
|
|
708
|
+
return (_f = (await this.getValveConfig(property))) === null || _f === void 0 ? void 0 : _f[propertyKey];
|
|
709
|
+
case undefined:
|
|
710
|
+
(0, API_1.throwMissingPropertyKey)(this.ccId, property);
|
|
711
|
+
default:
|
|
712
|
+
(0, API_1.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
(0, API_1.throwUnsupportedProperty)(this.ccId, property);
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
supportsCommand(cmd) {
|
|
719
|
+
switch (cmd) {
|
|
720
|
+
case _Types_1.IrrigationCommand.SystemInfoGet:
|
|
721
|
+
case _Types_1.IrrigationCommand.SystemStatusGet:
|
|
722
|
+
case _Types_1.IrrigationCommand.SystemConfigSet:
|
|
723
|
+
case _Types_1.IrrigationCommand.SystemConfigGet:
|
|
724
|
+
case _Types_1.IrrigationCommand.ValveInfoGet:
|
|
725
|
+
case _Types_1.IrrigationCommand.ValveConfigSet:
|
|
726
|
+
case _Types_1.IrrigationCommand.ValveConfigGet:
|
|
727
|
+
case _Types_1.IrrigationCommand.ValveRun:
|
|
728
|
+
case _Types_1.IrrigationCommand.ValveTableSet:
|
|
729
|
+
case _Types_1.IrrigationCommand.ValveTableGet:
|
|
730
|
+
case _Types_1.IrrigationCommand.ValveTableRun:
|
|
731
|
+
case _Types_1.IrrigationCommand.SystemShutoff:
|
|
732
|
+
// These are all mandatory in V1
|
|
733
|
+
return true;
|
|
734
|
+
}
|
|
735
|
+
return super.supportsCommand(cmd);
|
|
736
|
+
}
|
|
737
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
738
|
+
async getSystemInfo() {
|
|
739
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.SystemInfoGet);
|
|
740
|
+
const cc = new IrrigationCCSystemInfoGet(this.applHost, {
|
|
741
|
+
nodeId: this.endpoint.nodeId,
|
|
742
|
+
endpoint: this.endpoint.index,
|
|
743
|
+
});
|
|
744
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
745
|
+
if (response) {
|
|
746
|
+
return (0, safe_2.pick)(response, [
|
|
747
|
+
"numValves",
|
|
748
|
+
"numValveTables",
|
|
749
|
+
"supportsMasterValve",
|
|
750
|
+
"maxValveTableSize",
|
|
751
|
+
]);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
755
|
+
async getSystemStatus() {
|
|
756
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.SystemStatusGet);
|
|
757
|
+
const cc = new IrrigationCCSystemStatusGet(this.applHost, {
|
|
758
|
+
nodeId: this.endpoint.nodeId,
|
|
759
|
+
endpoint: this.endpoint.index,
|
|
760
|
+
});
|
|
761
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
762
|
+
if (response) {
|
|
763
|
+
return (0, safe_2.pick)(response, [
|
|
764
|
+
"systemVoltage",
|
|
765
|
+
"flowSensorActive",
|
|
766
|
+
"pressureSensorActive",
|
|
767
|
+
"rainSensorActive",
|
|
768
|
+
"moistureSensorActive",
|
|
769
|
+
"flow",
|
|
770
|
+
"pressure",
|
|
771
|
+
"shutoffDuration",
|
|
772
|
+
"errorNotProgrammed",
|
|
773
|
+
"errorEmergencyShutdown",
|
|
774
|
+
"errorHighPressure",
|
|
775
|
+
"errorLowPressure",
|
|
776
|
+
"errorValve",
|
|
777
|
+
"masterValveOpen",
|
|
778
|
+
"firstOpenZoneId",
|
|
779
|
+
]);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
783
|
+
async getSystemConfig() {
|
|
784
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.SystemConfigGet);
|
|
785
|
+
const cc = new IrrigationCCSystemConfigGet(this.applHost, {
|
|
786
|
+
nodeId: this.endpoint.nodeId,
|
|
787
|
+
endpoint: this.endpoint.index,
|
|
788
|
+
});
|
|
789
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
790
|
+
if (response) {
|
|
791
|
+
return (0, safe_2.pick)(response, [
|
|
792
|
+
"masterValveDelay",
|
|
793
|
+
"highPressureThreshold",
|
|
794
|
+
"lowPressureThreshold",
|
|
795
|
+
"rainSensorPolarity",
|
|
796
|
+
"moistureSensorPolarity",
|
|
797
|
+
]);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
async setSystemConfig(config) {
|
|
801
|
+
__assertType("config", "IrrigationCCSystemConfigSetOptions", __assertType__IrrigationCCSystemConfigSetOptions.bind(void 0, config));
|
|
802
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.SystemConfigSet);
|
|
803
|
+
const cc = new IrrigationCCSystemConfigSet(this.applHost, {
|
|
804
|
+
nodeId: this.endpoint.nodeId,
|
|
805
|
+
endpoint: this.endpoint.index,
|
|
806
|
+
...config,
|
|
807
|
+
});
|
|
808
|
+
await this.applHost.sendCommand(cc, this.commandOptions);
|
|
809
|
+
}
|
|
810
|
+
async getValveInfo(valveId) {
|
|
811
|
+
__assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
|
|
812
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.ValveInfoGet);
|
|
813
|
+
const cc = new IrrigationCCValveInfoGet(this.applHost, {
|
|
814
|
+
nodeId: this.endpoint.nodeId,
|
|
815
|
+
endpoint: this.endpoint.index,
|
|
816
|
+
valveId,
|
|
817
|
+
});
|
|
818
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
819
|
+
if (response) {
|
|
820
|
+
return (0, safe_2.pick)(response, [
|
|
821
|
+
"connected",
|
|
822
|
+
"nominalCurrent",
|
|
823
|
+
"errorShortCircuit",
|
|
824
|
+
"errorHighCurrent",
|
|
825
|
+
"errorLowCurrent",
|
|
826
|
+
"errorMaximumFlow",
|
|
827
|
+
"errorHighFlow",
|
|
828
|
+
"errorLowFlow",
|
|
829
|
+
]);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
async setValveConfig(options) {
|
|
833
|
+
__assertType("options", "IrrigationCCValveConfigSetOptions", __assertType__IrrigationCCValveConfigSetOptions.bind(void 0, options));
|
|
834
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.ValveConfigSet);
|
|
835
|
+
const cc = new IrrigationCCValveConfigSet(this.applHost, {
|
|
836
|
+
nodeId: this.endpoint.nodeId,
|
|
837
|
+
endpoint: this.endpoint.index,
|
|
838
|
+
...options,
|
|
839
|
+
});
|
|
840
|
+
await this.applHost.sendCommand(cc, this.commandOptions);
|
|
841
|
+
}
|
|
842
|
+
async getValveConfig(valveId) {
|
|
843
|
+
__assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
|
|
844
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.ValveConfigGet);
|
|
845
|
+
const cc = new IrrigationCCValveConfigGet(this.applHost, {
|
|
846
|
+
nodeId: this.endpoint.nodeId,
|
|
847
|
+
endpoint: this.endpoint.index,
|
|
848
|
+
valveId,
|
|
849
|
+
});
|
|
850
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
851
|
+
if (response) {
|
|
852
|
+
return (0, safe_2.pick)(response, [
|
|
853
|
+
"nominalCurrentHighThreshold",
|
|
854
|
+
"nominalCurrentLowThreshold",
|
|
855
|
+
"maximumFlow",
|
|
856
|
+
"highFlowThreshold",
|
|
857
|
+
"lowFlowThreshold",
|
|
858
|
+
"useRainSensor",
|
|
859
|
+
"useMoistureSensor",
|
|
860
|
+
]);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
async runValve(valveId, duration) {
|
|
864
|
+
__assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
|
|
865
|
+
__assertType("duration", "number", __assertType__number.bind(void 0, duration));
|
|
866
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.ValveRun);
|
|
867
|
+
const cc = new IrrigationCCValveRun(this.applHost, {
|
|
868
|
+
nodeId: this.endpoint.nodeId,
|
|
869
|
+
endpoint: this.endpoint.index,
|
|
870
|
+
valveId,
|
|
871
|
+
duration,
|
|
872
|
+
});
|
|
873
|
+
await this.applHost.sendCommand(cc, this.commandOptions);
|
|
874
|
+
}
|
|
875
|
+
shutoffValve(valveId) {
|
|
876
|
+
__assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
|
|
877
|
+
return this.runValve(valveId, 0);
|
|
878
|
+
}
|
|
879
|
+
async setValveTable(tableId, entries) {
|
|
880
|
+
__assertType("tableId", "number", __assertType__number.bind(void 0, tableId));
|
|
881
|
+
__assertType("entries", undefined, __assertType__sa__2_ea_2.bind(void 0, entries));
|
|
882
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.ValveTableSet);
|
|
883
|
+
if (!this.endpoint.virtual) {
|
|
884
|
+
const maxValveTableSize = IrrigationCC.getMaxValveTableSizeCached(this.applHost, this.endpoint);
|
|
885
|
+
if (maxValveTableSize != undefined &&
|
|
886
|
+
entries.length > maxValveTableSize) {
|
|
887
|
+
throw new safe_1.ZWaveError(`The number of valve table entries must not exceed ${maxValveTableSize}.`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
const cc = new IrrigationCCValveTableSet(this.applHost, {
|
|
891
|
+
nodeId: this.endpoint.nodeId,
|
|
892
|
+
endpoint: this.endpoint.index,
|
|
893
|
+
tableId,
|
|
894
|
+
entries,
|
|
895
|
+
});
|
|
896
|
+
await this.applHost.sendCommand(cc, this.commandOptions);
|
|
897
|
+
}
|
|
898
|
+
async getValveTable(tableId) {
|
|
899
|
+
__assertType("tableId", "number", __assertType__number.bind(void 0, tableId));
|
|
900
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.ValveTableGet);
|
|
901
|
+
const cc = new IrrigationCCValveTableGet(this.applHost, {
|
|
902
|
+
nodeId: this.endpoint.nodeId,
|
|
903
|
+
endpoint: this.endpoint.index,
|
|
904
|
+
tableId,
|
|
905
|
+
});
|
|
906
|
+
const response = await this.applHost.sendCommand(cc, this.commandOptions);
|
|
907
|
+
if (response) {
|
|
908
|
+
return response === null || response === void 0 ? void 0 : response.entries;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
async runTables(tableIDs) {
|
|
912
|
+
__assertType("tableIDs", undefined, __assertType__sa__number_ea_2.bind(void 0, tableIDs));
|
|
913
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.ValveTableRun);
|
|
914
|
+
const cc = new IrrigationCCValveTableRun(this.applHost, {
|
|
915
|
+
nodeId: this.endpoint.nodeId,
|
|
916
|
+
endpoint: this.endpoint.index,
|
|
917
|
+
tableIDs,
|
|
918
|
+
});
|
|
919
|
+
await this.applHost.sendCommand(cc, this.commandOptions);
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Shuts off the entire system for the given duration.
|
|
923
|
+
* @param duration Shutoff duration in hours. A value of 255 will shut off the entire system permanently and prevents schedules from running.
|
|
924
|
+
*/
|
|
925
|
+
async shutoffSystem(duration) {
|
|
926
|
+
__assertType("duration", "number", __assertType__number.bind(void 0, duration));
|
|
927
|
+
this.assertSupportsCommand(_Types_1.IrrigationCommand, _Types_1.IrrigationCommand.SystemShutoff);
|
|
928
|
+
const cc = new IrrigationCCSystemShutoff(this.applHost, {
|
|
929
|
+
nodeId: this.endpoint.nodeId,
|
|
930
|
+
endpoint: this.endpoint.index,
|
|
931
|
+
duration,
|
|
932
|
+
});
|
|
933
|
+
await this.applHost.sendCommand(cc, this.commandOptions);
|
|
934
|
+
}
|
|
935
|
+
/** Shuts off the entire system permanently and prevents schedules from running */
|
|
936
|
+
shutoffSystemPermanently() {
|
|
937
|
+
return this.shutoffSystem(255);
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
_a = API_1.SET_VALUE, _b = API_1.POLL_VALUE;
|
|
941
|
+
IrrigationCCAPI = __decorate([
|
|
942
|
+
(0, CommandClass_1.API)(safe_1.CommandClasses.Irrigation)
|
|
943
|
+
], IrrigationCCAPI);
|
|
944
|
+
exports.IrrigationCCAPI = IrrigationCCAPI;
|
|
945
|
+
let IrrigationCC = IrrigationCC_1 = class IrrigationCC extends CommandClass_1.CommandClass {
|
|
946
|
+
/**
|
|
947
|
+
* Returns the maximum number of valve table entries reported by the node.
|
|
948
|
+
* This only works AFTER the node has been interviewed.
|
|
949
|
+
*/
|
|
950
|
+
static getMaxValveTableSizeCached(applHost, endpoint) {
|
|
951
|
+
return applHost
|
|
952
|
+
.getValueDB(endpoint.nodeId)
|
|
953
|
+
.getValue(getMaxValveTableSizeValueId(endpoint.index));
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Returns the number of zone valves reported by the node.
|
|
957
|
+
* This only works AFTER the node has been interviewed.
|
|
958
|
+
*/
|
|
959
|
+
static getNumValvesCached(applHost, endpoint) {
|
|
960
|
+
return applHost
|
|
961
|
+
.getValueDB(endpoint.nodeId)
|
|
962
|
+
.getValue(getNumValvesValueId(endpoint.index));
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Returns whether the node supports a master valve
|
|
966
|
+
* This only works AFTER the node has been interviewed.
|
|
967
|
+
*/
|
|
968
|
+
static supportsMasterValveCached(applHost, endpoint) {
|
|
969
|
+
return !!applHost
|
|
970
|
+
.getValueDB(endpoint.nodeId)
|
|
971
|
+
.getValue(getSupportsMasterValveValueId(endpoint.index));
|
|
972
|
+
}
|
|
973
|
+
async interview(applHost) {
|
|
974
|
+
const node = this.getNode(applHost);
|
|
975
|
+
const endpoint = this.getEndpoint(applHost);
|
|
976
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses.Irrigation, applHost, endpoint).withOptions({
|
|
977
|
+
priority: safe_1.MessagePriority.NodeQuery,
|
|
978
|
+
});
|
|
979
|
+
applHost.controllerLog.logNode(node.id, {
|
|
980
|
+
endpoint: this.endpointIndex,
|
|
981
|
+
message: `Interviewing ${this.ccName}...`,
|
|
982
|
+
direction: "none",
|
|
983
|
+
});
|
|
984
|
+
applHost.controllerLog.logNode(node.id, {
|
|
985
|
+
endpoint: this.endpointIndex,
|
|
986
|
+
message: "Querying irrigation system info...",
|
|
987
|
+
direction: "outbound",
|
|
988
|
+
});
|
|
989
|
+
const systemInfo = await api.getSystemInfo();
|
|
990
|
+
if (!systemInfo) {
|
|
991
|
+
applHost.controllerLog.logNode(node.id, {
|
|
992
|
+
endpoint: this.endpointIndex,
|
|
993
|
+
message: "Time out while querying irrigation system info, skipping interview...",
|
|
994
|
+
level: "warn",
|
|
995
|
+
});
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
const logMessage = `received irrigation system info:
|
|
999
|
+
supports master valve: ${systemInfo.supportsMasterValve}
|
|
1000
|
+
no. of valves: ${systemInfo.numValves}
|
|
1001
|
+
no. of valve tables: ${systemInfo.numValveTables}
|
|
1002
|
+
max. valve table size: ${systemInfo.maxValveTableSize}`;
|
|
1003
|
+
applHost.controllerLog.logNode(node.id, {
|
|
1004
|
+
endpoint: this.endpointIndex,
|
|
1005
|
+
message: logMessage,
|
|
1006
|
+
direction: "inbound",
|
|
1007
|
+
});
|
|
1008
|
+
// For each valve, create the values to start/stop a run
|
|
1009
|
+
const valueDB = this.getValueDB(applHost);
|
|
1010
|
+
for (let i = 1; i <= systemInfo.numValves; i++) {
|
|
1011
|
+
valueDB.setMetadata(getValveRunDurationValueId(i, this.endpointIndex), getValveRunDurationValueMetadata(i));
|
|
1012
|
+
valueDB.setMetadata(getValveRunStartStopValueId(i, this.endpointIndex), getValveRunStartStopValueMetadata(i));
|
|
1013
|
+
}
|
|
1014
|
+
// And create a shutoff value
|
|
1015
|
+
valueDB.setMetadata(getShutoffValueId(this.endpointIndex), getShutoffValueMetadata());
|
|
1016
|
+
// Query current values
|
|
1017
|
+
await this.refreshValues(applHost);
|
|
1018
|
+
// Remember that the interview is complete
|
|
1019
|
+
this.setInterviewComplete(applHost, true);
|
|
1020
|
+
}
|
|
1021
|
+
async refreshValues(applHost) {
|
|
1022
|
+
var _c;
|
|
1023
|
+
const node = this.getNode(applHost);
|
|
1024
|
+
const endpoint = this.getEndpoint(applHost);
|
|
1025
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses.Irrigation, applHost, endpoint).withOptions({
|
|
1026
|
+
priority: safe_1.MessagePriority.NodeQuery,
|
|
1027
|
+
});
|
|
1028
|
+
// Query the current system config
|
|
1029
|
+
applHost.controllerLog.logNode(node.id, {
|
|
1030
|
+
endpoint: this.endpointIndex,
|
|
1031
|
+
message: "Querying irrigation system configuration...",
|
|
1032
|
+
direction: "outbound",
|
|
1033
|
+
});
|
|
1034
|
+
const systemConfig = await api.getSystemConfig();
|
|
1035
|
+
if (systemConfig) {
|
|
1036
|
+
let logMessage = `received irrigation system configuration:
|
|
1037
|
+
master valve delay: ${systemConfig.masterValveDelay} seconds
|
|
1038
|
+
high pressure threshold: ${systemConfig.highPressureThreshold} kPa
|
|
1039
|
+
low pressure threshold: ${systemConfig.lowPressureThreshold} kPa`;
|
|
1040
|
+
if (systemConfig.rainSensorPolarity != undefined) {
|
|
1041
|
+
logMessage += `
|
|
1042
|
+
rain sensor polarity: ${(0, safe_2.getEnumMemberName)(_Types_1.IrrigationSensorPolarity, systemConfig.rainSensorPolarity)}`;
|
|
1043
|
+
}
|
|
1044
|
+
if (systemConfig.moistureSensorPolarity != undefined) {
|
|
1045
|
+
logMessage += `
|
|
1046
|
+
moisture sensor polarity: ${(0, safe_2.getEnumMemberName)(_Types_1.IrrigationSensorPolarity, systemConfig.moistureSensorPolarity)}`;
|
|
1047
|
+
}
|
|
1048
|
+
applHost.controllerLog.logNode(node.id, {
|
|
1049
|
+
endpoint: this.endpointIndex,
|
|
1050
|
+
message: logMessage,
|
|
1051
|
+
direction: "inbound",
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
// and status
|
|
1055
|
+
// Query the current system config
|
|
1056
|
+
applHost.controllerLog.logNode(node.id, {
|
|
1057
|
+
endpoint: this.endpointIndex,
|
|
1058
|
+
message: "Querying irrigation system status...",
|
|
1059
|
+
direction: "outbound",
|
|
1060
|
+
});
|
|
1061
|
+
await api.getSystemStatus();
|
|
1062
|
+
// for each valve, query the current status and configuration
|
|
1063
|
+
if (IrrigationCC_1.supportsMasterValveCached(applHost, endpoint)) {
|
|
1064
|
+
applHost.controllerLog.logNode(node.id, {
|
|
1065
|
+
endpoint: this.endpointIndex,
|
|
1066
|
+
message: "Querying master valve configuration...",
|
|
1067
|
+
direction: "outbound",
|
|
1068
|
+
});
|
|
1069
|
+
await api.getValveConfig("master");
|
|
1070
|
+
applHost.controllerLog.logNode(node.id, {
|
|
1071
|
+
endpoint: this.endpointIndex,
|
|
1072
|
+
message: "Querying master valve status...",
|
|
1073
|
+
direction: "outbound",
|
|
1074
|
+
});
|
|
1075
|
+
await api.getValveInfo("master");
|
|
1076
|
+
}
|
|
1077
|
+
for (let i = 1; i <= ((_c = IrrigationCC_1.getNumValvesCached(applHost, endpoint)) !== null && _c !== void 0 ? _c : 0); i++) {
|
|
1078
|
+
applHost.controllerLog.logNode(node.id, {
|
|
1079
|
+
endpoint: this.endpointIndex,
|
|
1080
|
+
message: `Querying configuration for valve ${(0, strings_1.padStart)(i.toString(), 3, "0")}...`,
|
|
1081
|
+
direction: "outbound",
|
|
1082
|
+
});
|
|
1083
|
+
await api.getValveConfig(i);
|
|
1084
|
+
applHost.controllerLog.logNode(node.id, {
|
|
1085
|
+
endpoint: this.endpointIndex,
|
|
1086
|
+
message: `Querying status for valve ${(0, strings_1.padStart)(i.toString(), 3, "0")}...`,
|
|
1087
|
+
direction: "outbound",
|
|
1088
|
+
});
|
|
1089
|
+
await api.getValveInfo(i);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
translateProperty(applHost, property, propertyKey) {
|
|
1093
|
+
if (property === "master") {
|
|
1094
|
+
return "Master valve";
|
|
1095
|
+
}
|
|
1096
|
+
else if (typeof property === "number") {
|
|
1097
|
+
return `Valve ${(0, strings_1.padStart)(property.toString(), 3, "0")}`;
|
|
1098
|
+
}
|
|
1099
|
+
return super.translateProperty(applHost, property, propertyKey);
|
|
1100
|
+
}
|
|
1101
|
+
};
|
|
1102
|
+
IrrigationCC = IrrigationCC_1 = __decorate([
|
|
1103
|
+
(0, CommandClass_1.commandClass)(safe_1.CommandClasses.Irrigation),
|
|
1104
|
+
(0, CommandClass_1.implementedVersion)(1)
|
|
1105
|
+
], IrrigationCC);
|
|
1106
|
+
exports.IrrigationCC = IrrigationCC;
|
|
1107
|
+
let IrrigationCCSystemInfoReport = class IrrigationCCSystemInfoReport extends IrrigationCC {
|
|
1108
|
+
constructor(host, options) {
|
|
1109
|
+
super(host, options);
|
|
1110
|
+
(0, safe_1.validatePayload)(this.payload.length >= 4);
|
|
1111
|
+
this.supportsMasterValve = !!(this.payload[0] & 0x01);
|
|
1112
|
+
this.numValves = this.payload[1];
|
|
1113
|
+
this.numValveTables = this.payload[2];
|
|
1114
|
+
this.maxValveTableSize = this.payload[3] & 0b1111;
|
|
1115
|
+
}
|
|
1116
|
+
toLogEntry(applHost) {
|
|
1117
|
+
return {
|
|
1118
|
+
...super.toLogEntry(applHost),
|
|
1119
|
+
message: {
|
|
1120
|
+
"supports master valve": this.supportsMasterValve,
|
|
1121
|
+
"no. of valves": this.numValves,
|
|
1122
|
+
"no. of valve tables": this.numValveTables,
|
|
1123
|
+
"max. valve table size": this.maxValveTableSize,
|
|
1124
|
+
},
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
1127
|
+
};
|
|
1128
|
+
__decorate([
|
|
1129
|
+
(0, CommandClass_1.ccValue)({ internal: true })
|
|
1130
|
+
], IrrigationCCSystemInfoReport.prototype, "numValves", void 0);
|
|
1131
|
+
__decorate([
|
|
1132
|
+
(0, CommandClass_1.ccValue)({ internal: true })
|
|
1133
|
+
], IrrigationCCSystemInfoReport.prototype, "numValveTables", void 0);
|
|
1134
|
+
__decorate([
|
|
1135
|
+
(0, CommandClass_1.ccValue)({ internal: true })
|
|
1136
|
+
], IrrigationCCSystemInfoReport.prototype, "supportsMasterValve", void 0);
|
|
1137
|
+
__decorate([
|
|
1138
|
+
(0, CommandClass_1.ccValue)({ internal: true })
|
|
1139
|
+
], IrrigationCCSystemInfoReport.prototype, "maxValveTableSize", void 0);
|
|
1140
|
+
IrrigationCCSystemInfoReport = __decorate([
|
|
1141
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.SystemInfoReport)
|
|
1142
|
+
], IrrigationCCSystemInfoReport);
|
|
1143
|
+
exports.IrrigationCCSystemInfoReport = IrrigationCCSystemInfoReport;
|
|
1144
|
+
let IrrigationCCSystemInfoGet = class IrrigationCCSystemInfoGet extends IrrigationCC {
|
|
1145
|
+
};
|
|
1146
|
+
IrrigationCCSystemInfoGet = __decorate([
|
|
1147
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.SystemInfoGet),
|
|
1148
|
+
(0, CommandClass_1.expectedCCResponse)(IrrigationCCSystemInfoReport)
|
|
1149
|
+
], IrrigationCCSystemInfoGet);
|
|
1150
|
+
exports.IrrigationCCSystemInfoGet = IrrigationCCSystemInfoGet;
|
|
1151
|
+
let IrrigationCCSystemStatusReport = class IrrigationCCSystemStatusReport extends IrrigationCC {
|
|
1152
|
+
constructor(host, options) {
|
|
1153
|
+
super(host, options);
|
|
1154
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2);
|
|
1155
|
+
this.systemVoltage = this.payload[0];
|
|
1156
|
+
this.flowSensorActive = !!(this.payload[1] & 0x01);
|
|
1157
|
+
this.pressureSensorActive = !!(this.payload[1] & 0x02);
|
|
1158
|
+
this.rainSensorActive = !!(this.payload[1] & 0x04);
|
|
1159
|
+
this.moistureSensorActive = !!(this.payload[1] & 0x08);
|
|
1160
|
+
let offset = 2;
|
|
1161
|
+
{
|
|
1162
|
+
const { value, scale, bytesRead } = (0, safe_1.parseFloatWithScale)(this.payload.slice(offset));
|
|
1163
|
+
(0, safe_1.validatePayload)(scale === 0);
|
|
1164
|
+
if (this.flowSensorActive)
|
|
1165
|
+
this.flow = value;
|
|
1166
|
+
offset += bytesRead;
|
|
1167
|
+
}
|
|
1168
|
+
{
|
|
1169
|
+
const { value, scale, bytesRead } = (0, safe_1.parseFloatWithScale)(this.payload.slice(offset));
|
|
1170
|
+
(0, safe_1.validatePayload)(scale === 0);
|
|
1171
|
+
if (this.pressureSensorActive)
|
|
1172
|
+
this.pressure = value;
|
|
1173
|
+
offset += bytesRead;
|
|
1174
|
+
}
|
|
1175
|
+
(0, safe_1.validatePayload)(this.payload.length >= offset + 4);
|
|
1176
|
+
this.shutoffDuration = this.payload[offset];
|
|
1177
|
+
this.errorNotProgrammed = !!(this.payload[offset + 1] & 0x01);
|
|
1178
|
+
this.errorEmergencyShutdown = !!(this.payload[offset + 1] & 0x02);
|
|
1179
|
+
this.errorHighPressure = !!(this.payload[offset + 1] & 0x04);
|
|
1180
|
+
this.errorLowPressure = !!(this.payload[offset + 1] & 0x08);
|
|
1181
|
+
this.errorValve = !!(this.payload[offset + 1] & 0x10);
|
|
1182
|
+
this.masterValveOpen = !!(this.payload[offset + 2] & 0x01);
|
|
1183
|
+
if (this.payload[offset + 3]) {
|
|
1184
|
+
this.firstOpenZoneId = this.payload[offset + 3];
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
toLogEntry(applHost) {
|
|
1188
|
+
const message = {
|
|
1189
|
+
"system voltage": `${this.systemVoltage} V`,
|
|
1190
|
+
"active sensors": [
|
|
1191
|
+
this.flowSensorActive ? "flow" : undefined,
|
|
1192
|
+
this.pressureSensorActive ? "pressure" : undefined,
|
|
1193
|
+
this.rainSensorActive ? "rain" : undefined,
|
|
1194
|
+
this.moistureSensorActive ? "moisture" : undefined,
|
|
1195
|
+
]
|
|
1196
|
+
.filter(Boolean)
|
|
1197
|
+
.join(", "),
|
|
1198
|
+
};
|
|
1199
|
+
if (this.flow != undefined) {
|
|
1200
|
+
message.flow = `${this.flow} l/h`;
|
|
1201
|
+
}
|
|
1202
|
+
if (this.pressure != undefined) {
|
|
1203
|
+
message.pressure = `${this.pressure} kPa`;
|
|
1204
|
+
}
|
|
1205
|
+
message["remaining shutoff duration"] = `${this.shutoffDuration} hours`;
|
|
1206
|
+
message["master valve status"] = this.masterValveOpen
|
|
1207
|
+
? "open"
|
|
1208
|
+
: "closed";
|
|
1209
|
+
message["first open zone valve"] = this.firstOpenZoneId || "none";
|
|
1210
|
+
const errors = [
|
|
1211
|
+
this.errorNotProgrammed ? "device not programmed" : undefined,
|
|
1212
|
+
this.errorEmergencyShutdown ? "emergency shutdown" : undefined,
|
|
1213
|
+
this.errorHighPressure
|
|
1214
|
+
? "high pressure threshold triggered"
|
|
1215
|
+
: undefined,
|
|
1216
|
+
this.errorLowPressure
|
|
1217
|
+
? "low pressure threshold triggered"
|
|
1218
|
+
: undefined,
|
|
1219
|
+
this.errorValve
|
|
1220
|
+
? "a valve or the master valve has an error"
|
|
1221
|
+
: undefined,
|
|
1222
|
+
].filter(Boolean);
|
|
1223
|
+
if (errors.length > 0) {
|
|
1224
|
+
message.errors = errors.map((e) => `\n· ${e}`).join("");
|
|
1225
|
+
}
|
|
1226
|
+
return {
|
|
1227
|
+
...super.toLogEntry(applHost),
|
|
1228
|
+
message,
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
__decorate([
|
|
1233
|
+
(0, CommandClass_1.ccValue)(),
|
|
1234
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1235
|
+
...safe_1.ValueMetadata.ReadOnlyUInt8,
|
|
1236
|
+
label: "System voltage",
|
|
1237
|
+
unit: "V",
|
|
1238
|
+
})
|
|
1239
|
+
], IrrigationCCSystemStatusReport.prototype, "systemVoltage", void 0);
|
|
1240
|
+
__decorate([
|
|
1241
|
+
(0, CommandClass_1.ccValue)(),
|
|
1242
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1243
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
1244
|
+
label: "Flow sensor active",
|
|
1245
|
+
})
|
|
1246
|
+
], IrrigationCCSystemStatusReport.prototype, "flowSensorActive", void 0);
|
|
1247
|
+
__decorate([
|
|
1248
|
+
(0, CommandClass_1.ccValue)(),
|
|
1249
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1250
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
1251
|
+
label: "Pressure sensor active",
|
|
1252
|
+
})
|
|
1253
|
+
], IrrigationCCSystemStatusReport.prototype, "pressureSensorActive", void 0);
|
|
1254
|
+
__decorate([
|
|
1255
|
+
(0, CommandClass_1.ccValue)(),
|
|
1256
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1257
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
1258
|
+
label: "Rain sensor attached and active",
|
|
1259
|
+
})
|
|
1260
|
+
], IrrigationCCSystemStatusReport.prototype, "rainSensorActive", void 0);
|
|
1261
|
+
__decorate([
|
|
1262
|
+
(0, CommandClass_1.ccValue)(),
|
|
1263
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1264
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
1265
|
+
label: "Moisture sensor attached and active",
|
|
1266
|
+
})
|
|
1267
|
+
], IrrigationCCSystemStatusReport.prototype, "moistureSensorActive", void 0);
|
|
1268
|
+
__decorate([
|
|
1269
|
+
(0, CommandClass_1.ccValue)(),
|
|
1270
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1271
|
+
...safe_1.ValueMetadata.ReadOnlyNumber,
|
|
1272
|
+
label: "Flow",
|
|
1273
|
+
unit: "l/h",
|
|
1274
|
+
})
|
|
1275
|
+
], IrrigationCCSystemStatusReport.prototype, "flow", void 0);
|
|
1276
|
+
__decorate([
|
|
1277
|
+
(0, CommandClass_1.ccValue)(),
|
|
1278
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1279
|
+
...safe_1.ValueMetadata.ReadOnlyNumber,
|
|
1280
|
+
label: "Pressure",
|
|
1281
|
+
unit: "kPa",
|
|
1282
|
+
})
|
|
1283
|
+
], IrrigationCCSystemStatusReport.prototype, "pressure", void 0);
|
|
1284
|
+
__decorate([
|
|
1285
|
+
(0, CommandClass_1.ccValue)(),
|
|
1286
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1287
|
+
...safe_1.ValueMetadata.ReadOnlyUInt8,
|
|
1288
|
+
label: "Remaining shutoff duration",
|
|
1289
|
+
unit: "hours",
|
|
1290
|
+
})
|
|
1291
|
+
], IrrigationCCSystemStatusReport.prototype, "shutoffDuration", void 0);
|
|
1292
|
+
__decorate([
|
|
1293
|
+
(0, CommandClass_1.ccValue)(),
|
|
1294
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1295
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
1296
|
+
label: "Error: device not programmed",
|
|
1297
|
+
})
|
|
1298
|
+
], IrrigationCCSystemStatusReport.prototype, "errorNotProgrammed", void 0);
|
|
1299
|
+
__decorate([
|
|
1300
|
+
(0, CommandClass_1.ccValue)(),
|
|
1301
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1302
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
1303
|
+
label: "Error: emergency shutdown",
|
|
1304
|
+
})
|
|
1305
|
+
], IrrigationCCSystemStatusReport.prototype, "errorEmergencyShutdown", void 0);
|
|
1306
|
+
__decorate([
|
|
1307
|
+
(0, CommandClass_1.ccValue)(),
|
|
1308
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1309
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
1310
|
+
label: "Error: high pressure",
|
|
1311
|
+
})
|
|
1312
|
+
], IrrigationCCSystemStatusReport.prototype, "errorHighPressure", void 0);
|
|
1313
|
+
__decorate([
|
|
1314
|
+
(0, CommandClass_1.ccValue)(),
|
|
1315
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1316
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
1317
|
+
label: "Error: low pressure",
|
|
1318
|
+
})
|
|
1319
|
+
], IrrigationCCSystemStatusReport.prototype, "errorLowPressure", void 0);
|
|
1320
|
+
__decorate([
|
|
1321
|
+
(0, CommandClass_1.ccValue)(),
|
|
1322
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1323
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
1324
|
+
label: "Error: valve reporting error",
|
|
1325
|
+
})
|
|
1326
|
+
], IrrigationCCSystemStatusReport.prototype, "errorValve", void 0);
|
|
1327
|
+
__decorate([
|
|
1328
|
+
(0, CommandClass_1.ccValue)(),
|
|
1329
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1330
|
+
...safe_1.ValueMetadata.ReadOnlyBoolean,
|
|
1331
|
+
label: "Master valve is open",
|
|
1332
|
+
})
|
|
1333
|
+
], IrrigationCCSystemStatusReport.prototype, "masterValveOpen", void 0);
|
|
1334
|
+
__decorate([
|
|
1335
|
+
(0, CommandClass_1.ccValue)(),
|
|
1336
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1337
|
+
...safe_1.ValueMetadata.ReadOnlyNumber,
|
|
1338
|
+
label: "First open zone valve ID",
|
|
1339
|
+
})
|
|
1340
|
+
], IrrigationCCSystemStatusReport.prototype, "firstOpenZoneId", void 0);
|
|
1341
|
+
IrrigationCCSystemStatusReport = __decorate([
|
|
1342
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.SystemStatusReport)
|
|
1343
|
+
], IrrigationCCSystemStatusReport);
|
|
1344
|
+
exports.IrrigationCCSystemStatusReport = IrrigationCCSystemStatusReport;
|
|
1345
|
+
let IrrigationCCSystemStatusGet = class IrrigationCCSystemStatusGet extends IrrigationCC {
|
|
1346
|
+
};
|
|
1347
|
+
IrrigationCCSystemStatusGet = __decorate([
|
|
1348
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.SystemStatusGet),
|
|
1349
|
+
(0, CommandClass_1.expectedCCResponse)(IrrigationCCSystemStatusReport)
|
|
1350
|
+
], IrrigationCCSystemStatusGet);
|
|
1351
|
+
exports.IrrigationCCSystemStatusGet = IrrigationCCSystemStatusGet;
|
|
1352
|
+
let IrrigationCCSystemConfigSet = class IrrigationCCSystemConfigSet extends IrrigationCC {
|
|
1353
|
+
constructor(host, options) {
|
|
1354
|
+
super(host, options);
|
|
1355
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1356
|
+
// TODO: Deserialize payload
|
|
1357
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1358
|
+
}
|
|
1359
|
+
else {
|
|
1360
|
+
this.masterValveDelay = options.masterValveDelay;
|
|
1361
|
+
this.highPressureThreshold = options.highPressureThreshold;
|
|
1362
|
+
this.lowPressureThreshold = options.lowPressureThreshold;
|
|
1363
|
+
this.rainSensorPolarity = options.rainSensorPolarity;
|
|
1364
|
+
this.moistureSensorPolarity = options.moistureSensorPolarity;
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
serialize() {
|
|
1368
|
+
let polarity = 0;
|
|
1369
|
+
if (this.rainSensorPolarity != undefined)
|
|
1370
|
+
polarity |= 0b1;
|
|
1371
|
+
if (this.moistureSensorPolarity != undefined)
|
|
1372
|
+
polarity |= 0b10;
|
|
1373
|
+
if (this.rainSensorPolarity == undefined &&
|
|
1374
|
+
this.moistureSensorPolarity == undefined) {
|
|
1375
|
+
// Valid bit
|
|
1376
|
+
polarity |= 128;
|
|
1377
|
+
}
|
|
1378
|
+
this.payload = Buffer.concat([
|
|
1379
|
+
Buffer.from([this.masterValveDelay]),
|
|
1380
|
+
(0, safe_1.encodeFloatWithScale)(this.highPressureThreshold, 0 /* kPa */),
|
|
1381
|
+
(0, safe_1.encodeFloatWithScale)(this.lowPressureThreshold, 0 /* kPa */),
|
|
1382
|
+
Buffer.from([polarity]),
|
|
1383
|
+
]);
|
|
1384
|
+
return super.serialize();
|
|
1385
|
+
}
|
|
1386
|
+
toLogEntry(applHost) {
|
|
1387
|
+
const message = {
|
|
1388
|
+
"master valve delay": `${this.masterValveDelay} s`,
|
|
1389
|
+
"high pressure threshold": `${this.highPressureThreshold} kPa`,
|
|
1390
|
+
"low pressure threshold": `${this.lowPressureThreshold} kPa`,
|
|
1391
|
+
};
|
|
1392
|
+
if (this.rainSensorPolarity != undefined) {
|
|
1393
|
+
message["rain sensor polarity"] = (0, safe_2.getEnumMemberName)(_Types_1.IrrigationSensorPolarity, this.rainSensorPolarity);
|
|
1394
|
+
}
|
|
1395
|
+
if (this.moistureSensorPolarity != undefined) {
|
|
1396
|
+
message["moisture sensor polarity"] = (0, safe_2.getEnumMemberName)(_Types_1.IrrigationSensorPolarity, this.moistureSensorPolarity);
|
|
1397
|
+
}
|
|
1398
|
+
return {
|
|
1399
|
+
...super.toLogEntry(applHost),
|
|
1400
|
+
message,
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
IrrigationCCSystemConfigSet = __decorate([
|
|
1405
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.SystemConfigSet)
|
|
1406
|
+
], IrrigationCCSystemConfigSet);
|
|
1407
|
+
exports.IrrigationCCSystemConfigSet = IrrigationCCSystemConfigSet;
|
|
1408
|
+
let IrrigationCCSystemConfigReport = class IrrigationCCSystemConfigReport extends IrrigationCC {
|
|
1409
|
+
constructor(host, options) {
|
|
1410
|
+
super(host, options);
|
|
1411
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2);
|
|
1412
|
+
this.masterValveDelay = this.payload[0];
|
|
1413
|
+
let offset = 1;
|
|
1414
|
+
{
|
|
1415
|
+
const { value, scale, bytesRead } = (0, safe_1.parseFloatWithScale)(this.payload.slice(offset));
|
|
1416
|
+
(0, safe_1.validatePayload)(scale === 0 /* kPa */);
|
|
1417
|
+
this.highPressureThreshold = value;
|
|
1418
|
+
offset += bytesRead;
|
|
1419
|
+
}
|
|
1420
|
+
{
|
|
1421
|
+
const { value, scale, bytesRead } = (0, safe_1.parseFloatWithScale)(this.payload.slice(offset));
|
|
1422
|
+
(0, safe_1.validatePayload)(scale === 0 /* kPa */);
|
|
1423
|
+
this.lowPressureThreshold = value;
|
|
1424
|
+
offset += bytesRead;
|
|
1425
|
+
}
|
|
1426
|
+
(0, safe_1.validatePayload)(this.payload.length >= offset + 1);
|
|
1427
|
+
const polarity = this.payload[offset];
|
|
1428
|
+
if (!!(polarity & 128)) {
|
|
1429
|
+
// The valid bit is set
|
|
1430
|
+
this.rainSensorPolarity = polarity & 0b1;
|
|
1431
|
+
this.moistureSensorPolarity = (polarity & 0b10) >>> 1;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
toLogEntry(applHost) {
|
|
1435
|
+
const message = {
|
|
1436
|
+
"master valve delay": `${this.masterValveDelay} s`,
|
|
1437
|
+
"high pressure threshold": `${this.highPressureThreshold} kPa`,
|
|
1438
|
+
"low pressure threshold": `${this.lowPressureThreshold} kPa`,
|
|
1439
|
+
};
|
|
1440
|
+
if (this.rainSensorPolarity != undefined) {
|
|
1441
|
+
message["rain sensor polarity"] = (0, safe_2.getEnumMemberName)(_Types_1.IrrigationSensorPolarity, this.rainSensorPolarity);
|
|
1442
|
+
}
|
|
1443
|
+
if (this.moistureSensorPolarity != undefined) {
|
|
1444
|
+
message["moisture sensor polarity"] = (0, safe_2.getEnumMemberName)(_Types_1.IrrigationSensorPolarity, this.moistureSensorPolarity);
|
|
1445
|
+
}
|
|
1446
|
+
return {
|
|
1447
|
+
...super.toLogEntry(applHost),
|
|
1448
|
+
message,
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
};
|
|
1452
|
+
__decorate([
|
|
1453
|
+
(0, CommandClass_1.ccValue)(),
|
|
1454
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1455
|
+
...safe_1.ValueMetadata.UInt8,
|
|
1456
|
+
label: "Master valve delay",
|
|
1457
|
+
description: "The delay between turning on the master valve and turning on any zone valve",
|
|
1458
|
+
unit: "seconds",
|
|
1459
|
+
})
|
|
1460
|
+
], IrrigationCCSystemConfigReport.prototype, "masterValveDelay", void 0);
|
|
1461
|
+
__decorate([
|
|
1462
|
+
(0, CommandClass_1.ccValue)(),
|
|
1463
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1464
|
+
...safe_1.ValueMetadata.Number,
|
|
1465
|
+
label: "High pressure threshold",
|
|
1466
|
+
unit: "kPa",
|
|
1467
|
+
})
|
|
1468
|
+
], IrrigationCCSystemConfigReport.prototype, "highPressureThreshold", void 0);
|
|
1469
|
+
__decorate([
|
|
1470
|
+
(0, CommandClass_1.ccValue)(),
|
|
1471
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1472
|
+
...safe_1.ValueMetadata.Number,
|
|
1473
|
+
label: "Low pressure threshold",
|
|
1474
|
+
unit: "kPa",
|
|
1475
|
+
})
|
|
1476
|
+
], IrrigationCCSystemConfigReport.prototype, "lowPressureThreshold", void 0);
|
|
1477
|
+
__decorate([
|
|
1478
|
+
(0, CommandClass_1.ccValue)(),
|
|
1479
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1480
|
+
...safe_1.ValueMetadata.Number,
|
|
1481
|
+
label: "Rain sensor polarity",
|
|
1482
|
+
min: 0,
|
|
1483
|
+
max: 1,
|
|
1484
|
+
states: (0, safe_1.enumValuesToMetadataStates)(_Types_1.IrrigationSensorPolarity),
|
|
1485
|
+
})
|
|
1486
|
+
], IrrigationCCSystemConfigReport.prototype, "rainSensorPolarity", void 0);
|
|
1487
|
+
__decorate([
|
|
1488
|
+
(0, CommandClass_1.ccValue)(),
|
|
1489
|
+
(0, CommandClass_1.ccValueMetadata)({
|
|
1490
|
+
...safe_1.ValueMetadata.Number,
|
|
1491
|
+
label: "Moisture sensor polarity",
|
|
1492
|
+
min: 0,
|
|
1493
|
+
max: 1,
|
|
1494
|
+
states: (0, safe_1.enumValuesToMetadataStates)(_Types_1.IrrigationSensorPolarity),
|
|
1495
|
+
})
|
|
1496
|
+
], IrrigationCCSystemConfigReport.prototype, "moistureSensorPolarity", void 0);
|
|
1497
|
+
IrrigationCCSystemConfigReport = __decorate([
|
|
1498
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.SystemConfigReport)
|
|
1499
|
+
], IrrigationCCSystemConfigReport);
|
|
1500
|
+
exports.IrrigationCCSystemConfigReport = IrrigationCCSystemConfigReport;
|
|
1501
|
+
let IrrigationCCSystemConfigGet = class IrrigationCCSystemConfigGet extends IrrigationCC {
|
|
1502
|
+
};
|
|
1503
|
+
IrrigationCCSystemConfigGet = __decorate([
|
|
1504
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.SystemConfigGet),
|
|
1505
|
+
(0, CommandClass_1.expectedCCResponse)(IrrigationCCSystemConfigReport)
|
|
1506
|
+
], IrrigationCCSystemConfigGet);
|
|
1507
|
+
exports.IrrigationCCSystemConfigGet = IrrigationCCSystemConfigGet;
|
|
1508
|
+
let IrrigationCCValveInfoReport = class IrrigationCCValveInfoReport extends IrrigationCC {
|
|
1509
|
+
constructor(host, options) {
|
|
1510
|
+
super(host, options);
|
|
1511
|
+
(0, safe_1.validatePayload)(this.payload.length >= 4);
|
|
1512
|
+
if ((this.payload[0] & 0b1) === _Types_1.ValveType.MasterValve) {
|
|
1513
|
+
this.valveId = "master";
|
|
1514
|
+
}
|
|
1515
|
+
else {
|
|
1516
|
+
this.valveId = this.payload[1];
|
|
1517
|
+
}
|
|
1518
|
+
this.connected = !!(this.payload[0] & 0b10);
|
|
1519
|
+
this.nominalCurrent = 10 * this.payload[2];
|
|
1520
|
+
this.errorShortCircuit = !!(this.payload[3] & 0b1);
|
|
1521
|
+
this.errorHighCurrent = !!(this.payload[3] & 0b10);
|
|
1522
|
+
this.errorLowCurrent = !!(this.payload[3] & 0b100);
|
|
1523
|
+
if (this.valveId === "master") {
|
|
1524
|
+
this.errorMaximumFlow = !!(this.payload[3] & 0b1000);
|
|
1525
|
+
this.errorHighFlow = !!(this.payload[3] & 16);
|
|
1526
|
+
this.errorLowFlow = !!(this.payload[3] & 32);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
persistValues(applHost) {
|
|
1530
|
+
if (!super.persistValues(applHost))
|
|
1531
|
+
return false;
|
|
1532
|
+
const valueDB = this.getValueDB(applHost);
|
|
1533
|
+
// connected
|
|
1534
|
+
let valueId = getValveConnectedValueId(this.valveId, this.endpointIndex);
|
|
1535
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1536
|
+
valueDB.setMetadata(valueId, getValveConnectedValueMetadata(this.valveId));
|
|
1537
|
+
}
|
|
1538
|
+
valueDB.setValue(valueId, this.connected);
|
|
1539
|
+
// nominalCurrent
|
|
1540
|
+
valueId = getValveNominalCurrentValueId(this.valveId, this.endpointIndex);
|
|
1541
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1542
|
+
valueDB.setMetadata(valueId, getValveNominalCurrentValueMetadata(this.valveId));
|
|
1543
|
+
}
|
|
1544
|
+
valueDB.setValue(valueId, this.nominalCurrent);
|
|
1545
|
+
// errorShortCircuit
|
|
1546
|
+
valueId = getValveErrorShortCircuitValueId(this.valveId, this.endpointIndex);
|
|
1547
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1548
|
+
valueDB.setMetadata(valueId, getValveErrorShortCircuitValueMetadata(this.valveId));
|
|
1549
|
+
}
|
|
1550
|
+
valueDB.setValue(valueId, this.errorShortCircuit);
|
|
1551
|
+
// errorHighCurrent
|
|
1552
|
+
valueId = getValveErrorHighCurrentValueId(this.valveId, this.endpointIndex);
|
|
1553
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1554
|
+
valueDB.setMetadata(valueId, getValveErrorHighCurrentValueMetadata(this.valveId));
|
|
1555
|
+
}
|
|
1556
|
+
valueDB.setValue(valueId, this.errorHighCurrent);
|
|
1557
|
+
// errorLowCurrent
|
|
1558
|
+
valueId = getValveErrorLowCurrentValueId(this.valveId, this.endpointIndex);
|
|
1559
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1560
|
+
valueDB.setMetadata(valueId, getValveErrorLowCurrentValueMetadata(this.valveId));
|
|
1561
|
+
}
|
|
1562
|
+
valueDB.setValue(valueId, this.errorLowCurrent);
|
|
1563
|
+
if (this.errorMaximumFlow != undefined) {
|
|
1564
|
+
valueId = getValveErrorMaximumFlowValueId(this.valveId, this.endpointIndex);
|
|
1565
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1566
|
+
valueDB.setMetadata(valueId, getValveErrorMaximumFlowValueMetadata(this.valveId));
|
|
1567
|
+
}
|
|
1568
|
+
valueDB.setValue(valueId, this.errorMaximumFlow);
|
|
1569
|
+
}
|
|
1570
|
+
if (this.errorHighFlow != undefined) {
|
|
1571
|
+
valueId = getValveErrorHighFlowValueId(this.valveId, this.endpointIndex);
|
|
1572
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1573
|
+
valueDB.setMetadata(valueId, getValveErrorHighFlowValueMetadata(this.valveId));
|
|
1574
|
+
}
|
|
1575
|
+
valueDB.setValue(valueId, this.errorHighFlow);
|
|
1576
|
+
}
|
|
1577
|
+
if (this.errorLowFlow != undefined) {
|
|
1578
|
+
valueId = getValveErrorLowFlowValueId(this.valveId, this.endpointIndex);
|
|
1579
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1580
|
+
valueDB.setMetadata(valueId, getValveErrorLowFlowValueMetadata(this.valveId));
|
|
1581
|
+
}
|
|
1582
|
+
valueDB.setValue(valueId, this.errorLowFlow);
|
|
1583
|
+
}
|
|
1584
|
+
return true;
|
|
1585
|
+
}
|
|
1586
|
+
toLogEntry(applHost) {
|
|
1587
|
+
const message = {
|
|
1588
|
+
"valve ID": this.valveId,
|
|
1589
|
+
connected: this.connected,
|
|
1590
|
+
"nominal current": `${this.nominalCurrent} mA`,
|
|
1591
|
+
};
|
|
1592
|
+
const errors = [
|
|
1593
|
+
this.errorShortCircuit ? "short circuit" : undefined,
|
|
1594
|
+
this.errorHighCurrent ? "current above high threshold" : undefined,
|
|
1595
|
+
this.errorLowCurrent ? "current below low threshold" : undefined,
|
|
1596
|
+
this.errorMaximumFlow ? "maximum flow" : undefined,
|
|
1597
|
+
this.errorHighFlow ? "flow above high threshold" : undefined,
|
|
1598
|
+
this.errorLowFlow ? "flow below low threshold" : undefined,
|
|
1599
|
+
].filter(Boolean);
|
|
1600
|
+
if (errors.length > 0) {
|
|
1601
|
+
message.errors = errors.map((e) => `\n· ${e}`).join("");
|
|
1602
|
+
}
|
|
1603
|
+
return {
|
|
1604
|
+
...super.toLogEntry(applHost),
|
|
1605
|
+
message,
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
IrrigationCCValveInfoReport = __decorate([
|
|
1610
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.ValveInfoReport)
|
|
1611
|
+
], IrrigationCCValveInfoReport);
|
|
1612
|
+
exports.IrrigationCCValveInfoReport = IrrigationCCValveInfoReport;
|
|
1613
|
+
let IrrigationCCValveInfoGet = class IrrigationCCValveInfoGet extends IrrigationCC {
|
|
1614
|
+
constructor(host, options) {
|
|
1615
|
+
super(host, options);
|
|
1616
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1617
|
+
// TODO: Deserialize payload
|
|
1618
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1619
|
+
}
|
|
1620
|
+
else {
|
|
1621
|
+
this.valveId = options.valveId;
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
serialize() {
|
|
1625
|
+
this.payload = Buffer.from([
|
|
1626
|
+
this.valveId === "master" ? 1 : 0,
|
|
1627
|
+
this.valveId === "master" ? 1 : this.valveId || 1,
|
|
1628
|
+
]);
|
|
1629
|
+
return super.serialize();
|
|
1630
|
+
}
|
|
1631
|
+
toLogEntry(applHost) {
|
|
1632
|
+
return {
|
|
1633
|
+
...super.toLogEntry(applHost),
|
|
1634
|
+
message: {
|
|
1635
|
+
"valve ID": this.valveId,
|
|
1636
|
+
},
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
};
|
|
1640
|
+
IrrigationCCValveInfoGet = __decorate([
|
|
1641
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.ValveInfoGet),
|
|
1642
|
+
(0, CommandClass_1.expectedCCResponse)(IrrigationCCValveInfoReport, testResponseForIrrigationCommandWithValveId)
|
|
1643
|
+
], IrrigationCCValveInfoGet);
|
|
1644
|
+
exports.IrrigationCCValveInfoGet = IrrigationCCValveInfoGet;
|
|
1645
|
+
let IrrigationCCValveConfigSet = class IrrigationCCValveConfigSet extends IrrigationCC {
|
|
1646
|
+
constructor(host, options) {
|
|
1647
|
+
super(host, options);
|
|
1648
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1649
|
+
// TODO: Deserialize payload
|
|
1650
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1651
|
+
}
|
|
1652
|
+
else {
|
|
1653
|
+
this.valveId = options.valveId;
|
|
1654
|
+
this.nominalCurrentHighThreshold =
|
|
1655
|
+
options.nominalCurrentHighThreshold;
|
|
1656
|
+
this.nominalCurrentLowThreshold =
|
|
1657
|
+
options.nominalCurrentLowThreshold;
|
|
1658
|
+
this.maximumFlow = options.maximumFlow;
|
|
1659
|
+
this.highFlowThreshold = options.highFlowThreshold;
|
|
1660
|
+
this.lowFlowThreshold = options.lowFlowThreshold;
|
|
1661
|
+
this.useRainSensor = options.useRainSensor;
|
|
1662
|
+
this.useMoistureSensor = options.useMoistureSensor;
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
serialize() {
|
|
1666
|
+
this.payload = Buffer.concat([
|
|
1667
|
+
Buffer.from([
|
|
1668
|
+
this.valveId === "master" ? 1 : 0,
|
|
1669
|
+
this.valveId === "master" ? 1 : this.valveId || 1,
|
|
1670
|
+
Math.floor(this.nominalCurrentHighThreshold / 10),
|
|
1671
|
+
Math.floor(this.nominalCurrentLowThreshold / 10),
|
|
1672
|
+
]),
|
|
1673
|
+
(0, safe_1.encodeFloatWithScale)(this.maximumFlow, 0 /* l/h */),
|
|
1674
|
+
(0, safe_1.encodeFloatWithScale)(this.highFlowThreshold, 0 /* l/h */),
|
|
1675
|
+
(0, safe_1.encodeFloatWithScale)(this.lowFlowThreshold, 0 /* l/h */),
|
|
1676
|
+
Buffer.from([
|
|
1677
|
+
(this.useRainSensor ? 0b1 : 0) |
|
|
1678
|
+
(this.useMoistureSensor ? 0b10 : 0),
|
|
1679
|
+
]),
|
|
1680
|
+
]);
|
|
1681
|
+
return super.serialize();
|
|
1682
|
+
}
|
|
1683
|
+
toLogEntry(applHost) {
|
|
1684
|
+
return {
|
|
1685
|
+
...super.toLogEntry(applHost),
|
|
1686
|
+
message: {
|
|
1687
|
+
"valve ID": this.valveId,
|
|
1688
|
+
"nominal current high threshold": `${this.nominalCurrentHighThreshold} mA`,
|
|
1689
|
+
"nominal current low threshold": `${this.nominalCurrentLowThreshold} mA`,
|
|
1690
|
+
"maximum flow": `${this.maximumFlow} l/h`,
|
|
1691
|
+
"high flow threshold": `${this.highFlowThreshold} l/h`,
|
|
1692
|
+
"low flow threshold": `${this.lowFlowThreshold} l/h`,
|
|
1693
|
+
"use rain sensor": this.useRainSensor,
|
|
1694
|
+
"use moisture sensor": this.useMoistureSensor,
|
|
1695
|
+
},
|
|
1696
|
+
};
|
|
1697
|
+
}
|
|
1698
|
+
};
|
|
1699
|
+
IrrigationCCValveConfigSet = __decorate([
|
|
1700
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.ValveConfigSet)
|
|
1701
|
+
], IrrigationCCValveConfigSet);
|
|
1702
|
+
exports.IrrigationCCValveConfigSet = IrrigationCCValveConfigSet;
|
|
1703
|
+
let IrrigationCCValveConfigReport = class IrrigationCCValveConfigReport extends IrrigationCC {
|
|
1704
|
+
constructor(host, options) {
|
|
1705
|
+
super(host, options);
|
|
1706
|
+
(0, safe_1.validatePayload)(this.payload.length >= 4);
|
|
1707
|
+
if ((this.payload[0] & 0b1) === _Types_1.ValveType.MasterValve) {
|
|
1708
|
+
this.valveId = "master";
|
|
1709
|
+
}
|
|
1710
|
+
else {
|
|
1711
|
+
this.valveId = this.payload[1];
|
|
1712
|
+
}
|
|
1713
|
+
this.nominalCurrentHighThreshold = 10 * this.payload[2];
|
|
1714
|
+
this.nominalCurrentLowThreshold = 10 * this.payload[3];
|
|
1715
|
+
let offset = 4;
|
|
1716
|
+
{
|
|
1717
|
+
const { value, scale, bytesRead } = (0, safe_1.parseFloatWithScale)(this.payload.slice(offset));
|
|
1718
|
+
(0, safe_1.validatePayload)(scale === 0 /* l/h */);
|
|
1719
|
+
this.maximumFlow = value;
|
|
1720
|
+
offset += bytesRead;
|
|
1721
|
+
}
|
|
1722
|
+
{
|
|
1723
|
+
const { value, scale, bytesRead } = (0, safe_1.parseFloatWithScale)(this.payload.slice(offset));
|
|
1724
|
+
(0, safe_1.validatePayload)(scale === 0 /* l/h */);
|
|
1725
|
+
this.highFlowThreshold = value;
|
|
1726
|
+
offset += bytesRead;
|
|
1727
|
+
}
|
|
1728
|
+
{
|
|
1729
|
+
const { value, scale, bytesRead } = (0, safe_1.parseFloatWithScale)(this.payload.slice(offset));
|
|
1730
|
+
(0, safe_1.validatePayload)(scale === 0 /* l/h */);
|
|
1731
|
+
this.lowFlowThreshold = value;
|
|
1732
|
+
offset += bytesRead;
|
|
1733
|
+
}
|
|
1734
|
+
(0, safe_1.validatePayload)(this.payload.length >= offset + 1);
|
|
1735
|
+
this.useRainSensor = !!(this.payload[offset] & 0b1);
|
|
1736
|
+
this.useMoistureSensor = !!(this.payload[offset] & 0b10);
|
|
1737
|
+
}
|
|
1738
|
+
persistValues(applHost) {
|
|
1739
|
+
if (!super.persistValues(applHost))
|
|
1740
|
+
return false;
|
|
1741
|
+
const valueDB = this.getValueDB(applHost);
|
|
1742
|
+
// nominalCurrentHighThreshold
|
|
1743
|
+
let valueId = getNominalCurrentHighThresholdValueId(this.valveId, this.endpointIndex);
|
|
1744
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1745
|
+
valueDB.setMetadata(valueId, getNominalCurrentHighThresholdValueMetadata(this.valveId));
|
|
1746
|
+
}
|
|
1747
|
+
valueDB.setValue(valueId, this.nominalCurrentHighThreshold);
|
|
1748
|
+
// nominalCurrentLowThreshold
|
|
1749
|
+
valueId = getNominalCurrentLowThresholdValueId(this.valveId, this.endpointIndex);
|
|
1750
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1751
|
+
valueDB.setMetadata(valueId, getNominalCurrentLowThresholdValueMetadata(this.valveId));
|
|
1752
|
+
}
|
|
1753
|
+
valueDB.setValue(valueId, this.nominalCurrentLowThreshold);
|
|
1754
|
+
// maximumFlow
|
|
1755
|
+
valueId = getMaximumFlowValueId(this.valveId, this.endpointIndex);
|
|
1756
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1757
|
+
valueDB.setMetadata(valueId, getMaximumFlowValueMetadata(this.valveId));
|
|
1758
|
+
}
|
|
1759
|
+
valueDB.setValue(valueId, this.maximumFlow);
|
|
1760
|
+
// highFlowThreshold
|
|
1761
|
+
valueId = getHighFlowThresholdValueId(this.valveId, this.endpointIndex);
|
|
1762
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1763
|
+
valueDB.setMetadata(valueId, getHighFlowThresholdValueMetadata(this.valveId));
|
|
1764
|
+
}
|
|
1765
|
+
valueDB.setValue(valueId, this.highFlowThreshold);
|
|
1766
|
+
// lowFlowThreshold
|
|
1767
|
+
valueId = getLowFlowThresholdValueId(this.valveId, this.endpointIndex);
|
|
1768
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1769
|
+
valueDB.setMetadata(valueId, getLowFlowThresholdValueMetadata(this.valveId));
|
|
1770
|
+
}
|
|
1771
|
+
valueDB.setValue(valueId, this.lowFlowThreshold);
|
|
1772
|
+
// useRainSensor
|
|
1773
|
+
valueId = getUseRainSensorValueId(this.valveId, this.endpointIndex);
|
|
1774
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1775
|
+
valueDB.setMetadata(valueId, getUseRainSensorValueMetadata(this.valveId));
|
|
1776
|
+
}
|
|
1777
|
+
valueDB.setValue(valueId, this.useRainSensor);
|
|
1778
|
+
// useMoistureSensor
|
|
1779
|
+
valueId = getUseMoistureSensorValueId(this.valveId, this.endpointIndex);
|
|
1780
|
+
if (!valueDB.hasMetadata(valueId)) {
|
|
1781
|
+
valueDB.setMetadata(valueId, getUseMoistureSensorValueMetadata(this.valveId));
|
|
1782
|
+
}
|
|
1783
|
+
valueDB.setValue(valueId, this.useMoistureSensor);
|
|
1784
|
+
return true;
|
|
1785
|
+
}
|
|
1786
|
+
toLogEntry(applHost) {
|
|
1787
|
+
return {
|
|
1788
|
+
...super.toLogEntry(applHost),
|
|
1789
|
+
message: {
|
|
1790
|
+
"valve ID": this.valveId,
|
|
1791
|
+
"nominal current high threshold": `${this.nominalCurrentHighThreshold} mA`,
|
|
1792
|
+
"nominal current low threshold": `${this.nominalCurrentLowThreshold} mA`,
|
|
1793
|
+
"maximum flow": `${this.maximumFlow} l/h`,
|
|
1794
|
+
"high flow threshold": `${this.highFlowThreshold} l/h`,
|
|
1795
|
+
"low flow threshold": `${this.lowFlowThreshold} l/h`,
|
|
1796
|
+
"use rain sensor": this.useRainSensor,
|
|
1797
|
+
"use moisture sensor": this.useMoistureSensor,
|
|
1798
|
+
},
|
|
1799
|
+
};
|
|
1800
|
+
}
|
|
1801
|
+
};
|
|
1802
|
+
IrrigationCCValveConfigReport = __decorate([
|
|
1803
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.ValveConfigReport)
|
|
1804
|
+
], IrrigationCCValveConfigReport);
|
|
1805
|
+
exports.IrrigationCCValveConfigReport = IrrigationCCValveConfigReport;
|
|
1806
|
+
let IrrigationCCValveConfigGet = class IrrigationCCValveConfigGet extends IrrigationCC {
|
|
1807
|
+
constructor(host, options) {
|
|
1808
|
+
super(host, options);
|
|
1809
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1810
|
+
// TODO: Deserialize payload
|
|
1811
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1812
|
+
}
|
|
1813
|
+
else {
|
|
1814
|
+
this.valveId = options.valveId;
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
serialize() {
|
|
1818
|
+
this.payload = Buffer.from([
|
|
1819
|
+
this.valveId === "master" ? 1 : 0,
|
|
1820
|
+
this.valveId === "master" ? 1 : this.valveId || 1,
|
|
1821
|
+
]);
|
|
1822
|
+
return super.serialize();
|
|
1823
|
+
}
|
|
1824
|
+
toLogEntry(applHost) {
|
|
1825
|
+
return {
|
|
1826
|
+
...super.toLogEntry(applHost),
|
|
1827
|
+
message: {
|
|
1828
|
+
"valve ID": this.valveId,
|
|
1829
|
+
},
|
|
1830
|
+
};
|
|
1831
|
+
}
|
|
1832
|
+
};
|
|
1833
|
+
IrrigationCCValveConfigGet = __decorate([
|
|
1834
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.ValveConfigGet),
|
|
1835
|
+
(0, CommandClass_1.expectedCCResponse)(IrrigationCCValveConfigReport, testResponseForIrrigationCommandWithValveId)
|
|
1836
|
+
], IrrigationCCValveConfigGet);
|
|
1837
|
+
exports.IrrigationCCValveConfigGet = IrrigationCCValveConfigGet;
|
|
1838
|
+
let IrrigationCCValveRun = class IrrigationCCValveRun extends IrrigationCC {
|
|
1839
|
+
constructor(host, options) {
|
|
1840
|
+
super(host, options);
|
|
1841
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1842
|
+
// TODO: Deserialize payload
|
|
1843
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1844
|
+
}
|
|
1845
|
+
else {
|
|
1846
|
+
this.valveId = options.valveId;
|
|
1847
|
+
this.duration = options.duration;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
serialize() {
|
|
1851
|
+
this.payload = Buffer.from([
|
|
1852
|
+
this.valveId === "master" ? 1 : 0,
|
|
1853
|
+
this.valveId === "master" ? 1 : this.valveId || 1,
|
|
1854
|
+
0,
|
|
1855
|
+
0,
|
|
1856
|
+
]);
|
|
1857
|
+
this.payload.writeUInt16BE(this.duration, 2);
|
|
1858
|
+
return super.serialize();
|
|
1859
|
+
}
|
|
1860
|
+
toLogEntry(applHost) {
|
|
1861
|
+
const message = {
|
|
1862
|
+
"valve ID": this.valveId,
|
|
1863
|
+
};
|
|
1864
|
+
if (this.duration) {
|
|
1865
|
+
message.duration = `${this.duration} s`;
|
|
1866
|
+
}
|
|
1867
|
+
else {
|
|
1868
|
+
message.action = "turn off";
|
|
1869
|
+
}
|
|
1870
|
+
return {
|
|
1871
|
+
...super.toLogEntry(applHost),
|
|
1872
|
+
message,
|
|
1873
|
+
};
|
|
1874
|
+
}
|
|
1875
|
+
};
|
|
1876
|
+
IrrigationCCValveRun = __decorate([
|
|
1877
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.ValveRun)
|
|
1878
|
+
], IrrigationCCValveRun);
|
|
1879
|
+
exports.IrrigationCCValveRun = IrrigationCCValveRun;
|
|
1880
|
+
let IrrigationCCValveTableSet = class IrrigationCCValveTableSet extends IrrigationCC {
|
|
1881
|
+
constructor(host, options) {
|
|
1882
|
+
super(host, options);
|
|
1883
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1884
|
+
// TODO: Deserialize payload
|
|
1885
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1886
|
+
}
|
|
1887
|
+
else {
|
|
1888
|
+
this.tableId = options.tableId;
|
|
1889
|
+
this.entries = options.entries;
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
serialize() {
|
|
1893
|
+
this.payload = Buffer.allocUnsafe(1 + this.entries.length * 3);
|
|
1894
|
+
this.payload[0] = this.tableId;
|
|
1895
|
+
for (let i = 0; i < this.entries.length; i++) {
|
|
1896
|
+
const entry = this.entries[i];
|
|
1897
|
+
const offset = 1 + i * 3;
|
|
1898
|
+
this.payload[offset] = entry.valveId;
|
|
1899
|
+
this.payload.writeUInt16BE(entry.duration, offset + 1);
|
|
1900
|
+
}
|
|
1901
|
+
return super.serialize();
|
|
1902
|
+
}
|
|
1903
|
+
toLogEntry(applHost) {
|
|
1904
|
+
const message = {
|
|
1905
|
+
"table ID": this.tableId,
|
|
1906
|
+
};
|
|
1907
|
+
for (let i = 0; i < this.entries.length; i++) {
|
|
1908
|
+
const entry = this.entries[i];
|
|
1909
|
+
const valveLabel = (0, strings_1.padStart)(entry.valveId.toString(), 3, "0");
|
|
1910
|
+
if (entry.duration) {
|
|
1911
|
+
message[`valve ${valveLabel} duration`] = `${entry.duration} s`;
|
|
1912
|
+
}
|
|
1913
|
+
else {
|
|
1914
|
+
message[`valve ${valveLabel} action`] = `turn off`;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
return {
|
|
1918
|
+
...super.toLogEntry(applHost),
|
|
1919
|
+
message,
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1922
|
+
};
|
|
1923
|
+
IrrigationCCValveTableSet = __decorate([
|
|
1924
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.ValveTableSet)
|
|
1925
|
+
], IrrigationCCValveTableSet);
|
|
1926
|
+
exports.IrrigationCCValveTableSet = IrrigationCCValveTableSet;
|
|
1927
|
+
let IrrigationCCValveTableReport = class IrrigationCCValveTableReport extends IrrigationCC {
|
|
1928
|
+
constructor(host, options) {
|
|
1929
|
+
super(host, options);
|
|
1930
|
+
(0, safe_1.validatePayload)((this.payload.length - 1) % 3 === 0);
|
|
1931
|
+
this.tableId = this.payload[0];
|
|
1932
|
+
this.entries = [];
|
|
1933
|
+
for (let offset = 1; offset < this.payload.length; offset += 3) {
|
|
1934
|
+
this.entries.push({
|
|
1935
|
+
valveId: this.payload[offset],
|
|
1936
|
+
duration: this.payload.readUInt16BE(offset + 1),
|
|
1937
|
+
});
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
toLogEntry(applHost) {
|
|
1941
|
+
const message = {
|
|
1942
|
+
"table ID": this.tableId,
|
|
1943
|
+
};
|
|
1944
|
+
for (let i = 0; i < this.entries.length; i++) {
|
|
1945
|
+
const entry = this.entries[i];
|
|
1946
|
+
const valveLabel = (0, strings_1.padStart)(entry.valveId.toString(), 3, "0");
|
|
1947
|
+
if (entry.duration) {
|
|
1948
|
+
message[`valve ${valveLabel} duration`] = `${entry.duration} s`;
|
|
1949
|
+
}
|
|
1950
|
+
else {
|
|
1951
|
+
message[`valve ${valveLabel} action`] = `turn off`;
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
return {
|
|
1955
|
+
...super.toLogEntry(applHost),
|
|
1956
|
+
message,
|
|
1957
|
+
};
|
|
1958
|
+
}
|
|
1959
|
+
};
|
|
1960
|
+
IrrigationCCValveTableReport = __decorate([
|
|
1961
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.ValveTableReport)
|
|
1962
|
+
], IrrigationCCValveTableReport);
|
|
1963
|
+
exports.IrrigationCCValveTableReport = IrrigationCCValveTableReport;
|
|
1964
|
+
function testResponseForIrrigationValveTableGet(sent, received) {
|
|
1965
|
+
return received.tableId === sent.tableId;
|
|
1966
|
+
}
|
|
1967
|
+
let IrrigationCCValveTableGet = class IrrigationCCValveTableGet extends IrrigationCC {
|
|
1968
|
+
constructor(host, options) {
|
|
1969
|
+
super(host, options);
|
|
1970
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1971
|
+
// TODO: Deserialize payload
|
|
1972
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1973
|
+
}
|
|
1974
|
+
else {
|
|
1975
|
+
this.tableId = options.tableId;
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
serialize() {
|
|
1979
|
+
this.payload = Buffer.from([this.tableId]);
|
|
1980
|
+
return super.serialize();
|
|
1981
|
+
}
|
|
1982
|
+
toLogEntry(applHost) {
|
|
1983
|
+
return {
|
|
1984
|
+
...super.toLogEntry(applHost),
|
|
1985
|
+
message: {
|
|
1986
|
+
"table ID": this.tableId,
|
|
1987
|
+
},
|
|
1988
|
+
};
|
|
1989
|
+
}
|
|
1990
|
+
};
|
|
1991
|
+
IrrigationCCValveTableGet = __decorate([
|
|
1992
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.ValveTableGet),
|
|
1993
|
+
(0, CommandClass_1.expectedCCResponse)(IrrigationCCValveTableReport, testResponseForIrrigationValveTableGet)
|
|
1994
|
+
], IrrigationCCValveTableGet);
|
|
1995
|
+
exports.IrrigationCCValveTableGet = IrrigationCCValveTableGet;
|
|
1996
|
+
let IrrigationCCValveTableRun = class IrrigationCCValveTableRun extends IrrigationCC {
|
|
1997
|
+
constructor(host, options) {
|
|
1998
|
+
super(host, options);
|
|
1999
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
2000
|
+
// TODO: Deserialize payload
|
|
2001
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
2002
|
+
}
|
|
2003
|
+
else {
|
|
2004
|
+
this.tableIDs = options.tableIDs;
|
|
2005
|
+
if (this.tableIDs.length < 1) {
|
|
2006
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: At least one table ID must be specified.`, safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
serialize() {
|
|
2011
|
+
this.payload = Buffer.from(this.tableIDs);
|
|
2012
|
+
return super.serialize();
|
|
2013
|
+
}
|
|
2014
|
+
toLogEntry(applHost) {
|
|
2015
|
+
return {
|
|
2016
|
+
...super.toLogEntry(applHost),
|
|
2017
|
+
message: {
|
|
2018
|
+
"table IDs": this.tableIDs
|
|
2019
|
+
.map((id) => (0, strings_1.padStart)(id.toString(), 3, "0"))
|
|
2020
|
+
.join(", "),
|
|
2021
|
+
},
|
|
2022
|
+
};
|
|
2023
|
+
}
|
|
2024
|
+
};
|
|
2025
|
+
IrrigationCCValveTableRun = __decorate([
|
|
2026
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.ValveTableRun)
|
|
2027
|
+
], IrrigationCCValveTableRun);
|
|
2028
|
+
exports.IrrigationCCValveTableRun = IrrigationCCValveTableRun;
|
|
2029
|
+
let IrrigationCCSystemShutoff = class IrrigationCCSystemShutoff extends IrrigationCC {
|
|
2030
|
+
constructor(host, options) {
|
|
2031
|
+
super(host, options);
|
|
2032
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
2033
|
+
// TODO: Deserialize payload
|
|
2034
|
+
throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
2035
|
+
}
|
|
2036
|
+
else {
|
|
2037
|
+
this.duration = options.duration;
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
serialize() {
|
|
2041
|
+
var _c;
|
|
2042
|
+
this.payload = Buffer.from([(_c = this.duration) !== null && _c !== void 0 ? _c : 255]);
|
|
2043
|
+
return super.serialize();
|
|
2044
|
+
}
|
|
2045
|
+
toLogEntry(applHost) {
|
|
2046
|
+
return {
|
|
2047
|
+
...super.toLogEntry(applHost),
|
|
2048
|
+
message: {
|
|
2049
|
+
duration: this.duration === 0
|
|
2050
|
+
? "temporarily"
|
|
2051
|
+
: this.duration === 255 || this.duration === undefined
|
|
2052
|
+
? "permanently"
|
|
2053
|
+
: `${this.duration} hours`,
|
|
2054
|
+
},
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
2057
|
+
};
|
|
2058
|
+
IrrigationCCSystemShutoff = __decorate([
|
|
2059
|
+
(0, CommandClass_1.CCCommand)(_Types_1.IrrigationCommand.SystemShutoff)
|
|
2060
|
+
], IrrigationCCSystemShutoff);
|
|
2061
|
+
exports.IrrigationCCSystemShutoff = IrrigationCCSystemShutoff;
|
|
2062
|
+
//# sourceMappingURL=IrrigationCC.js.map
|