@zwave-js/cc 13.10.1 → 14.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cc/AlarmSensorCC.d.ts +31 -20
- package/build/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/cc/AlarmSensorCC.js +106 -87
- package/build/cc/AlarmSensorCC.js.map +1 -1
- package/build/cc/AssociationCC.d.ts +38 -32
- package/build/cc/AssociationCC.d.ts.map +1 -1
- package/build/cc/AssociationCC.js +193 -176
- package/build/cc/AssociationCC.js.map +1 -1
- package/build/cc/AssociationGroupInfoCC.d.ts +42 -36
- package/build/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/cc/AssociationGroupInfoCC.js +218 -200
- package/build/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/cc/BarrierOperatorCC.d.ts +41 -24
- package/build/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/cc/BarrierOperatorCC.js +143 -109
- package/build/cc/BarrierOperatorCC.js.map +1 -1
- package/build/cc/BasicCC.d.ts +22 -23
- package/build/cc/BasicCC.d.ts.map +1 -1
- package/build/cc/BasicCC.js +83 -77
- package/build/cc/BasicCC.js.map +1 -1
- package/build/cc/BatteryCC.d.ts +22 -14
- package/build/cc/BatteryCC.d.ts.map +1 -1
- package/build/cc/BatteryCC.js +116 -87
- package/build/cc/BatteryCC.js.map +1 -1
- package/build/cc/BinarySensorCC.d.ts +22 -19
- package/build/cc/BinarySensorCC.d.ts.map +1 -1
- package/build/cc/BinarySensorCC.js +103 -93
- package/build/cc/BinarySensorCC.js.map +1 -1
- package/build/cc/BinarySwitchCC.d.ts +20 -20
- package/build/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/cc/BinarySwitchCC.js +71 -59
- package/build/cc/BinarySwitchCC.js.map +1 -1
- package/build/cc/CRC16CC.d.ts +9 -9
- package/build/cc/CRC16CC.d.ts.map +1 -1
- package/build/cc/CRC16CC.js +36 -36
- package/build/cc/CRC16CC.js.map +1 -1
- package/build/cc/CentralSceneCC.d.ts +34 -16
- package/build/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/cc/CentralSceneCC.js +116 -79
- package/build/cc/CentralSceneCC.js.map +1 -1
- package/build/cc/ClimateControlScheduleCC.d.ts +38 -21
- package/build/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/cc/ClimateControlScheduleCC.js +113 -81
- package/build/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/cc/ClockCC.d.ts +18 -11
- package/build/cc/ClockCC.d.ts.map +1 -1
- package/build/cc/ClockCC.js +57 -43
- package/build/cc/ClockCC.js.map +1 -1
- package/build/cc/ColorSwitchCC.d.ts +37 -33
- package/build/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/cc/ColorSwitchCC.js +216 -189
- package/build/cc/ColorSwitchCC.js.map +1 -1
- package/build/cc/ConfigurationCC.d.ts +89 -74
- package/build/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/cc/ConfigurationCC.js +541 -485
- package/build/cc/ConfigurationCC.js.map +1 -1
- package/build/cc/DeviceResetLocallyCC.d.ts +3 -3
- package/build/cc/DeviceResetLocallyCC.d.ts.map +1 -1
- package/build/cc/DeviceResetLocallyCC.js +14 -14
- package/build/cc/DeviceResetLocallyCC.js.map +1 -1
- package/build/cc/DoorLockCC.d.ts +66 -27
- package/build/cc/DoorLockCC.d.ts.map +1 -1
- package/build/cc/DoorLockCC.js +288 -197
- package/build/cc/DoorLockCC.js.map +1 -1
- package/build/cc/DoorLockLoggingCC.d.ts +23 -13
- package/build/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/cc/DoorLockLoggingCC.js +81 -63
- package/build/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/cc/EnergyProductionCC.d.ts +16 -14
- package/build/cc/EnergyProductionCC.d.ts.map +1 -1
- package/build/cc/EnergyProductionCC.js +58 -52
- package/build/cc/EnergyProductionCC.js.map +1 -1
- package/build/cc/EntryControlCC.d.ts +44 -18
- package/build/cc/EntryControlCC.d.ts.map +1 -1
- package/build/cc/EntryControlCC.js +163 -112
- package/build/cc/EntryControlCC.js.map +1 -1
- package/build/cc/FirmwareUpdateMetaDataCC.d.ts +69 -34
- package/build/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
- package/build/cc/FirmwareUpdateMetaDataCC.js +311 -245
- package/build/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/cc/HumidityControlModeCC.d.ts +24 -16
- package/build/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/cc/HumidityControlModeCC.js +80 -65
- package/build/cc/HumidityControlModeCC.js.map +1 -1
- package/build/cc/HumidityControlOperatingStateCC.d.ts +11 -7
- package/build/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/cc/HumidityControlOperatingStateCC.js +31 -22
- package/build/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/cc/HumidityControlSetpointCC.d.ts +68 -49
- package/build/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/cc/HumidityControlSetpointCC.js +203 -181
- package/build/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/cc/InclusionControllerCC.d.ts +13 -11
- package/build/cc/InclusionControllerCC.d.ts.map +1 -1
- package/build/cc/InclusionControllerCC.js +49 -42
- package/build/cc/InclusionControllerCC.js.map +1 -1
- package/build/cc/IndicatorCC.d.ts +46 -39
- package/build/cc/IndicatorCC.d.ts.map +1 -1
- package/build/cc/IndicatorCC.js +298 -277
- package/build/cc/IndicatorCC.js.map +1 -1
- package/build/cc/IrrigationCC.d.ts +127 -57
- package/build/cc/IrrigationCC.d.ts.map +1 -1
- package/build/cc/IrrigationCC.js +496 -352
- package/build/cc/IrrigationCC.js.map +1 -1
- package/build/cc/LanguageCC.d.ts +17 -11
- package/build/cc/LanguageCC.d.ts.map +1 -1
- package/build/cc/LanguageCC.js +54 -44
- package/build/cc/LanguageCC.js.map +1 -1
- package/build/cc/LockCC.d.ts +16 -11
- package/build/cc/LockCC.d.ts.map +1 -1
- package/build/cc/LockCC.js +48 -38
- package/build/cc/LockCC.js.map +1 -1
- package/build/cc/ManufacturerProprietaryCC.d.ts +12 -11
- package/build/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
- package/build/cc/ManufacturerProprietaryCC.js +45 -50
- package/build/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/cc/ManufacturerSpecificCC.d.ts +20 -13
- package/build/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/cc/ManufacturerSpecificCC.js +79 -63
- package/build/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/cc/MeterCC.d.ts +30 -26
- package/build/cc/MeterCC.d.ts.map +1 -1
- package/build/cc/MeterCC.js +236 -204
- package/build/cc/MeterCC.js.map +1 -1
- package/build/cc/MultiChannelAssociationCC.d.ts +31 -26
- package/build/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/cc/MultiChannelAssociationCC.js +177 -168
- package/build/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/cc/MultiChannelCC.d.ts +70 -49
- package/build/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/cc/MultiChannelCC.js +377 -318
- package/build/cc/MultiChannelCC.js.map +1 -1
- package/build/cc/MultiCommandCC.d.ts +9 -9
- package/build/cc/MultiCommandCC.d.ts.map +1 -1
- package/build/cc/MultiCommandCC.js +35 -36
- package/build/cc/MultiCommandCC.js.map +1 -1
- package/build/cc/MultilevelSensorCC.d.ts +38 -33
- package/build/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/cc/MultilevelSensorCC.js +172 -152
- package/build/cc/MultilevelSensorCC.js.map +1 -1
- package/build/cc/MultilevelSwitchCC.d.ts +29 -25
- package/build/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/cc/MultilevelSwitchCC.js +147 -127
- package/build/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/cc/NoOperationCC.d.ts +0 -8
- package/build/cc/NoOperationCC.d.ts.map +1 -1
- package/build/cc/NoOperationCC.js +2 -11
- package/build/cc/NoOperationCC.js.map +1 -1
- package/build/cc/NodeNamingCC.d.ts +27 -17
- package/build/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/cc/NodeNamingCC.js +86 -69
- package/build/cc/NodeNamingCC.js.map +1 -1
- package/build/cc/NotificationCC.d.ts +46 -43
- package/build/cc/NotificationCC.d.ts.map +1 -1
- package/build/cc/NotificationCC.js +317 -303
- package/build/cc/NotificationCC.js.map +1 -1
- package/build/cc/PowerlevelCC.d.ts +22 -18
- package/build/cc/PowerlevelCC.d.ts.map +1 -1
- package/build/cc/PowerlevelCC.js +125 -95
- package/build/cc/PowerlevelCC.js.map +1 -1
- package/build/cc/ProtectionCC.d.ts +49 -26
- package/build/cc/ProtectionCC.d.ts.map +1 -1
- package/build/cc/ProtectionCC.js +172 -126
- package/build/cc/ProtectionCC.js.map +1 -1
- package/build/cc/SceneActivationCC.d.ts +8 -7
- package/build/cc/SceneActivationCC.d.ts.map +1 -1
- package/build/cc/SceneActivationCC.js +28 -23
- package/build/cc/SceneActivationCC.js.map +1 -1
- package/build/cc/SceneActuatorConfigurationCC.d.ts +23 -15
- package/build/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/cc/SceneActuatorConfigurationCC.js +79 -62
- package/build/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/cc/SceneControllerConfigurationCC.d.ts +25 -17
- package/build/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/cc/SceneControllerConfigurationCC.js +92 -78
- package/build/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/cc/ScheduleEntryLockCC.d.ts +86 -72
- package/build/cc/ScheduleEntryLockCC.d.ts.map +1 -1
- package/build/cc/ScheduleEntryLockCC.js +607 -455
- package/build/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/cc/Security2CC.d.ts +78 -87
- package/build/cc/Security2CC.d.ts.map +1 -1
- package/build/cc/Security2CC.js +798 -765
- package/build/cc/Security2CC.js.map +1 -1
- package/build/cc/SecurityCC.d.ts +47 -42
- package/build/cc/SecurityCC.d.ts.map +1 -1
- package/build/cc/SecurityCC.js +240 -218
- package/build/cc/SecurityCC.js.map +1 -1
- package/build/cc/SoundSwitchCC.d.ts +36 -29
- package/build/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/cc/SoundSwitchCC.js +180 -157
- package/build/cc/SoundSwitchCC.js.map +1 -1
- package/build/cc/SupervisionCC.d.ts +17 -14
- package/build/cc/SupervisionCC.d.ts.map +1 -1
- package/build/cc/SupervisionCC.js +86 -66
- package/build/cc/SupervisionCC.js.map +1 -1
- package/build/cc/ThermostatFanModeCC.d.ts +25 -15
- package/build/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/cc/ThermostatFanModeCC.js +79 -60
- package/build/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/cc/ThermostatFanStateCC.d.ts +11 -7
- package/build/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/cc/ThermostatFanStateCC.js +31 -22
- package/build/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/cc/ThermostatModeCC.d.ts +24 -21
- package/build/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/cc/ThermostatModeCC.js +106 -90
- package/build/cc/ThermostatModeCC.js.map +1 -1
- package/build/cc/ThermostatOperatingStateCC.d.ts +11 -7
- package/build/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/cc/ThermostatOperatingStateCC.js +31 -22
- package/build/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/cc/ThermostatSetbackCC.d.ts +14 -13
- package/build/cc/ThermostatSetbackCC.d.ts.map +1 -1
- package/build/cc/ThermostatSetbackCC.js +64 -57
- package/build/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/cc/ThermostatSetpointCC.d.ts +38 -57
- package/build/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/cc/ThermostatSetpointCC.js +200 -264
- package/build/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/cc/TimeCC.d.ts +24 -20
- package/build/cc/TimeCC.d.ts.map +1 -1
- package/build/cc/TimeCC.js +119 -108
- package/build/cc/TimeCC.js.map +1 -1
- package/build/cc/TimeParametersCC.d.ts +18 -14
- package/build/cc/TimeParametersCC.d.ts.map +1 -1
- package/build/cc/TimeParametersCC.js +77 -69
- package/build/cc/TimeParametersCC.js.map +1 -1
- package/build/cc/TransportServiceCC.d.ts +29 -32
- package/build/cc/TransportServiceCC.d.ts.map +1 -1
- package/build/cc/TransportServiceCC.js +159 -161
- package/build/cc/TransportServiceCC.js.map +1 -1
- package/build/cc/UserCodeCC.d.ts +83 -66
- package/build/cc/UserCodeCC.d.ts.map +1 -1
- package/build/cc/UserCodeCC.js +449 -402
- package/build/cc/UserCodeCC.js.map +1 -1
- package/build/cc/VersionCC.d.ts +36 -20
- package/build/cc/VersionCC.d.ts.map +1 -1
- package/build/cc/VersionCC.js +190 -149
- package/build/cc/VersionCC.js.map +1 -1
- package/build/cc/WakeUpCC.d.ts +27 -13
- package/build/cc/WakeUpCC.d.ts.map +1 -1
- package/build/cc/WakeUpCC.js +105 -77
- package/build/cc/WakeUpCC.js.map +1 -1
- package/build/cc/WindowCoveringCC.d.ts +39 -27
- package/build/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/cc/WindowCoveringCC.js +169 -137
- package/build/cc/WindowCoveringCC.js.map +1 -1
- package/build/cc/ZWavePlusCC.d.ts +8 -7
- package/build/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/cc/ZWavePlusCC.js +44 -37
- package/build/cc/ZWavePlusCC.js.map +1 -1
- package/build/cc/ZWaveProtocolCC.d.ts +111 -84
- package/build/cc/ZWaveProtocolCC.d.ts.map +1 -1
- package/build/cc/ZWaveProtocolCC.js +583 -508
- package/build/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/cc/index.d.ts +37 -34
- package/build/cc/index.d.ts.map +1 -1
- package/build/cc/index.js +6 -7
- package/build/cc/index.js.map +1 -1
- package/build/cc/manufacturerProprietary/FibaroCC.d.ts +29 -24
- package/build/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
- package/build/cc/manufacturerProprietary/FibaroCC.js +109 -112
- package/build/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/index.d.ts +0 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +0 -1
- package/build/index.js.map +1 -1
- package/build/lib/API.d.ts +21 -18
- package/build/lib/API.d.ts.map +1 -1
- package/build/lib/API.js +25 -49
- package/build/lib/API.js.map +1 -1
- package/build/lib/CommandClass.d.ts +51 -89
- package/build/lib/CommandClass.d.ts.map +1 -1
- package/build/lib/CommandClass.js +177 -249
- package/build/lib/CommandClass.js.map +1 -1
- package/build/lib/EncapsulatingCommandClass.d.ts +1 -15
- package/build/lib/EncapsulatingCommandClass.d.ts.map +1 -1
- package/build/lib/EncapsulatingCommandClass.js.map +1 -1
- package/build/lib/ICommandClassContainer.d.ts +1 -8
- package/build/lib/ICommandClassContainer.d.ts.map +1 -1
- package/build/lib/ICommandClassContainer.js +0 -8
- package/build/lib/ICommandClassContainer.js.map +1 -1
- package/build/lib/Values.d.ts +3 -3
- package/build/lib/Values.d.ts.map +1 -1
- package/build/lib/_Types.d.ts.map +1 -1
- package/build/lib/_Types.js +1 -0
- package/build/lib/_Types.js.map +1 -1
- package/build/lib/utils.d.ts +14 -13
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +94 -92
- package/build/lib/utils.js.map +1 -1
- package/package.json +4 -5
|
@@ -5,6 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var MultilevelSensorCCReport_1, MultilevelSensorCCGet_1, MultilevelSensorCCSupportedSensorReport_1, MultilevelSensorCCSupportedScaleReport_1, MultilevelSensorCCGetSupportedScale_1;
|
|
8
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
10
|
exports.MultilevelSensorCCGetSupportedScale = exports.MultilevelSensorCCSupportedScaleReport = exports.MultilevelSensorCCGetSupportedSensor = exports.MultilevelSensorCCSupportedSensorReport = exports.MultilevelSensorCCGet = exports.MultilevelSensorCCReport = exports.MultilevelSensorCC = exports.MultilevelSensorCCAPI = exports.MultilevelSensorCCValues = void 0;
|
|
10
11
|
function __assertType(argName, typeName, boundHasError) {
|
|
@@ -114,11 +115,12 @@ exports.MultilevelSensorCCValues = Object.freeze({
|
|
|
114
115
|
* Determine the scale to use to query a sensor reading. Uses the user-preferred scale if given,
|
|
115
116
|
* followed by the most recently used scale, otherwile falls back to the first supported one.
|
|
116
117
|
*/
|
|
117
|
-
function getPreferredSensorScale(
|
|
118
|
+
function getPreferredSensorScale(ctx, nodeId, endpointIndex, sensorType, supportedScales) {
|
|
119
|
+
const preferences = ctx.getUserPreferences();
|
|
118
120
|
const sensor = (0, core_1.getSensor)(sensorType);
|
|
119
121
|
// If the sensor type is unknown, we have no default. Use the user-provided scale or 0
|
|
120
122
|
if (!sensor) {
|
|
121
|
-
const preferred =
|
|
123
|
+
const preferred = preferences?.scales[sensorType];
|
|
122
124
|
// We cannot look up strings for unknown sensor types, so this must be a number or we use the fallback
|
|
123
125
|
if (typeof preferred !== "number")
|
|
124
126
|
return 0;
|
|
@@ -128,23 +130,23 @@ function getPreferredSensorScale(applHost, nodeId, endpointIndex, sensorType, su
|
|
|
128
130
|
let preferred;
|
|
129
131
|
// Named scales apply to multiple sensor types. To be able to override the scale for single types
|
|
130
132
|
// we need to look at the preferences by sensor type first
|
|
131
|
-
preferred =
|
|
133
|
+
preferred = preferences?.scales[sensorType];
|
|
132
134
|
// If the scale is named, we can then try to use the named preference
|
|
133
135
|
const scaleGroupName = sensor.scaleGroupName;
|
|
134
136
|
if (preferred == undefined && scaleGroupName) {
|
|
135
|
-
preferred =
|
|
137
|
+
preferred = preferences?.scales[scaleGroupName];
|
|
136
138
|
}
|
|
137
139
|
// Then attempt reading the scale from the corresponding value
|
|
138
140
|
if (preferred == undefined) {
|
|
139
141
|
const sensorName = (0, core_1.getSensorName)(sensorType);
|
|
140
142
|
const sensorValue = exports.MultilevelSensorCCValues.value(sensorName);
|
|
141
|
-
const metadata =
|
|
143
|
+
const metadata = ctx
|
|
142
144
|
.tryGetValueDB(nodeId)
|
|
143
145
|
?.getMetadata(sensorValue.endpoint(endpointIndex));
|
|
144
146
|
const scale = metadata?.ccSpecific?.scale;
|
|
145
147
|
if (typeof scale === "number" && supportedScales.includes(scale)) {
|
|
146
148
|
preferred = scale;
|
|
147
|
-
|
|
149
|
+
ctx.logNode(nodeId, {
|
|
148
150
|
endpoint: endpointIndex,
|
|
149
151
|
message: `No scale preference for sensor type ${sensorType}, using the last-used scale ${preferred}`,
|
|
150
152
|
});
|
|
@@ -153,7 +155,7 @@ function getPreferredSensorScale(applHost, nodeId, endpointIndex, sensorType, su
|
|
|
153
155
|
// Then fall back to the first supported scale
|
|
154
156
|
if (preferred == undefined) {
|
|
155
157
|
preferred = supportedScales[0] ?? 0;
|
|
156
|
-
|
|
158
|
+
ctx.logNode(nodeId, {
|
|
157
159
|
endpoint: endpointIndex,
|
|
158
160
|
message: `No scale preference for sensor type ${sensorType}, using the first supported scale ${preferred}`,
|
|
159
161
|
});
|
|
@@ -170,7 +172,7 @@ function getPreferredSensorScale(applHost, nodeId, endpointIndex, sensorType, su
|
|
|
170
172
|
}
|
|
171
173
|
if (typeof preferred === "string") {
|
|
172
174
|
// Looking up failed
|
|
173
|
-
|
|
175
|
+
ctx.logNode(nodeId, {
|
|
174
176
|
endpoint: endpointIndex,
|
|
175
177
|
message: `Preferred scale "${preferred}" for sensor type ${sensorType} not found, using the first supported scale ${supportedScales[0] ?? 0}`,
|
|
176
178
|
});
|
|
@@ -182,7 +184,7 @@ function getPreferredSensorScale(applHost, nodeId, endpointIndex, sensorType, su
|
|
|
182
184
|
return preferred;
|
|
183
185
|
}
|
|
184
186
|
else if (!supportedScales.includes(preferred)) {
|
|
185
|
-
|
|
187
|
+
ctx.logNode(nodeId, {
|
|
186
188
|
endpoint: endpointIndex,
|
|
187
189
|
message: `Preferred scale ${preferred} not supported for sensor type ${sensorType}, using the first supported scale`,
|
|
188
190
|
});
|
|
@@ -235,15 +237,15 @@ let MultilevelSensorCCAPI = class MultilevelSensorCCAPI extends API_1.PhysicalCC
|
|
|
235
237
|
property: "supportedScales",
|
|
236
238
|
propertyKey: sensorType,
|
|
237
239
|
}) ?? [];
|
|
238
|
-
preferredScale = getPreferredSensorScale(this.
|
|
240
|
+
preferredScale = getPreferredSensorScale(this.host, this.endpoint.nodeId, this.endpoint.index, sensorType, supportedScales);
|
|
239
241
|
}
|
|
240
|
-
const cc = new MultilevelSensorCCGet(
|
|
242
|
+
const cc = new MultilevelSensorCCGet({
|
|
241
243
|
nodeId: this.endpoint.nodeId,
|
|
242
|
-
|
|
243
|
-
sensorType,
|
|
244
|
-
scale: scale ?? preferredScale,
|
|
244
|
+
endpointIndex: this.endpoint.index,
|
|
245
|
+
sensorType: sensorType,
|
|
246
|
+
scale: (scale ?? preferredScale),
|
|
245
247
|
});
|
|
246
|
-
const response = await this.
|
|
248
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
247
249
|
if (!response)
|
|
248
250
|
return;
|
|
249
251
|
const responseScale = (0, core_1.getSensorScale)(response.type, response.scale);
|
|
@@ -269,22 +271,22 @@ let MultilevelSensorCCAPI = class MultilevelSensorCCAPI extends API_1.PhysicalCC
|
|
|
269
271
|
}
|
|
270
272
|
async getSupportedSensorTypes() {
|
|
271
273
|
this.assertSupportsCommand(_Types_1.MultilevelSensorCommand, _Types_1.MultilevelSensorCommand.GetSupportedSensor);
|
|
272
|
-
const cc = new MultilevelSensorCCGetSupportedSensor(
|
|
274
|
+
const cc = new MultilevelSensorCCGetSupportedSensor({
|
|
273
275
|
nodeId: this.endpoint.nodeId,
|
|
274
|
-
|
|
276
|
+
endpointIndex: this.endpoint.index,
|
|
275
277
|
});
|
|
276
|
-
const response = await this.
|
|
278
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
277
279
|
return response?.supportedSensorTypes;
|
|
278
280
|
}
|
|
279
281
|
async getSupportedScales(sensorType) {
|
|
280
282
|
__assertType("sensorType", "number", __assertType__number.bind(void 0, sensorType));
|
|
281
283
|
this.assertSupportsCommand(_Types_1.MultilevelSensorCommand, _Types_1.MultilevelSensorCommand.GetSupportedScale);
|
|
282
|
-
const cc = new MultilevelSensorCCGetSupportedScale(
|
|
284
|
+
const cc = new MultilevelSensorCCGetSupportedScale({
|
|
283
285
|
nodeId: this.endpoint.nodeId,
|
|
284
|
-
|
|
286
|
+
endpointIndex: this.endpoint.index,
|
|
285
287
|
sensorType,
|
|
286
288
|
});
|
|
287
|
-
const response = await this.
|
|
289
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
288
290
|
return response?.supportedScales;
|
|
289
291
|
}
|
|
290
292
|
async sendReport(sensorType, scale, value) {
|
|
@@ -292,14 +294,14 @@ let MultilevelSensorCCAPI = class MultilevelSensorCCAPI extends API_1.PhysicalCC
|
|
|
292
294
|
__assertType("scale", undefined, __assertType__su__number__2_eu.bind(void 0, scale));
|
|
293
295
|
__assertType("value", "number", __assertType__number.bind(void 0, value));
|
|
294
296
|
this.assertSupportsCommand(_Types_1.MultilevelSensorCommand, _Types_1.MultilevelSensorCommand.Report);
|
|
295
|
-
const cc = new MultilevelSensorCCReport(
|
|
297
|
+
const cc = new MultilevelSensorCCReport({
|
|
296
298
|
nodeId: this.endpoint.nodeId,
|
|
297
|
-
|
|
299
|
+
endpointIndex: this.endpoint.index,
|
|
298
300
|
type: sensorType,
|
|
299
301
|
scale,
|
|
300
302
|
value,
|
|
301
303
|
});
|
|
302
|
-
return this.
|
|
304
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
303
305
|
}
|
|
304
306
|
};
|
|
305
307
|
exports.MultilevelSensorCCAPI = MultilevelSensorCCAPI;
|
|
@@ -307,20 +309,20 @@ exports.MultilevelSensorCCAPI = MultilevelSensorCCAPI = __decorate([
|
|
|
307
309
|
(0, CommandClassDecorators_1.API)(safe_1.CommandClasses["Multilevel Sensor"])
|
|
308
310
|
], MultilevelSensorCCAPI);
|
|
309
311
|
let MultilevelSensorCC = class MultilevelSensorCC extends CommandClass_1.CommandClass {
|
|
310
|
-
async interview(
|
|
311
|
-
const node = this.getNode(
|
|
312
|
-
const endpoint = this.getEndpoint(
|
|
313
|
-
const api = API_1.CCAPI.create(safe_1.CommandClasses["Multilevel Sensor"],
|
|
312
|
+
async interview(ctx) {
|
|
313
|
+
const node = this.getNode(ctx);
|
|
314
|
+
const endpoint = this.getEndpoint(ctx);
|
|
315
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses["Multilevel Sensor"], ctx, endpoint).withOptions({
|
|
314
316
|
priority: safe_1.MessagePriority.NodeQuery,
|
|
315
317
|
});
|
|
316
|
-
|
|
318
|
+
ctx.logNode(node.id, {
|
|
317
319
|
endpoint: this.endpointIndex,
|
|
318
320
|
message: `Interviewing ${this.ccName}...`,
|
|
319
321
|
direction: "none",
|
|
320
322
|
});
|
|
321
|
-
if (
|
|
323
|
+
if (api.version >= 5) {
|
|
322
324
|
// Query the supported sensor types
|
|
323
|
-
|
|
325
|
+
ctx.logNode(node.id, {
|
|
324
326
|
endpoint: this.endpointIndex,
|
|
325
327
|
message: "retrieving supported sensor types...",
|
|
326
328
|
direction: "outbound",
|
|
@@ -332,14 +334,14 @@ let MultilevelSensorCC = class MultilevelSensorCC extends CommandClass_1.Command
|
|
|
332
334
|
.map((t) => (0, core_1.getSensorName)(t))
|
|
333
335
|
.map((name) => `· ${name}`)
|
|
334
336
|
.join("\n");
|
|
335
|
-
|
|
337
|
+
ctx.logNode(node.id, {
|
|
336
338
|
endpoint: this.endpointIndex,
|
|
337
339
|
message: logMessage,
|
|
338
340
|
direction: "inbound",
|
|
339
341
|
});
|
|
340
342
|
}
|
|
341
343
|
else {
|
|
342
|
-
|
|
344
|
+
ctx.logNode(node.id, {
|
|
343
345
|
endpoint: this.endpointIndex,
|
|
344
346
|
message: "Querying supported sensor types timed out, skipping interview...",
|
|
345
347
|
level: "warn",
|
|
@@ -348,7 +350,7 @@ let MultilevelSensorCC = class MultilevelSensorCC extends CommandClass_1.Command
|
|
|
348
350
|
}
|
|
349
351
|
// As well as the supported scales for each sensor
|
|
350
352
|
for (const type of sensorTypes) {
|
|
351
|
-
|
|
353
|
+
ctx.logNode(node.id, {
|
|
352
354
|
endpoint: this.endpointIndex,
|
|
353
355
|
message: `querying supported scales for ${(0, core_1.getSensorName)(type)} sensor`,
|
|
354
356
|
direction: "outbound",
|
|
@@ -361,14 +363,14 @@ let MultilevelSensorCC = class MultilevelSensorCC extends CommandClass_1.Command
|
|
|
361
363
|
?? (0, core_1.getUnknownScale)(s)).label)
|
|
362
364
|
.map((name) => `· ${name}`)
|
|
363
365
|
.join("\n");
|
|
364
|
-
|
|
366
|
+
ctx.logNode(node.id, {
|
|
365
367
|
endpoint: this.endpointIndex,
|
|
366
368
|
message: logMessage,
|
|
367
369
|
direction: "inbound",
|
|
368
370
|
});
|
|
369
371
|
}
|
|
370
372
|
else {
|
|
371
|
-
|
|
373
|
+
ctx.logNode(node.id, {
|
|
372
374
|
endpoint: this.endpointIndex,
|
|
373
375
|
message: "Querying supported scales timed out, skipping interview...",
|
|
374
376
|
level: "warn",
|
|
@@ -377,20 +379,20 @@ let MultilevelSensorCC = class MultilevelSensorCC extends CommandClass_1.Command
|
|
|
377
379
|
}
|
|
378
380
|
}
|
|
379
381
|
}
|
|
380
|
-
await this.refreshValues(
|
|
382
|
+
await this.refreshValues(ctx);
|
|
381
383
|
// Remember that the interview is complete
|
|
382
|
-
this.setInterviewComplete(
|
|
384
|
+
this.setInterviewComplete(ctx, true);
|
|
383
385
|
}
|
|
384
|
-
async refreshValues(
|
|
385
|
-
const node = this.getNode(
|
|
386
|
-
const endpoint = this.getEndpoint(
|
|
387
|
-
const api = API_1.CCAPI.create(safe_1.CommandClasses["Multilevel Sensor"],
|
|
386
|
+
async refreshValues(ctx) {
|
|
387
|
+
const node = this.getNode(ctx);
|
|
388
|
+
const endpoint = this.getEndpoint(ctx);
|
|
389
|
+
const api = API_1.CCAPI.create(safe_1.CommandClasses["Multilevel Sensor"], ctx, endpoint).withOptions({
|
|
388
390
|
priority: safe_1.MessagePriority.NodeQuery,
|
|
389
391
|
});
|
|
390
|
-
const valueDB = this.getValueDB(
|
|
391
|
-
if (
|
|
392
|
+
const valueDB = this.getValueDB(ctx);
|
|
393
|
+
if (api.version <= 4) {
|
|
392
394
|
// Sensors up to V4 only support a single value
|
|
393
|
-
|
|
395
|
+
ctx.logNode(node.id, {
|
|
394
396
|
endpoint: this.endpointIndex,
|
|
395
397
|
message: "querying current sensor reading...",
|
|
396
398
|
direction: "outbound",
|
|
@@ -401,7 +403,7 @@ let MultilevelSensorCC = class MultilevelSensorCC extends CommandClass_1.Command
|
|
|
401
403
|
const logMessage = `received current sensor reading:
|
|
402
404
|
sensor type: ${(0, core_1.getSensorName)(mlsResponse.type)}
|
|
403
405
|
value: ${mlsResponse.value}${sensorScale?.unit ? ` ${sensorScale.unit}` : ""}`;
|
|
404
|
-
|
|
406
|
+
ctx.logNode(node.id, {
|
|
405
407
|
endpoint: this.endpointIndex,
|
|
406
408
|
message: logMessage,
|
|
407
409
|
direction: "inbound",
|
|
@@ -416,7 +418,7 @@ value: ${mlsResponse.value}${sensorScale?.unit ? ` ${sensorScale.unit}` :
|
|
|
416
418
|
endpoint: this.endpointIndex,
|
|
417
419
|
}) || [];
|
|
418
420
|
for (const type of sensorTypes) {
|
|
419
|
-
|
|
421
|
+
ctx.logNode(node.id, {
|
|
420
422
|
endpoint: this.endpointIndex,
|
|
421
423
|
message: `querying ${(0, core_1.getSensorName)(type)} sensor reading...`,
|
|
422
424
|
direction: "outbound",
|
|
@@ -424,7 +426,7 @@ value: ${mlsResponse.value}${sensorScale?.unit ? ` ${sensorScale.unit}` :
|
|
|
424
426
|
const value = await api.get(type);
|
|
425
427
|
if (value) {
|
|
426
428
|
const logMessage = `received current ${(0, core_1.getSensorName)(type)} sensor reading: ${value.value} ${value.scale.unit || ""}`;
|
|
427
|
-
|
|
429
|
+
ctx.logNode(node.id, {
|
|
428
430
|
endpoint: this.endpointIndex,
|
|
429
431
|
message: logMessage,
|
|
430
432
|
direction: "inbound",
|
|
@@ -433,14 +435,14 @@ value: ${mlsResponse.value}${sensorScale?.unit ? ` ${sensorScale.unit}` :
|
|
|
433
435
|
}
|
|
434
436
|
}
|
|
435
437
|
}
|
|
436
|
-
shouldRefreshValues(
|
|
438
|
+
shouldRefreshValues(ctx) {
|
|
437
439
|
// Poll the device when all of the supported values were last updated longer than 6 hours ago.
|
|
438
440
|
// This may lead to some values not being updated, but the user may have disabled some unnecessary
|
|
439
441
|
// reports to reduce traffic.
|
|
440
|
-
const valueDB =
|
|
442
|
+
const valueDB = ctx.tryGetValueDB(this.nodeId);
|
|
441
443
|
if (!valueDB)
|
|
442
444
|
return true;
|
|
443
|
-
const values = this.getDefinedValueIDs(
|
|
445
|
+
const values = this.getDefinedValueIDs(ctx).filter((v) => exports.MultilevelSensorCCValues.value.is(v));
|
|
444
446
|
return values.every((v) => {
|
|
445
447
|
const lastUpdated = valueDB.getTimestamp(v);
|
|
446
448
|
return (lastUpdated == undefined
|
|
@@ -451,8 +453,8 @@ value: ${mlsResponse.value}${sensorScale?.unit ? ` ${sensorScale.unit}` :
|
|
|
451
453
|
* Returns which sensor types are supported.
|
|
452
454
|
* This only works AFTER the interview process
|
|
453
455
|
*/
|
|
454
|
-
static getSupportedSensorTypesCached(
|
|
455
|
-
return
|
|
456
|
+
static getSupportedSensorTypesCached(ctx, endpoint) {
|
|
457
|
+
return ctx
|
|
456
458
|
.getValueDB(endpoint.nodeId)
|
|
457
459
|
.getValue(exports.MultilevelSensorCCValues.supportedSensorTypes.endpoint(endpoint.index));
|
|
458
460
|
}
|
|
@@ -460,19 +462,19 @@ value: ${mlsResponse.value}${sensorScale?.unit ? ` ${sensorScale.unit}` :
|
|
|
460
462
|
* Returns which scales are supported for a given sensor type.
|
|
461
463
|
* This only works AFTER the interview process
|
|
462
464
|
*/
|
|
463
|
-
static getSupportedScalesCached(
|
|
464
|
-
return
|
|
465
|
+
static getSupportedScalesCached(ctx, endpoint, sensorType) {
|
|
466
|
+
return ctx
|
|
465
467
|
.getValueDB(endpoint.nodeId)
|
|
466
468
|
.getValue(exports.MultilevelSensorCCValues.supportedScales(sensorType).endpoint(endpoint.index));
|
|
467
469
|
}
|
|
468
|
-
translatePropertyKey(
|
|
470
|
+
translatePropertyKey(ctx, property, propertyKey) {
|
|
469
471
|
// TODO: check this
|
|
470
472
|
if (property === "values" && typeof propertyKey === "number") {
|
|
471
473
|
const sensor = (0, core_1.getSensor)(propertyKey);
|
|
472
474
|
if (sensor)
|
|
473
475
|
return sensor.label;
|
|
474
476
|
}
|
|
475
|
-
return super.translatePropertyKey(
|
|
477
|
+
return super.translatePropertyKey(ctx, property, propertyKey);
|
|
476
478
|
}
|
|
477
479
|
};
|
|
478
480
|
exports.MultilevelSensorCC = MultilevelSensorCC;
|
|
@@ -481,40 +483,43 @@ exports.MultilevelSensorCC = MultilevelSensorCC = __decorate([
|
|
|
481
483
|
(0, CommandClassDecorators_1.implementedVersion)(11),
|
|
482
484
|
(0, CommandClassDecorators_1.ccValues)(exports.MultilevelSensorCCValues)
|
|
483
485
|
], MultilevelSensorCC);
|
|
484
|
-
let MultilevelSensorCCReport = class MultilevelSensorCCReport extends MultilevelSensorCC {
|
|
485
|
-
constructor(
|
|
486
|
-
super(
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
486
|
+
let MultilevelSensorCCReport = MultilevelSensorCCReport_1 = class MultilevelSensorCCReport extends MultilevelSensorCC {
|
|
487
|
+
constructor(options) {
|
|
488
|
+
super(options);
|
|
489
|
+
this.type = options.type;
|
|
490
|
+
this.value = options.value;
|
|
491
|
+
this.scale = typeof options.scale === "number"
|
|
492
|
+
? options.scale
|
|
493
|
+
: options.scale.key;
|
|
494
|
+
}
|
|
495
|
+
static from(raw, ctx) {
|
|
496
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1);
|
|
497
|
+
const type = raw.payload[0];
|
|
498
|
+
// parseFloatWithScale does its own validation
|
|
499
|
+
const { value, scale } = (0, safe_1.parseFloatWithScale)(raw.payload.subarray(1));
|
|
500
|
+
return new MultilevelSensorCCReport_1({
|
|
501
|
+
nodeId: ctx.sourceNodeId,
|
|
502
|
+
type,
|
|
503
|
+
value,
|
|
504
|
+
scale,
|
|
505
|
+
});
|
|
502
506
|
}
|
|
503
|
-
persistValues(
|
|
504
|
-
if (!super.persistValues(
|
|
507
|
+
persistValues(ctx) {
|
|
508
|
+
if (!super.persistValues(ctx))
|
|
505
509
|
return false;
|
|
506
510
|
const sensor = (0, core_1.getSensor)(this.type);
|
|
507
511
|
const scale = (0, core_1.getSensorScale)(this.type, this.scale) ?? (0, core_1.getUnknownScale)(this.scale);
|
|
508
512
|
// Filter out unknown sensor types and scales, unless the strict validation is disabled
|
|
509
|
-
const measurementValidation = !
|
|
513
|
+
const measurementValidation = !ctx.getDeviceConfig?.(this.nodeId)?.compat?.disableStrictMeasurementValidation;
|
|
514
|
+
const ccVersion = (0, CommandClass_1.getEffectiveCCVersion)(ctx, this);
|
|
510
515
|
if (measurementValidation) {
|
|
511
516
|
// Filter out unsupported sensor types and scales if possible
|
|
512
|
-
if (
|
|
513
|
-
const supportedSensorTypes = this.getValue(
|
|
517
|
+
if (ccVersion >= 5) {
|
|
518
|
+
const supportedSensorTypes = this.getValue(ctx, exports.MultilevelSensorCCValues.supportedSensorTypes);
|
|
514
519
|
if (supportedSensorTypes?.length) {
|
|
515
520
|
safe_1.validatePayload.withReason(`Unsupported sensor type ${(0, core_1.getSensorName)(this.type)} or corrupted data`)(supportedSensorTypes.includes(this.type));
|
|
516
521
|
}
|
|
517
|
-
const supportedScales = this.getValue(
|
|
522
|
+
const supportedScales = this.getValue(ctx, exports.MultilevelSensorCCValues.supportedScales(this.type));
|
|
518
523
|
if (supportedScales?.length) {
|
|
519
524
|
safe_1.validatePayload.withReason(`Unsupported scale ${scale.label} or corrupted data`)(supportedScales.includes(scale.key));
|
|
520
525
|
}
|
|
@@ -528,7 +533,7 @@ let MultilevelSensorCCReport = class MultilevelSensorCCReport extends Multilevel
|
|
|
528
533
|
}
|
|
529
534
|
const sensorName = (0, core_1.getSensorName)(this.type);
|
|
530
535
|
const sensorValue = exports.MultilevelSensorCCValues.value(sensorName);
|
|
531
|
-
this.setMetadata(
|
|
536
|
+
this.setMetadata(ctx, sensorValue, {
|
|
532
537
|
...sensorValue.meta,
|
|
533
538
|
unit: scale.unit,
|
|
534
539
|
ccSpecific: {
|
|
@@ -536,22 +541,22 @@ let MultilevelSensorCCReport = class MultilevelSensorCCReport extends Multilevel
|
|
|
536
541
|
scale: scale.key,
|
|
537
542
|
},
|
|
538
543
|
});
|
|
539
|
-
this.setValue(
|
|
544
|
+
this.setValue(ctx, sensorValue, this.value);
|
|
540
545
|
return true;
|
|
541
546
|
}
|
|
542
547
|
type;
|
|
543
548
|
scale;
|
|
544
549
|
value;
|
|
545
|
-
serialize() {
|
|
550
|
+
serialize(ctx) {
|
|
546
551
|
this.payload = Buffer.concat([
|
|
547
552
|
Buffer.from([this.type]),
|
|
548
553
|
(0, safe_1.encodeFloatWithScale)(this.value, this.scale),
|
|
549
554
|
]);
|
|
550
|
-
return super.serialize();
|
|
555
|
+
return super.serialize(ctx);
|
|
551
556
|
}
|
|
552
|
-
toLogEntry(
|
|
557
|
+
toLogEntry(ctx) {
|
|
553
558
|
return {
|
|
554
|
-
...super.toLogEntry(
|
|
559
|
+
...super.toLogEntry(ctx),
|
|
555
560
|
message: {
|
|
556
561
|
"sensor type": (0, core_1.getSensorName)(this.type),
|
|
557
562
|
scale: ((0, core_1.getSensorScale)(this.type, this.scale)
|
|
@@ -562,7 +567,7 @@ let MultilevelSensorCCReport = class MultilevelSensorCCReport extends Multilevel
|
|
|
562
567
|
}
|
|
563
568
|
};
|
|
564
569
|
exports.MultilevelSensorCCReport = MultilevelSensorCCReport;
|
|
565
|
-
exports.MultilevelSensorCCReport = MultilevelSensorCCReport = __decorate([
|
|
570
|
+
exports.MultilevelSensorCCReport = MultilevelSensorCCReport = MultilevelSensorCCReport_1 = __decorate([
|
|
566
571
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.MultilevelSensorCommand.Report),
|
|
567
572
|
(0, CommandClassDecorators_1.useSupervision)()
|
|
568
573
|
], MultilevelSensorCCReport);
|
|
@@ -570,25 +575,33 @@ const testResponseForMultilevelSensorGet = (sent, received) => {
|
|
|
570
575
|
// We expect a Multilevel Sensor Report that matches the requested sensor type (if a type was requested)
|
|
571
576
|
return sent.sensorType == undefined || received.type === sent.sensorType;
|
|
572
577
|
};
|
|
573
|
-
let MultilevelSensorCCGet = class MultilevelSensorCCGet extends MultilevelSensorCC {
|
|
574
|
-
constructor(
|
|
575
|
-
super(
|
|
576
|
-
if (
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
578
|
+
let MultilevelSensorCCGet = MultilevelSensorCCGet_1 = class MultilevelSensorCCGet extends MultilevelSensorCC {
|
|
579
|
+
constructor(options) {
|
|
580
|
+
super(options);
|
|
581
|
+
if ("sensorType" in options) {
|
|
582
|
+
this.sensorType = options.sensorType;
|
|
583
|
+
this.scale = options.scale;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
static from(raw, ctx) {
|
|
587
|
+
if (raw.payload.length >= 2) {
|
|
588
|
+
const sensorType = raw.payload[0];
|
|
589
|
+
const scale = (raw.payload[1] >> 3) & 0b11;
|
|
590
|
+
return new MultilevelSensorCCGet_1({
|
|
591
|
+
nodeId: ctx.sourceNodeId,
|
|
592
|
+
sensorType,
|
|
593
|
+
scale,
|
|
594
|
+
});
|
|
581
595
|
}
|
|
582
596
|
else {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
597
|
+
return new MultilevelSensorCCGet_1({
|
|
598
|
+
nodeId: ctx.sourceNodeId,
|
|
599
|
+
});
|
|
587
600
|
}
|
|
588
601
|
}
|
|
589
602
|
sensorType;
|
|
590
603
|
scale;
|
|
591
|
-
serialize() {
|
|
604
|
+
serialize(ctx) {
|
|
592
605
|
if (this.sensorType != undefined
|
|
593
606
|
&& this.scale != undefined) {
|
|
594
607
|
this.payload = Buffer.from([
|
|
@@ -596,9 +609,9 @@ let MultilevelSensorCCGet = class MultilevelSensorCCGet extends MultilevelSensor
|
|
|
596
609
|
(this.scale & 0b11) << 3,
|
|
597
610
|
]);
|
|
598
611
|
}
|
|
599
|
-
return super.serialize();
|
|
612
|
+
return super.serialize(ctx);
|
|
600
613
|
}
|
|
601
|
-
toLogEntry(
|
|
614
|
+
toLogEntry(ctx) {
|
|
602
615
|
let message = {};
|
|
603
616
|
if (this.sensorType != undefined
|
|
604
617
|
&& this.scale != undefined) {
|
|
@@ -608,36 +621,38 @@ let MultilevelSensorCCGet = class MultilevelSensorCCGet extends MultilevelSensor
|
|
|
608
621
|
};
|
|
609
622
|
}
|
|
610
623
|
return {
|
|
611
|
-
...super.toLogEntry(
|
|
624
|
+
...super.toLogEntry(ctx),
|
|
612
625
|
message,
|
|
613
626
|
};
|
|
614
627
|
}
|
|
615
628
|
};
|
|
616
629
|
exports.MultilevelSensorCCGet = MultilevelSensorCCGet;
|
|
617
|
-
exports.MultilevelSensorCCGet = MultilevelSensorCCGet = __decorate([
|
|
630
|
+
exports.MultilevelSensorCCGet = MultilevelSensorCCGet = MultilevelSensorCCGet_1 = __decorate([
|
|
618
631
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.MultilevelSensorCommand.Get),
|
|
619
632
|
(0, CommandClassDecorators_1.expectedCCResponse)(MultilevelSensorCCReport, testResponseForMultilevelSensorGet)
|
|
620
633
|
], MultilevelSensorCCGet);
|
|
621
|
-
let MultilevelSensorCCSupportedSensorReport = class MultilevelSensorCCSupportedSensorReport extends MultilevelSensorCC {
|
|
622
|
-
constructor(
|
|
623
|
-
super(
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
634
|
+
let MultilevelSensorCCSupportedSensorReport = MultilevelSensorCCSupportedSensorReport_1 = class MultilevelSensorCCSupportedSensorReport extends MultilevelSensorCC {
|
|
635
|
+
constructor(options) {
|
|
636
|
+
super(options);
|
|
637
|
+
this.supportedSensorTypes = options.supportedSensorTypes;
|
|
638
|
+
}
|
|
639
|
+
static from(raw, ctx) {
|
|
640
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1);
|
|
641
|
+
const supportedSensorTypes = (0, safe_1.parseBitMask)(raw.payload);
|
|
642
|
+
return new MultilevelSensorCCSupportedSensorReport_1({
|
|
643
|
+
nodeId: ctx.sourceNodeId,
|
|
644
|
+
supportedSensorTypes,
|
|
645
|
+
});
|
|
631
646
|
}
|
|
632
647
|
// TODO: Use this during interview to precreate values
|
|
633
648
|
supportedSensorTypes;
|
|
634
|
-
serialize() {
|
|
649
|
+
serialize(ctx) {
|
|
635
650
|
this.payload = (0, core_1.encodeBitMask)(this.supportedSensorTypes);
|
|
636
|
-
return super.serialize();
|
|
651
|
+
return super.serialize(ctx);
|
|
637
652
|
}
|
|
638
|
-
toLogEntry(
|
|
653
|
+
toLogEntry(ctx) {
|
|
639
654
|
return {
|
|
640
|
-
...super.toLogEntry(
|
|
655
|
+
...super.toLogEntry(ctx),
|
|
641
656
|
message: {
|
|
642
657
|
"supported sensor types": this.supportedSensorTypes
|
|
643
658
|
.map((t) => `\n· ${(0, core_1.getSensorName)(t)}`)
|
|
@@ -650,7 +665,7 @@ exports.MultilevelSensorCCSupportedSensorReport = MultilevelSensorCCSupportedSen
|
|
|
650
665
|
__decorate([
|
|
651
666
|
(0, CommandClassDecorators_1.ccValue)(exports.MultilevelSensorCCValues.supportedSensorTypes)
|
|
652
667
|
], MultilevelSensorCCSupportedSensorReport.prototype, "supportedSensorTypes", void 0);
|
|
653
|
-
exports.MultilevelSensorCCSupportedSensorReport = MultilevelSensorCCSupportedSensorReport = __decorate([
|
|
668
|
+
exports.MultilevelSensorCCSupportedSensorReport = MultilevelSensorCCSupportedSensorReport = MultilevelSensorCCSupportedSensorReport_1 = __decorate([
|
|
654
669
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.MultilevelSensorCommand.SupportedSensorReport)
|
|
655
670
|
], MultilevelSensorCCSupportedSensorReport);
|
|
656
671
|
let MultilevelSensorCCGetSupportedSensor = class MultilevelSensorCCGetSupportedSensor extends MultilevelSensorCC {
|
|
@@ -660,31 +675,34 @@ exports.MultilevelSensorCCGetSupportedSensor = MultilevelSensorCCGetSupportedSen
|
|
|
660
675
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.MultilevelSensorCommand.GetSupportedSensor),
|
|
661
676
|
(0, CommandClassDecorators_1.expectedCCResponse)(MultilevelSensorCCSupportedSensorReport)
|
|
662
677
|
], MultilevelSensorCCGetSupportedSensor);
|
|
663
|
-
let MultilevelSensorCCSupportedScaleReport = class MultilevelSensorCCSupportedScaleReport extends MultilevelSensorCC {
|
|
664
|
-
constructor(
|
|
665
|
-
super(
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
678
|
+
let MultilevelSensorCCSupportedScaleReport = MultilevelSensorCCSupportedScaleReport_1 = class MultilevelSensorCCSupportedScaleReport extends MultilevelSensorCC {
|
|
679
|
+
constructor(options) {
|
|
680
|
+
super(options);
|
|
681
|
+
this.sensorType = options.sensorType;
|
|
682
|
+
this.supportedScales = options.supportedScales;
|
|
683
|
+
}
|
|
684
|
+
static from(raw, ctx) {
|
|
685
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 2);
|
|
686
|
+
const sensorType = raw.payload[0];
|
|
687
|
+
const supportedScales = (0, safe_1.parseBitMask)(Buffer.from([raw.payload[1] & 0b1111]), 0);
|
|
688
|
+
return new MultilevelSensorCCSupportedScaleReport_1({
|
|
689
|
+
nodeId: ctx.sourceNodeId,
|
|
690
|
+
sensorType,
|
|
691
|
+
supportedScales,
|
|
692
|
+
});
|
|
675
693
|
}
|
|
676
694
|
sensorType;
|
|
677
695
|
supportedScales;
|
|
678
|
-
serialize() {
|
|
696
|
+
serialize(ctx) {
|
|
679
697
|
this.payload = Buffer.concat([
|
|
680
698
|
Buffer.from([this.sensorType]),
|
|
681
699
|
(0, core_1.encodeBitMask)(this.supportedScales, 4, 0),
|
|
682
700
|
]);
|
|
683
|
-
return super.serialize();
|
|
701
|
+
return super.serialize(ctx);
|
|
684
702
|
}
|
|
685
|
-
toLogEntry(
|
|
703
|
+
toLogEntry(ctx) {
|
|
686
704
|
return {
|
|
687
|
-
...super.toLogEntry(
|
|
705
|
+
...super.toLogEntry(ctx),
|
|
688
706
|
message: {
|
|
689
707
|
"sensor type": (0, core_1.getSensorName)(this.sensorType),
|
|
690
708
|
"supported scales": this.supportedScales
|
|
@@ -699,28 +717,30 @@ exports.MultilevelSensorCCSupportedScaleReport = MultilevelSensorCCSupportedScal
|
|
|
699
717
|
__decorate([
|
|
700
718
|
(0, CommandClassDecorators_1.ccValue)(exports.MultilevelSensorCCValues.supportedScales, (self) => [self.sensorType])
|
|
701
719
|
], MultilevelSensorCCSupportedScaleReport.prototype, "supportedScales", void 0);
|
|
702
|
-
exports.MultilevelSensorCCSupportedScaleReport = MultilevelSensorCCSupportedScaleReport = __decorate([
|
|
720
|
+
exports.MultilevelSensorCCSupportedScaleReport = MultilevelSensorCCSupportedScaleReport = MultilevelSensorCCSupportedScaleReport_1 = __decorate([
|
|
703
721
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.MultilevelSensorCommand.SupportedScaleReport)
|
|
704
722
|
], MultilevelSensorCCSupportedScaleReport);
|
|
705
|
-
let MultilevelSensorCCGetSupportedScale = class MultilevelSensorCCGetSupportedScale extends MultilevelSensorCC {
|
|
706
|
-
constructor(
|
|
707
|
-
super(
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
723
|
+
let MultilevelSensorCCGetSupportedScale = MultilevelSensorCCGetSupportedScale_1 = class MultilevelSensorCCGetSupportedScale extends MultilevelSensorCC {
|
|
724
|
+
constructor(options) {
|
|
725
|
+
super(options);
|
|
726
|
+
this.sensorType = options.sensorType;
|
|
727
|
+
}
|
|
728
|
+
static from(raw, ctx) {
|
|
729
|
+
(0, safe_1.validatePayload)(raw.payload.length >= 1);
|
|
730
|
+
const sensorType = raw.payload[0];
|
|
731
|
+
return new MultilevelSensorCCGetSupportedScale_1({
|
|
732
|
+
nodeId: ctx.sourceNodeId,
|
|
733
|
+
sensorType,
|
|
734
|
+
});
|
|
715
735
|
}
|
|
716
736
|
sensorType;
|
|
717
|
-
serialize() {
|
|
737
|
+
serialize(ctx) {
|
|
718
738
|
this.payload = Buffer.from([this.sensorType]);
|
|
719
|
-
return super.serialize();
|
|
739
|
+
return super.serialize(ctx);
|
|
720
740
|
}
|
|
721
|
-
toLogEntry(
|
|
741
|
+
toLogEntry(ctx) {
|
|
722
742
|
return {
|
|
723
|
-
...super.toLogEntry(
|
|
743
|
+
...super.toLogEntry(ctx),
|
|
724
744
|
message: {
|
|
725
745
|
"sensor type": (0, core_1.getSensorName)(this.sensorType),
|
|
726
746
|
},
|
|
@@ -728,7 +748,7 @@ let MultilevelSensorCCGetSupportedScale = class MultilevelSensorCCGetSupportedSc
|
|
|
728
748
|
}
|
|
729
749
|
};
|
|
730
750
|
exports.MultilevelSensorCCGetSupportedScale = MultilevelSensorCCGetSupportedScale;
|
|
731
|
-
exports.MultilevelSensorCCGetSupportedScale = MultilevelSensorCCGetSupportedScale = __decorate([
|
|
751
|
+
exports.MultilevelSensorCCGetSupportedScale = MultilevelSensorCCGetSupportedScale = MultilevelSensorCCGetSupportedScale_1 = __decorate([
|
|
732
752
|
(0, CommandClassDecorators_1.CCCommand)(_Types_1.MultilevelSensorCommand.GetSupportedScale),
|
|
733
753
|
(0, CommandClassDecorators_1.expectedCCResponse)(MultilevelSensorCCSupportedScaleReport)
|
|
734
754
|
], MultilevelSensorCCGetSupportedScale);
|