@zwave-js/cc 14.0.0-beta.4 → 14.0.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/cjs/cc/AlarmSensorCC.js +381 -266
- package/build/cjs/cc/AlarmSensorCC.js.map +3 -3
- package/build/cjs/cc/AssociationCC.js +669 -503
- package/build/cjs/cc/AssociationCC.js.map +3 -3
- package/build/cjs/cc/AssociationGroupInfoCC.js +633 -492
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +3 -3
- package/build/cjs/cc/BarrierOperatorCC.js +595 -429
- package/build/cjs/cc/BarrierOperatorCC.js.map +3 -3
- package/build/cjs/cc/BasicCC.js +354 -260
- package/build/cjs/cc/BasicCC.js.map +3 -3
- package/build/cjs/cc/BatteryCC.js +427 -345
- package/build/cjs/cc/BatteryCC.js.map +3 -3
- package/build/cjs/cc/BinarySensorCC.js +391 -276
- package/build/cjs/cc/BinarySensorCC.js.map +3 -3
- package/build/cjs/cc/BinarySwitchCC.js +347 -253
- package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
- package/build/cjs/cc/CRC16CC.js +160 -85
- package/build/cjs/cc/CRC16CC.js.map +3 -3
- package/build/cjs/cc/CentralSceneCC.js +459 -324
- package/build/cjs/cc/CentralSceneCC.js.map +3 -3
- package/build/cjs/cc/ClimateControlScheduleCC.js +459 -293
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +3 -3
- package/build/cjs/cc/ClockCC.js +254 -150
- package/build/cjs/cc/ClockCC.js.map +3 -3
- package/build/cjs/cc/ColorSwitchCC.js +758 -610
- package/build/cjs/cc/ColorSwitchCC.js.map +3 -3
- package/build/cjs/cc/ConfigurationCC.js +1700 -1453
- package/build/cjs/cc/ConfigurationCC.js.map +3 -3
- package/build/cjs/cc/DeviceResetLocallyCC.js +125 -49
- package/build/cjs/cc/DeviceResetLocallyCC.js.map +3 -3
- package/build/cjs/cc/DoorLockCC.js +904 -777
- package/build/cjs/cc/DoorLockCC.js.map +3 -3
- package/build/cjs/cc/DoorLockLoggingCC.js +321 -206
- package/build/cjs/cc/DoorLockLoggingCC.js.map +3 -3
- package/build/cjs/cc/EnergyProductionCC.js +249 -160
- package/build/cjs/cc/EnergyProductionCC.js.map +3 -3
- package/build/cjs/cc/EntryControlCC.js +619 -458
- package/build/cjs/cc/EntryControlCC.js.map +3 -3
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +898 -698
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +3 -3
- package/build/cjs/cc/HailCC.js +57 -11
- package/build/cjs/cc/HailCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlModeCC.js +359 -233
- package/build/cjs/cc/HumidityControlModeCC.js.map +3 -3
- package/build/cjs/cc/HumidityControlOperatingStateCC.js +189 -103
- package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +3 -3
- package/build/cjs/cc/HumidityControlSetpointCC.js +682 -495
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +3 -3
- package/build/cjs/cc/InclusionControllerCC.js +205 -114
- package/build/cjs/cc/InclusionControllerCC.js.map +3 -3
- package/build/cjs/cc/IndicatorCC.js +897 -736
- package/build/cjs/cc/IndicatorCC.js.map +3 -3
- package/build/cjs/cc/IrrigationCC.js +1651 -1405
- package/build/cjs/cc/IrrigationCC.js.map +3 -3
- package/build/cjs/cc/LanguageCC.js +268 -171
- package/build/cjs/cc/LanguageCC.js.map +3 -3
- package/build/cjs/cc/LockCC.js +254 -154
- package/build/cjs/cc/LockCC.js.map +3 -3
- package/build/cjs/cc/ManufacturerProprietaryCC.js +189 -129
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.js +319 -213
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +3 -3
- package/build/cjs/cc/MeterCC.js +827 -707
- package/build/cjs/cc/MeterCC.js.map +3 -3
- package/build/cjs/cc/MultiChannelAssociationCC.js +612 -478
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +3 -3
- package/build/cjs/cc/MultiChannelCC.js +1037 -819
- package/build/cjs/cc/MultiChannelCC.js.map +3 -3
- package/build/cjs/cc/MultiCommandCC.js +172 -97
- package/build/cjs/cc/MultiCommandCC.js.map +3 -3
- package/build/cjs/cc/MultilevelSensorCC.js +589 -449
- package/build/cjs/cc/MultilevelSensorCC.js.map +3 -3
- package/build/cjs/cc/MultilevelSwitchCC.js +587 -439
- package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
- package/build/cjs/cc/NoOperationCC.js +89 -27
- package/build/cjs/cc/NoOperationCC.js.map +2 -2
- package/build/cjs/cc/NodeNamingCC.js +417 -277
- package/build/cjs/cc/NodeNamingCC.js.map +3 -3
- package/build/cjs/cc/NotificationCC.js +972 -818
- package/build/cjs/cc/NotificationCC.js.map +3 -3
- package/build/cjs/cc/PowerlevelCC.js +450 -303
- package/build/cjs/cc/PowerlevelCC.js.map +3 -3
- package/build/cjs/cc/ProtectionCC.js +686 -494
- package/build/cjs/cc/ProtectionCC.js.map +3 -3
- package/build/cjs/cc/SceneActivationCC.js +165 -97
- package/build/cjs/cc/SceneActivationCC.js.map +3 -3
- package/build/cjs/cc/SceneActuatorConfigurationCC.js +346 -243
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +3 -3
- package/build/cjs/cc/SceneControllerConfigurationCC.js +401 -298
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +3 -3
- package/build/cjs/cc/ScheduleEntryLockCC.js +1552 -1272
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +3 -3
- package/build/cjs/cc/Security2CC.js +1483 -1219
- package/build/cjs/cc/Security2CC.js.map +3 -3
- package/build/cjs/cc/SecurityCC.js +839 -619
- package/build/cjs/cc/SecurityCC.js.map +3 -3
- package/build/cjs/cc/SoundSwitchCC.js +707 -515
- package/build/cjs/cc/SoundSwitchCC.js.map +3 -3
- package/build/cjs/cc/SupervisionCC.js +327 -237
- package/build/cjs/cc/SupervisionCC.js.map +3 -3
- package/build/cjs/cc/ThermostatFanModeCC.js +386 -263
- package/build/cjs/cc/ThermostatFanModeCC.js.map +3 -3
- package/build/cjs/cc/ThermostatFanStateCC.js +192 -106
- package/build/cjs/cc/ThermostatFanStateCC.js.map +3 -3
- package/build/cjs/cc/ThermostatModeCC.js +425 -302
- package/build/cjs/cc/ThermostatModeCC.js.map +3 -3
- package/build/cjs/cc/ThermostatOperatingStateCC.js +188 -102
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +3 -3
- package/build/cjs/cc/ThermostatSetbackCC.js +277 -173
- package/build/cjs/cc/ThermostatSetbackCC.js.map +3 -3
- package/build/cjs/cc/ThermostatSetpointCC.js +645 -491
- package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
- package/build/cjs/cc/TimeCC.js +515 -353
- package/build/cjs/cc/TimeCC.js.map +3 -3
- package/build/cjs/cc/TimeParametersCC.js +302 -202
- package/build/cjs/cc/TimeParametersCC.js.map +3 -3
- package/build/cjs/cc/TransportServiceCC.js +433 -315
- package/build/cjs/cc/TransportServiceCC.js.map +3 -3
- package/build/cjs/cc/UserCodeCC.js +1385 -1102
- package/build/cjs/cc/UserCodeCC.js.map +3 -3
- package/build/cjs/cc/VersionCC.js +696 -562
- package/build/cjs/cc/VersionCC.js.map +3 -3
- package/build/cjs/cc/WakeUpCC.js +499 -346
- package/build/cjs/cc/WakeUpCC.js.map +3 -3
- package/build/cjs/cc/WindowCoveringCC.js +626 -478
- package/build/cjs/cc/WindowCoveringCC.js.map +3 -3
- package/build/cjs/cc/ZWaveLongRangeCC.js +57 -10
- package/build/cjs/cc/ZWaveLongRangeCC.js.map +2 -2
- package/build/cjs/cc/ZWavePlusCC.js +233 -159
- package/build/cjs/cc/ZWavePlusCC.js.map +3 -3
- package/build/cjs/cc/ZWaveProtocolCC.js +1515 -948
- package/build/cjs/cc/ZWaveProtocolCC.js.map +3 -3
- package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +4 -4
- package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +1 -1
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +395 -274
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +3 -3
- package/build/cjs/lib/CommandClassDecorators.d.ts +11 -15
- package/build/cjs/lib/CommandClassDecorators.js +19 -20
- package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
- package/build/cjs/lib/Security2/Extension.d.ts +1 -1
- package/build/cjs/lib/Security2/Extension.js +217 -126
- package/build/cjs/lib/Security2/Extension.js.map +3 -3
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +389 -291
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/AssociationCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC.js +678 -537
- package/build/esm/cc/AssociationCC.js.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +659 -539
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +634 -493
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.d.ts.map +1 -1
- package/build/esm/cc/BasicCC.js +380 -302
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +449 -384
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySensorCC.js +395 -297
- package/build/esm/cc/BinarySensorCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +353 -274
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CRC16CC.js +162 -98
- package/build/esm/cc/CRC16CC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +465 -351
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +454 -313
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.js +248 -159
- package/build/esm/cc/ClockCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +802 -677
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +1899 -1687
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.js +124 -59
- package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC.js +951 -849
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.js +316 -218
- package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/esm/cc/EnergyProductionCC.js +240 -164
- package/build/esm/cc/EnergyProductionCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +629 -493
- package/build/esm/cc/EntryControlCC.js.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js +938 -769
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/esm/cc/HailCC.js +51 -12
- package/build/esm/cc/HailCC.js.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.js +357 -250
- package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.js +182 -109
- package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +706 -546
- package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/esm/cc/InclusionControllerCC.js +197 -119
- package/build/esm/cc/InclusionControllerCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.js +973 -835
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +1697 -1496
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC.js +266 -184
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/LockCC.d.ts.map +1 -1
- package/build/esm/cc/LockCC.js +247 -162
- package/build/esm/cc/LockCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js +192 -141
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +312 -223
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +896 -795
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.js +631 -518
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +1106 -921
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultiCommandCC.js +166 -102
- package/build/esm/cc/MultiCommandCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +616 -497
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +621 -496
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NoOperationCC.js +82 -29
- package/build/esm/cc/NoOperationCC.js.map +1 -1
- package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC.js +413 -294
- package/build/esm/cc/NodeNamingCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +1097 -966
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/PowerlevelCC.js +437 -311
- package/build/esm/cc/PowerlevelCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +704 -543
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActivationCC.js +157 -100
- package/build/esm/cc/SceneActivationCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +357 -269
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +434 -346
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js +1596 -1357
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.js +1633 -1406
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.js +876 -687
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +689 -526
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.js +349 -272
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +388 -284
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js +184 -111
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +435 -331
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.js +180 -107
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js +274 -185
- package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +674 -543
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TimeCC.js +499 -360
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
- package/build/esm/cc/TimeParametersCC.js +296 -211
- package/build/esm/cc/TimeParametersCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +464 -363
- package/build/esm/cc/TransportServiceCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +1443 -1205
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +744 -635
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
- package/build/esm/cc/WakeUpCC.js +494 -364
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +655 -530
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWaveLongRangeCC.js +51 -11
- package/build/esm/cc/ZWaveLongRangeCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +223 -162
- package/build/esm/cc/ZWavePlusCC.js.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js +1443 -953
- package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +4 -4
- package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +390 -286
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/lib/CommandClassDecorators.d.ts +11 -15
- package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
- package/build/esm/lib/CommandClassDecorators.js +24 -24
- package/build/esm/lib/CommandClassDecorators.js.map +1 -1
- package/build/esm/lib/Security2/Extension.d.ts +1 -1
- package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
- package/build/esm/lib/Security2/Extension.js +207 -123
- package/build/esm/lib/Security2/Extension.js.map +1 -1
- package/package.json +6 -6
package/build/cjs/cc/MeterCC.js
CHANGED
|
@@ -38,13 +38,45 @@ var import_CommandClass = require("../lib/CommandClass.js");
|
|
|
38
38
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|
|
39
39
|
var import_Values = require("../lib/Values.js");
|
|
40
40
|
var import_Types = require("../lib/_Types.js");
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
42
|
+
function accept(f) {
|
|
43
|
+
if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
|
|
44
|
+
return f;
|
|
45
|
+
}
|
|
46
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
47
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
48
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
49
|
+
var _, done = false;
|
|
50
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
51
|
+
var context = {};
|
|
52
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
53
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
54
|
+
context.addInitializer = function(f) {
|
|
55
|
+
if (done) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
56
|
+
extraInitializers.push(accept(f || null));
|
|
57
|
+
};
|
|
58
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
59
|
+
if (kind === "accessor") {
|
|
60
|
+
if (result === void 0) continue;
|
|
61
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
62
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
63
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
64
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
65
|
+
} else if (_ = accept(result)) {
|
|
66
|
+
if (kind === "field") initializers.unshift(_);
|
|
67
|
+
else descriptor[key] = _;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
71
|
+
done = true;
|
|
72
|
+
};
|
|
73
|
+
var __runInitializers = function(thisArg, initializers, value) {
|
|
74
|
+
var useValue = arguments.length > 2;
|
|
75
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
76
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
77
|
+
}
|
|
78
|
+
return useValue ? value : void 0;
|
|
46
79
|
};
|
|
47
|
-
var MeterCCReport_1, MeterCCGet_1, MeterCCSupportedReport_1, MeterCCReset_1;
|
|
48
80
|
function __assertType(argName, typeName, boundHasError) {
|
|
49
81
|
const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
|
|
50
82
|
if (boundHasError()) {
|
|
@@ -449,777 +481,865 @@ function isAccumulatedValue(meterType, scale) {
|
|
|
449
481
|
}
|
|
450
482
|
return false;
|
|
451
483
|
}
|
|
452
|
-
let MeterCCAPI =
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
return this.version >= 2;
|
|
462
|
-
case import_Types.MeterCommand.Reset: {
|
|
463
|
-
const ret = this.tryGetValueDB()?.getValue({
|
|
464
|
-
commandClass: (0, import_CommandClassDecorators.getCommandClass)(this),
|
|
465
|
-
endpoint: this.endpoint.index,
|
|
466
|
-
property: "supportsReset"
|
|
467
|
-
});
|
|
468
|
-
return ret === true;
|
|
469
|
-
}
|
|
484
|
+
let MeterCCAPI = (() => {
|
|
485
|
+
let _classDecorators = [(0, import_CommandClassDecorators.API)(import_safe.CommandClasses.Meter)];
|
|
486
|
+
let _classDescriptor;
|
|
487
|
+
let _classExtraInitializers = [];
|
|
488
|
+
let _classThis;
|
|
489
|
+
let _classSuper = import_API.PhysicalCCAPI;
|
|
490
|
+
var MeterCCAPI2 = class extends _classSuper {
|
|
491
|
+
static {
|
|
492
|
+
_classThis = this;
|
|
470
493
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
494
|
+
static {
|
|
495
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
496
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
497
|
+
MeterCCAPI2 = _classThis = _classDescriptor.value;
|
|
498
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
499
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
500
|
+
}
|
|
501
|
+
supportsCommand(cmd) {
|
|
502
|
+
switch (cmd) {
|
|
503
|
+
case import_Types.MeterCommand.Get:
|
|
504
|
+
case import_Types.MeterCommand.Report:
|
|
505
|
+
return true;
|
|
506
|
+
// This is mandatory
|
|
507
|
+
case import_Types.MeterCommand.SupportedGet:
|
|
508
|
+
case import_Types.MeterCommand.SupportedReport:
|
|
509
|
+
return this.version >= 2;
|
|
510
|
+
case import_Types.MeterCommand.Reset: {
|
|
511
|
+
const ret = this.tryGetValueDB()?.getValue({
|
|
512
|
+
commandClass: (0, import_CommandClassDecorators.getCommandClass)(this),
|
|
513
|
+
endpoint: this.endpoint.index,
|
|
514
|
+
property: "supportsReset"
|
|
515
|
+
});
|
|
516
|
+
return ret === true;
|
|
489
517
|
}
|
|
490
|
-
default:
|
|
491
|
-
(0, import_API.throwUnsupportedProperty)(this.ccId, property);
|
|
492
518
|
}
|
|
493
|
-
|
|
494
|
-
}
|
|
495
|
-
async get(options) {
|
|
496
|
-
__assertType("options", "(optional) MeterCCGetOptions", __assertType__optional_MeterCCGetOptions.bind(void 0, options));
|
|
497
|
-
this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.Get);
|
|
498
|
-
const cc = new MeterCCGet({
|
|
499
|
-
nodeId: this.endpoint.nodeId,
|
|
500
|
-
endpointIndex: this.endpoint.index,
|
|
501
|
-
...options
|
|
502
|
-
});
|
|
503
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
504
|
-
if (response) {
|
|
505
|
-
return {
|
|
506
|
-
type: response.type,
|
|
507
|
-
scale: (0, import_core.getMeterScale)(response.type, response.scale) ?? (0, import_core.getUnknownMeterScale)(response.scale),
|
|
508
|
-
...(0, import_safe3.pick)(response, [
|
|
509
|
-
"value",
|
|
510
|
-
"previousValue",
|
|
511
|
-
"rateType",
|
|
512
|
-
"deltaTime"
|
|
513
|
-
])
|
|
514
|
-
};
|
|
519
|
+
return super.supportsCommand(cmd);
|
|
515
520
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
const supportedScales = valueDB?.getValue(MeterCCValues.supportedScales.endpoint(this.endpoint.index)) ?? [];
|
|
533
|
-
const supportedRateTypes = valueDB?.getValue(MeterCCValues.supportedRateTypes.endpoint(this.endpoint.index)) ?? [];
|
|
534
|
-
const rateTypes = supportedRateTypes.length ? supportedRateTypes : [void 0];
|
|
535
|
-
const ret = [];
|
|
536
|
-
for (const rateType of rateTypes) {
|
|
537
|
-
for (const scale of supportedScales) {
|
|
538
|
-
if (accumulatedOnly && meterType != void 0 && !isAccumulatedValue(meterType, scale)) {
|
|
539
|
-
continue;
|
|
521
|
+
get [import_API.POLL_VALUE]() {
|
|
522
|
+
return async function({ property, propertyKey }) {
|
|
523
|
+
switch (property) {
|
|
524
|
+
case "value":
|
|
525
|
+
case "previousValue":
|
|
526
|
+
case "deltaTime": {
|
|
527
|
+
if (propertyKey == void 0) {
|
|
528
|
+
(0, import_API.throwMissingPropertyKey)(this.ccId, property);
|
|
529
|
+
} else if (typeof propertyKey !== "number") {
|
|
530
|
+
(0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
|
|
531
|
+
}
|
|
532
|
+
const { rateType, scale } = splitPropertyKey(propertyKey);
|
|
533
|
+
return (await this.get({
|
|
534
|
+
rateType,
|
|
535
|
+
scale
|
|
536
|
+
}))?.[property];
|
|
540
537
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
rateType
|
|
544
|
-
});
|
|
545
|
-
if (response)
|
|
546
|
-
ret.push(response);
|
|
538
|
+
default:
|
|
539
|
+
(0, import_API.throwUnsupportedProperty)(this.ccId, property);
|
|
547
540
|
}
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
async get(options) {
|
|
544
|
+
__assertType("options", "(optional) MeterCCGetOptions", __assertType__optional_MeterCCGetOptions.bind(void 0, options));
|
|
545
|
+
this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.Get);
|
|
546
|
+
const cc = new MeterCCGet({
|
|
547
|
+
nodeId: this.endpoint.nodeId,
|
|
548
|
+
endpointIndex: this.endpoint.index,
|
|
549
|
+
...options
|
|
550
|
+
});
|
|
551
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
552
|
+
if (response) {
|
|
553
|
+
return {
|
|
554
|
+
type: response.type,
|
|
555
|
+
scale: (0, import_core.getMeterScale)(response.type, response.scale) ?? (0, import_core.getUnknownMeterScale)(response.scale),
|
|
556
|
+
...(0, import_safe3.pick)(response, [
|
|
557
|
+
"value",
|
|
558
|
+
"previousValue",
|
|
559
|
+
"rateType",
|
|
560
|
+
"deltaTime"
|
|
561
|
+
])
|
|
562
|
+
};
|
|
548
563
|
}
|
|
549
|
-
return ret;
|
|
550
|
-
} else {
|
|
551
|
-
const response = await this.get();
|
|
552
|
-
return response ? [response] : [];
|
|
553
564
|
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
if (response) {
|
|
564
|
-
return (0, import_safe3.pick)(response, [
|
|
565
|
-
"type",
|
|
566
|
-
"supportsReset",
|
|
567
|
-
"supportedScales",
|
|
568
|
-
"supportedRateTypes"
|
|
569
|
-
]);
|
|
565
|
+
async sendReport(options) {
|
|
566
|
+
__assertType("options", "MeterCCReportOptions", __assertType__MeterCCReportOptions.bind(void 0, options));
|
|
567
|
+
this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.Report);
|
|
568
|
+
const cc = new MeterCCReport({
|
|
569
|
+
nodeId: this.endpoint.nodeId,
|
|
570
|
+
endpointIndex: this.endpoint.index,
|
|
571
|
+
...options
|
|
572
|
+
});
|
|
573
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
570
574
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
if (property !== "reset") {
|
|
595
|
-
(0, import_API.throwUnsupportedProperty)(this.ccId, property);
|
|
596
|
-
} else if (propertyKey != void 0 && typeof propertyKey !== "number") {
|
|
597
|
-
(0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
|
|
598
|
-
} else if (value !== true) {
|
|
599
|
-
(0, import_API.throwWrongValueType)(this.ccId, property, "true", value === false ? "false" : typeof value);
|
|
600
|
-
}
|
|
601
|
-
if (typeof propertyKey === "number") {
|
|
602
|
-
const { meterType, scale, rateType } = splitPropertyKey(propertyKey);
|
|
603
|
-
return this.reset({
|
|
604
|
-
type: meterType,
|
|
605
|
-
scale,
|
|
606
|
-
rateType,
|
|
607
|
-
targetValue: 0
|
|
608
|
-
});
|
|
575
|
+
async getAll(accumulatedOnly = false) {
|
|
576
|
+
__assertType("accumulatedOnly", "(optional) boolean", __assertType__optional_boolean.bind(void 0, accumulatedOnly));
|
|
577
|
+
const valueDB = this.tryGetValueDB();
|
|
578
|
+
if (this.version >= 2) {
|
|
579
|
+
const meterType = valueDB?.getValue(MeterCCValues.type.endpoint(this.endpoint.index));
|
|
580
|
+
const supportedScales = valueDB?.getValue(MeterCCValues.supportedScales.endpoint(this.endpoint.index)) ?? [];
|
|
581
|
+
const supportedRateTypes = valueDB?.getValue(MeterCCValues.supportedRateTypes.endpoint(this.endpoint.index)) ?? [];
|
|
582
|
+
const rateTypes = supportedRateTypes.length ? supportedRateTypes : [void 0];
|
|
583
|
+
const ret = [];
|
|
584
|
+
for (const rateType of rateTypes) {
|
|
585
|
+
for (const scale of supportedScales) {
|
|
586
|
+
if (accumulatedOnly && meterType != void 0 && !isAccumulatedValue(meterType, scale)) {
|
|
587
|
+
continue;
|
|
588
|
+
}
|
|
589
|
+
const response = await this.get({
|
|
590
|
+
scale,
|
|
591
|
+
rateType
|
|
592
|
+
});
|
|
593
|
+
if (response)
|
|
594
|
+
ret.push(response);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
return ret;
|
|
609
598
|
} else {
|
|
610
|
-
|
|
599
|
+
const response = await this.get();
|
|
600
|
+
return response ? [response] : [];
|
|
611
601
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
602
|
+
}
|
|
603
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
604
|
+
async getSupported() {
|
|
605
|
+
this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.SupportedGet);
|
|
606
|
+
const cc = new MeterCCSupportedGet({
|
|
607
|
+
nodeId: this.endpoint.nodeId,
|
|
608
|
+
endpointIndex: this.endpoint.index
|
|
609
|
+
});
|
|
610
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
611
|
+
if (response) {
|
|
612
|
+
return (0, import_safe3.pick)(response, [
|
|
613
|
+
"type",
|
|
614
|
+
"supportsReset",
|
|
615
|
+
"supportedScales",
|
|
616
|
+
"supportedRateTypes"
|
|
617
|
+
]);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
async sendSupportedReport(options) {
|
|
621
|
+
__assertType("options", "MeterCCSupportedReportOptions", __assertType__MeterCCSupportedReportOptions.bind(void 0, options));
|
|
622
|
+
this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.SupportedReport);
|
|
623
|
+
const cc = new MeterCCSupportedReport({
|
|
624
|
+
nodeId: this.endpoint.nodeId,
|
|
625
|
+
endpointIndex: this.endpoint.index,
|
|
626
|
+
...options
|
|
627
|
+
});
|
|
628
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
629
|
+
}
|
|
630
|
+
async reset(options) {
|
|
631
|
+
__assertType("options", "(optional) MeterCCResetOptions", __assertType__optional_MeterCCResetOptions.bind(void 0, options));
|
|
632
|
+
this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.Reset);
|
|
633
|
+
const cc = new MeterCCReset({
|
|
634
|
+
nodeId: this.endpoint.nodeId,
|
|
635
|
+
endpointIndex: this.endpoint.index,
|
|
636
|
+
...options
|
|
637
|
+
});
|
|
638
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
639
|
+
}
|
|
640
|
+
get [import_API.SET_VALUE]() {
|
|
641
|
+
return async function({ property, propertyKey }, value) {
|
|
642
|
+
if (property !== "reset") {
|
|
643
|
+
(0, import_API.throwUnsupportedProperty)(this.ccId, property);
|
|
644
|
+
} else if (propertyKey != void 0 && typeof propertyKey !== "number") {
|
|
645
|
+
(0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
|
|
646
|
+
} else if (value !== true) {
|
|
647
|
+
(0, import_API.throwWrongValueType)(this.ccId, property, "true", value === false ? "false" : typeof value);
|
|
639
648
|
}
|
|
649
|
+
if (typeof propertyKey === "number") {
|
|
650
|
+
const { meterType, scale, rateType } = splitPropertyKey(propertyKey);
|
|
651
|
+
return this.reset({
|
|
652
|
+
type: meterType,
|
|
653
|
+
scale,
|
|
654
|
+
rateType,
|
|
655
|
+
targetValue: 0
|
|
656
|
+
});
|
|
657
|
+
} else {
|
|
658
|
+
return this.reset();
|
|
659
|
+
}
|
|
660
|
+
return void 0;
|
|
640
661
|
};
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
if (
|
|
662
|
+
}
|
|
663
|
+
[import_API.SET_VALUE_HOOKS] = ({ property, propertyKey }, _value, _options) => {
|
|
664
|
+
if (property !== "reset")
|
|
644
665
|
return;
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
666
|
+
if (typeof propertyKey === "number") {
|
|
667
|
+
const { meterType, rateType, scale } = splitPropertyKey(propertyKey);
|
|
668
|
+
const readingValueId = MeterCCValues.value(meterType, rateType, scale).endpoint(this.endpoint.index);
|
|
669
|
+
return {
|
|
670
|
+
optimisticallyUpdateRelatedValues: (supervisedAndSuccessful) => {
|
|
671
|
+
if (!supervisedAndSuccessful)
|
|
672
|
+
return;
|
|
673
|
+
const valueDB = this.tryGetValueDB();
|
|
674
|
+
if (!valueDB)
|
|
675
|
+
return;
|
|
676
|
+
if (isAccumulatedValue(meterType, scale)) {
|
|
677
|
+
valueDB.setValue({
|
|
678
|
+
commandClass: this.ccId,
|
|
679
|
+
endpoint: this.endpoint.index,
|
|
680
|
+
property,
|
|
681
|
+
propertyKey
|
|
682
|
+
}, 0);
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
verifyChanges: () => {
|
|
686
|
+
this.schedulePoll(readingValueId, 0, { transition: "fast" });
|
|
657
687
|
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
688
|
+
};
|
|
689
|
+
} else {
|
|
690
|
+
const valueDB = this.tryGetValueDB();
|
|
691
|
+
if (!valueDB)
|
|
692
|
+
return;
|
|
693
|
+
const accumulatedValues = valueDB.findValues((vid) => vid.commandClass === this.ccId && vid.endpoint === this.endpoint.index && MeterCCValues.value.is(vid)).filter(({ propertyKey: propertyKey2 }) => {
|
|
694
|
+
if (typeof propertyKey2 !== "number")
|
|
695
|
+
return false;
|
|
696
|
+
const { meterType, scale } = splitPropertyKey(propertyKey2);
|
|
697
|
+
return isAccumulatedValue(meterType, scale);
|
|
698
|
+
});
|
|
699
|
+
return {
|
|
700
|
+
optimisticallyUpdateRelatedValues: (supervisedAndSuccessful) => {
|
|
701
|
+
if (!supervisedAndSuccessful)
|
|
702
|
+
return;
|
|
703
|
+
for (const value of accumulatedValues) {
|
|
704
|
+
valueDB.setValue(value, 0);
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
verifyChanges: () => {
|
|
708
|
+
for (const valueID of accumulatedValues) {
|
|
709
|
+
this.schedulePoll(valueID, 0, { transition: "fast" });
|
|
710
|
+
}
|
|
662
711
|
}
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
}
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
};
|
|
666
715
|
};
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
let
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
716
|
+
return MeterCCAPI2 = _classThis;
|
|
717
|
+
})();
|
|
718
|
+
let MeterCC = (() => {
|
|
719
|
+
let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_safe.CommandClasses.Meter), (0, import_CommandClassDecorators.implementedVersion)(6), (0, import_CommandClassDecorators.ccValues)(MeterCCValues)];
|
|
720
|
+
let _classDescriptor;
|
|
721
|
+
let _classExtraInitializers = [];
|
|
722
|
+
let _classThis;
|
|
723
|
+
let _classSuper = import_CommandClass.CommandClass;
|
|
724
|
+
var MeterCC2 = class extends _classSuper {
|
|
725
|
+
static {
|
|
726
|
+
_classThis = this;
|
|
727
|
+
}
|
|
728
|
+
static {
|
|
729
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
730
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
731
|
+
MeterCC2 = _classThis = _classDescriptor.value;
|
|
732
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
733
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
734
|
+
}
|
|
735
|
+
async interview(ctx) {
|
|
736
|
+
const node = this.getNode(ctx);
|
|
737
|
+
const endpoint = this.getEndpoint(ctx);
|
|
738
|
+
const api = import_API.CCAPI.create(import_safe.CommandClasses.Meter, ctx, endpoint).withOptions({
|
|
739
|
+
priority: import_safe.MessagePriority.NodeQuery
|
|
740
|
+
});
|
|
684
741
|
ctx.logNode(node.id, {
|
|
685
742
|
endpoint: this.endpointIndex,
|
|
686
|
-
message:
|
|
687
|
-
direction: "
|
|
743
|
+
message: `Interviewing ${this.ccName}...`,
|
|
744
|
+
direction: "none"
|
|
688
745
|
});
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
746
|
+
if (api.version >= 2) {
|
|
747
|
+
ctx.logNode(node.id, {
|
|
748
|
+
endpoint: this.endpointIndex,
|
|
749
|
+
message: "querying meter support...",
|
|
750
|
+
direction: "outbound"
|
|
751
|
+
});
|
|
752
|
+
const suppResp = await api.getSupported();
|
|
753
|
+
if (suppResp) {
|
|
754
|
+
const logMessage = `received meter support:
|
|
692
755
|
type: ${(0, import_core.getMeterName)(suppResp.type)}
|
|
693
756
|
supported scales: ${suppResp.supportedScales.map((s) => ((0, import_core.getMeterScale)(suppResp.type, s) ?? (0, import_core.getUnknownMeterScale)(s)).label).map((label) => `
|
|
694
757
|
\xB7 ${label}`).join("")}
|
|
695
758
|
supported rate types: ${suppResp.supportedRateTypes.map((rt) => (0, import_safe3.getEnumMemberName)(import_Types.RateType, rt)).map((label) => `
|
|
696
759
|
\xB7 ${label}`).join("")}
|
|
697
760
|
supports reset: ${suppResp.supportsReset}`;
|
|
761
|
+
ctx.logNode(node.id, {
|
|
762
|
+
endpoint: this.endpointIndex,
|
|
763
|
+
message: logMessage,
|
|
764
|
+
direction: "inbound"
|
|
765
|
+
});
|
|
766
|
+
} else {
|
|
767
|
+
ctx.logNode(node.id, {
|
|
768
|
+
endpoint: this.endpointIndex,
|
|
769
|
+
message: "Querying meter support timed out, skipping interview...",
|
|
770
|
+
level: "warn"
|
|
771
|
+
});
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
await this.refreshValues(ctx);
|
|
776
|
+
this.setInterviewComplete(ctx, true);
|
|
777
|
+
}
|
|
778
|
+
async refreshValues(ctx) {
|
|
779
|
+
const node = this.getNode(ctx);
|
|
780
|
+
const endpoint = this.getEndpoint(ctx);
|
|
781
|
+
const api = import_API.CCAPI.create(import_safe.CommandClasses.Meter, ctx, endpoint).withOptions({
|
|
782
|
+
priority: import_safe.MessagePriority.NodeQuery
|
|
783
|
+
});
|
|
784
|
+
if (api.version === 1) {
|
|
698
785
|
ctx.logNode(node.id, {
|
|
699
786
|
endpoint: this.endpointIndex,
|
|
700
|
-
message:
|
|
701
|
-
direction: "
|
|
787
|
+
message: `querying default meter value...`,
|
|
788
|
+
direction: "outbound"
|
|
702
789
|
});
|
|
790
|
+
await api.get();
|
|
703
791
|
} else {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
792
|
+
const type = this.getValue(ctx, MeterCCValues.type) ?? 0;
|
|
793
|
+
const supportedScales = this.getValue(ctx, MeterCCValues.supportedScales) ?? [];
|
|
794
|
+
const supportedRateTypes = this.getValue(ctx, MeterCCValues.supportedRateTypes) ?? [];
|
|
795
|
+
const rateTypes = supportedRateTypes.length ? supportedRateTypes : [void 0];
|
|
796
|
+
for (const rateType of rateTypes) {
|
|
797
|
+
for (const scale of supportedScales) {
|
|
798
|
+
ctx.logNode(node.id, {
|
|
799
|
+
endpoint: this.endpointIndex,
|
|
800
|
+
message: `querying meter value (type = ${(0, import_core.getMeterName)(type)}, scale = ${((0, import_core.getMeterScale)(type, scale) ?? (0, import_core.getUnknownMeterScale)(scale)).label}${rateType != void 0 ? `, rate type = ${(0, import_safe3.getEnumMemberName)(import_Types.RateType, rateType)}` : ""})...`,
|
|
801
|
+
direction: "outbound"
|
|
802
|
+
});
|
|
803
|
+
await api.get({ scale, rateType });
|
|
804
|
+
}
|
|
805
|
+
}
|
|
710
806
|
}
|
|
711
807
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
});
|
|
721
|
-
if (api.version === 1) {
|
|
722
|
-
ctx.logNode(node.id, {
|
|
723
|
-
endpoint: this.endpointIndex,
|
|
724
|
-
message: `querying default meter value...`,
|
|
725
|
-
direction: "outbound"
|
|
808
|
+
shouldRefreshValues(ctx) {
|
|
809
|
+
const valueDB = ctx.tryGetValueDB(this.nodeId);
|
|
810
|
+
if (!valueDB)
|
|
811
|
+
return true;
|
|
812
|
+
const values = this.getDefinedValueIDs(ctx).filter((v) => MeterCCValues.value.is(v));
|
|
813
|
+
return values.every((v) => {
|
|
814
|
+
const lastUpdated = valueDB.getTimestamp(v);
|
|
815
|
+
return lastUpdated == void 0 || Date.now() - lastUpdated > import_core.timespan.hours(6);
|
|
726
816
|
});
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Returns which type this meter has.
|
|
820
|
+
* This only works AFTER the interview process
|
|
821
|
+
*/
|
|
822
|
+
static getMeterTypeCached(ctx, endpoint) {
|
|
823
|
+
return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.type.endpoint(endpoint.index));
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* Returns which scales are supported by this meter.
|
|
827
|
+
* This only works AFTER the interview process
|
|
828
|
+
*/
|
|
829
|
+
static getSupportedScalesCached(ctx, endpoint) {
|
|
830
|
+
return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportedScales.endpoint(endpoint.index));
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Returns whether reset is supported by this meter.
|
|
834
|
+
* This only works AFTER the interview process
|
|
835
|
+
*/
|
|
836
|
+
static supportsResetCached(ctx, endpoint) {
|
|
837
|
+
return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportsReset.endpoint(endpoint.index));
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* Returns which rate types are supported by this meter.
|
|
841
|
+
* This only works AFTER the interview process
|
|
842
|
+
*/
|
|
843
|
+
static getSupportedRateTypesCached(ctx, endpoint) {
|
|
844
|
+
return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportedRateTypes.endpoint(endpoint.index));
|
|
845
|
+
}
|
|
846
|
+
translatePropertyKey(ctx, property, propertyKey) {
|
|
847
|
+
if (property === "value" && typeof propertyKey === "number") {
|
|
848
|
+
const { meterType, rateType, scale } = splitPropertyKey(propertyKey);
|
|
849
|
+
let ret;
|
|
850
|
+
if (meterType !== 0) {
|
|
851
|
+
ret = `${(0, import_core.getMeterName)(meterType)}_${((0, import_core.getMeterScale)(meterType, scale) ?? (0, import_core.getUnknownMeterScale)(scale)).label}`;
|
|
852
|
+
} else {
|
|
853
|
+
ret = "default";
|
|
854
|
+
}
|
|
855
|
+
if (rateType !== import_Types.RateType.Unspecified) {
|
|
856
|
+
ret += "_" + (0, import_safe3.getEnumMemberName)(import_Types.RateType, rateType);
|
|
741
857
|
}
|
|
858
|
+
return ret;
|
|
859
|
+
} else if (property === "reset" && typeof propertyKey === "number") {
|
|
860
|
+
return (0, import_core.getMeterName)(propertyKey);
|
|
742
861
|
}
|
|
862
|
+
return super.translatePropertyKey(ctx, property, propertyKey);
|
|
743
863
|
}
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
* Returns which type this meter has.
|
|
757
|
-
* This only works AFTER the interview process
|
|
758
|
-
*/
|
|
759
|
-
static getMeterTypeCached(ctx, endpoint) {
|
|
760
|
-
return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.type.endpoint(endpoint.index));
|
|
761
|
-
}
|
|
762
|
-
/**
|
|
763
|
-
* Returns which scales are supported by this meter.
|
|
764
|
-
* This only works AFTER the interview process
|
|
765
|
-
*/
|
|
766
|
-
static getSupportedScalesCached(ctx, endpoint) {
|
|
767
|
-
return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportedScales.endpoint(endpoint.index));
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* Returns whether reset is supported by this meter.
|
|
771
|
-
* This only works AFTER the interview process
|
|
772
|
-
*/
|
|
773
|
-
static supportsResetCached(ctx, endpoint) {
|
|
774
|
-
return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportsReset.endpoint(endpoint.index));
|
|
775
|
-
}
|
|
776
|
-
/**
|
|
777
|
-
* Returns which rate types are supported by this meter.
|
|
778
|
-
* This only works AFTER the interview process
|
|
779
|
-
*/
|
|
780
|
-
static getSupportedRateTypesCached(ctx, endpoint) {
|
|
781
|
-
return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportedRateTypes.endpoint(endpoint.index));
|
|
782
|
-
}
|
|
783
|
-
translatePropertyKey(ctx, property, propertyKey) {
|
|
784
|
-
if (property === "value" && typeof propertyKey === "number") {
|
|
785
|
-
const { meterType, rateType, scale } = splitPropertyKey(propertyKey);
|
|
786
|
-
let ret;
|
|
787
|
-
if (meterType !== 0) {
|
|
788
|
-
ret = `${(0, import_core.getMeterName)(meterType)}_${((0, import_core.getMeterScale)(meterType, scale) ?? (0, import_core.getUnknownMeterScale)(scale)).label}`;
|
|
789
|
-
} else {
|
|
790
|
-
ret = "default";
|
|
791
|
-
}
|
|
792
|
-
if (rateType !== import_Types.RateType.Unspecified) {
|
|
793
|
-
ret += "_" + (0, import_safe3.getEnumMemberName)(import_Types.RateType, rateType);
|
|
794
|
-
}
|
|
795
|
-
return ret;
|
|
796
|
-
} else if (property === "reset" && typeof propertyKey === "number") {
|
|
797
|
-
return (0, import_core.getMeterName)(propertyKey);
|
|
864
|
+
};
|
|
865
|
+
return MeterCC2 = _classThis;
|
|
866
|
+
})();
|
|
867
|
+
let MeterCCReport = (() => {
|
|
868
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.Report)];
|
|
869
|
+
let _classDescriptor;
|
|
870
|
+
let _classExtraInitializers = [];
|
|
871
|
+
let _classThis;
|
|
872
|
+
let _classSuper = MeterCC;
|
|
873
|
+
var MeterCCReport2 = class extends _classSuper {
|
|
874
|
+
static {
|
|
875
|
+
_classThis = this;
|
|
798
876
|
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
};
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if (deltaTime === 65535) {
|
|
827
|
-
deltaTime = import_safe.UNKNOWN_STATE;
|
|
828
|
-
}
|
|
829
|
-
if (
|
|
830
|
-
// Previous value is included only if delta time is not 0
|
|
831
|
-
deltaTime !== 0 && raw.payload.length >= offset + floatSize
|
|
832
|
-
) {
|
|
833
|
-
const { value: prevValue } = (0, import_safe.parseFloatWithScale)(
|
|
834
|
-
// This float is split in the payload
|
|
835
|
-
import_safe2.Bytes.concat([
|
|
836
|
-
import_safe2.Bytes.from([raw.payload[1]]),
|
|
837
|
-
raw.payload.subarray(offset)
|
|
838
|
-
])
|
|
839
|
-
);
|
|
840
|
-
offset += floatSize;
|
|
841
|
-
previousValue = prevValue;
|
|
842
|
-
}
|
|
843
|
-
} else {
|
|
844
|
-
deltaTime = 0;
|
|
845
|
-
}
|
|
846
|
-
const scale = parseScale(scale1, raw.payload, offset);
|
|
847
|
-
return new MeterCCReport_1({
|
|
848
|
-
nodeId: ctx.sourceNodeId,
|
|
849
|
-
type,
|
|
850
|
-
rateType,
|
|
851
|
-
value,
|
|
852
|
-
deltaTime,
|
|
853
|
-
previousValue,
|
|
854
|
-
scale
|
|
855
|
-
});
|
|
856
|
-
}
|
|
857
|
-
persistValues(ctx) {
|
|
858
|
-
if (!super.persistValues(ctx))
|
|
859
|
-
return false;
|
|
860
|
-
const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
|
|
861
|
-
const meter = (0, import_core.getMeter)(this.type);
|
|
862
|
-
const scale = (0, import_core.getMeterScale)(this.type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale);
|
|
863
|
-
const measurementValidation = !ctx.getDeviceConfig?.(this.nodeId)?.compat?.disableStrictMeasurementValidation;
|
|
864
|
-
if (measurementValidation) {
|
|
865
|
-
import_safe.validatePayload.withReason(`Unknown meter type ${(0, import_safe3.num2hex)(this.type)} or corrupted data`)(!!meter);
|
|
866
|
-
import_safe.validatePayload.withReason(`Unknown meter scale ${(0, import_safe3.num2hex)(this.scale)} or corrupted data`)(scale.label !== (0, import_core.getUnknownMeterScale)(this.scale).label);
|
|
867
|
-
if (ccVersion >= 2) {
|
|
868
|
-
const expectedType = this.getValue(ctx, MeterCCValues.type);
|
|
869
|
-
if (expectedType != void 0) {
|
|
870
|
-
import_safe.validatePayload.withReason("Unexpected meter type or corrupted data")(this.type === expectedType);
|
|
871
|
-
}
|
|
872
|
-
const supportedScales = this.getValue(ctx, MeterCCValues.supportedScales);
|
|
873
|
-
if (supportedScales?.length) {
|
|
874
|
-
import_safe.validatePayload.withReason(`Unsupported meter scale ${scale.label} or corrupted data`)(supportedScales.includes(this.scale));
|
|
877
|
+
static {
|
|
878
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
879
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
880
|
+
MeterCCReport2 = _classThis = _classDescriptor.value;
|
|
881
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
882
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
883
|
+
}
|
|
884
|
+
constructor(options) {
|
|
885
|
+
super(options);
|
|
886
|
+
this.type = options.type;
|
|
887
|
+
this.scale = options.scale;
|
|
888
|
+
this.value = options.value;
|
|
889
|
+
this.previousValue = options.previousValue;
|
|
890
|
+
this.rateType = options.rateType ?? import_Types.RateType.Unspecified;
|
|
891
|
+
this.deltaTime = options.deltaTime ?? import_safe.UNKNOWN_STATE;
|
|
892
|
+
}
|
|
893
|
+
static from(raw, ctx) {
|
|
894
|
+
const { type, rateType, scale1, value, bytesRead } = parseMeterValueAndInfo(raw.payload, 0);
|
|
895
|
+
let offset = bytesRead;
|
|
896
|
+
const floatSize = bytesRead - 2;
|
|
897
|
+
let deltaTime;
|
|
898
|
+
let previousValue;
|
|
899
|
+
if (raw.payload.length >= offset + 2) {
|
|
900
|
+
deltaTime = raw.payload.readUInt16BE(offset);
|
|
901
|
+
offset += 2;
|
|
902
|
+
if (deltaTime === 65535) {
|
|
903
|
+
deltaTime = import_safe.UNKNOWN_STATE;
|
|
875
904
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
905
|
+
if (
|
|
906
|
+
// Previous value is included only if delta time is not 0
|
|
907
|
+
deltaTime !== 0 && raw.payload.length >= offset + floatSize
|
|
908
|
+
) {
|
|
909
|
+
const { value: prevValue } = (0, import_safe.parseFloatWithScale)(
|
|
910
|
+
// This float is split in the payload
|
|
911
|
+
import_safe2.Bytes.concat([
|
|
912
|
+
import_safe2.Bytes.from([raw.payload[1]]),
|
|
913
|
+
raw.payload.subarray(offset)
|
|
914
|
+
])
|
|
915
|
+
);
|
|
916
|
+
offset += floatSize;
|
|
917
|
+
previousValue = prevValue;
|
|
879
918
|
}
|
|
919
|
+
} else {
|
|
920
|
+
deltaTime = 0;
|
|
880
921
|
}
|
|
922
|
+
const scale = parseScale(scale1, raw.payload, offset);
|
|
923
|
+
return new this({
|
|
924
|
+
nodeId: ctx.sourceNodeId,
|
|
925
|
+
type,
|
|
926
|
+
rateType,
|
|
927
|
+
value,
|
|
928
|
+
deltaTime,
|
|
929
|
+
previousValue,
|
|
930
|
+
scale
|
|
931
|
+
});
|
|
881
932
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
933
|
+
persistValues(ctx) {
|
|
934
|
+
if (!super.persistValues(ctx))
|
|
935
|
+
return false;
|
|
936
|
+
const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
|
|
937
|
+
const meter = (0, import_core.getMeter)(this.type);
|
|
938
|
+
const scale = (0, import_core.getMeterScale)(this.type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale);
|
|
939
|
+
const measurementValidation = !ctx.getDeviceConfig?.(this.nodeId)?.compat?.disableStrictMeasurementValidation;
|
|
940
|
+
if (measurementValidation) {
|
|
941
|
+
import_safe.validatePayload.withReason(`Unknown meter type ${(0, import_safe3.num2hex)(this.type)} or corrupted data`)(!!meter);
|
|
942
|
+
import_safe.validatePayload.withReason(`Unknown meter scale ${(0, import_safe3.num2hex)(this.scale)} or corrupted data`)(scale.label !== (0, import_core.getUnknownMeterScale)(this.scale).label);
|
|
943
|
+
if (ccVersion >= 2) {
|
|
944
|
+
const expectedType = this.getValue(ctx, MeterCCValues.type);
|
|
945
|
+
if (expectedType != void 0) {
|
|
946
|
+
import_safe.validatePayload.withReason("Unexpected meter type or corrupted data")(this.type === expectedType);
|
|
947
|
+
}
|
|
948
|
+
const supportedScales = this.getValue(ctx, MeterCCValues.supportedScales);
|
|
949
|
+
if (supportedScales?.length) {
|
|
950
|
+
import_safe.validatePayload.withReason(`Unsupported meter scale ${scale.label} or corrupted data`)(supportedScales.includes(this.scale));
|
|
951
|
+
}
|
|
952
|
+
const supportedRateTypes = this.getValue(ctx, MeterCCValues.supportedRateTypes);
|
|
953
|
+
if (supportedRateTypes?.length) {
|
|
954
|
+
import_safe.validatePayload.withReason(`Unsupported rate type ${(0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType)} or corrupted data`)(supportedRateTypes.includes(this.rateType));
|
|
955
|
+
}
|
|
956
|
+
}
|
|
891
957
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
const deltaTimeBytes = new import_safe2.Bytes(2);
|
|
906
|
-
deltaTimeBytes.writeUInt16BE(deltaTime, 0);
|
|
907
|
-
this.payload = import_safe2.Bytes.concat([
|
|
908
|
-
typeAndValue,
|
|
909
|
-
deltaTimeBytes
|
|
910
|
-
]);
|
|
911
|
-
if (this.deltaTime !== 0 && this.previousValue != void 0) {
|
|
912
|
-
const prevValueBytes = (0, import_core.encodeFloatWithScale)(
|
|
913
|
-
this.previousValue,
|
|
914
|
-
0,
|
|
915
|
-
// we discard the scale anyways
|
|
916
|
-
floatParams
|
|
917
|
-
).subarray(1);
|
|
918
|
-
this.payload = import_safe2.Bytes.concat([
|
|
919
|
-
this.payload,
|
|
920
|
-
prevValueBytes
|
|
921
|
-
]);
|
|
958
|
+
const valueValue = MeterCCValues.value(this.type, this.rateType, this.scale);
|
|
959
|
+
this.setMetadata(ctx, valueValue, {
|
|
960
|
+
...valueValue.meta,
|
|
961
|
+
label: getValueLabel(this.type, this.scale, this.rateType),
|
|
962
|
+
unit: scale.unit,
|
|
963
|
+
ccSpecific: {
|
|
964
|
+
meterType: this.type,
|
|
965
|
+
scale: this.scale,
|
|
966
|
+
rateType: this.rateType
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
this.setValue(ctx, valueValue, this.value);
|
|
970
|
+
return true;
|
|
922
971
|
}
|
|
923
|
-
|
|
972
|
+
type;
|
|
973
|
+
scale;
|
|
974
|
+
value;
|
|
975
|
+
previousValue;
|
|
976
|
+
rateType;
|
|
977
|
+
deltaTime;
|
|
978
|
+
serialize(ctx) {
|
|
979
|
+
const { data: typeAndValue, floatParams, scale2 } = encodeMeterValueAndInfo(this.type, this.rateType, this.scale, this.value);
|
|
980
|
+
const deltaTime = this.deltaTime ?? 65535;
|
|
981
|
+
const deltaTimeBytes = new import_safe2.Bytes(2);
|
|
982
|
+
deltaTimeBytes.writeUInt16BE(deltaTime, 0);
|
|
924
983
|
this.payload = import_safe2.Bytes.concat([
|
|
925
|
-
|
|
926
|
-
|
|
984
|
+
typeAndValue,
|
|
985
|
+
deltaTimeBytes
|
|
927
986
|
]);
|
|
987
|
+
if (this.deltaTime !== 0 && this.previousValue != void 0) {
|
|
988
|
+
const prevValueBytes = (0, import_core.encodeFloatWithScale)(
|
|
989
|
+
this.previousValue,
|
|
990
|
+
0,
|
|
991
|
+
// we discard the scale anyways
|
|
992
|
+
floatParams
|
|
993
|
+
).subarray(1);
|
|
994
|
+
this.payload = import_safe2.Bytes.concat([
|
|
995
|
+
this.payload,
|
|
996
|
+
prevValueBytes
|
|
997
|
+
]);
|
|
998
|
+
}
|
|
999
|
+
if (scale2 != void 0) {
|
|
1000
|
+
this.payload = import_safe2.Bytes.concat([
|
|
1001
|
+
this.payload,
|
|
1002
|
+
import_safe2.Bytes.from([scale2])
|
|
1003
|
+
]);
|
|
1004
|
+
}
|
|
1005
|
+
return super.serialize(ctx);
|
|
928
1006
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1007
|
+
toLogEntry(ctx) {
|
|
1008
|
+
const scale = (0, import_core.getMeterScale)(this.type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale);
|
|
1009
|
+
const message = {
|
|
1010
|
+
"meter type": (0, import_core.getMeterName)(this.type),
|
|
1011
|
+
scale: scale.label,
|
|
1012
|
+
"rate type": (0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType),
|
|
1013
|
+
value: this.value
|
|
1014
|
+
};
|
|
1015
|
+
if (this.deltaTime !== import_safe.UNKNOWN_STATE) {
|
|
1016
|
+
message["time delta"] = `${this.deltaTime} seconds`;
|
|
1017
|
+
}
|
|
1018
|
+
if (this.previousValue != void 0) {
|
|
1019
|
+
message["prev. value"] = this.previousValue;
|
|
1020
|
+
}
|
|
1021
|
+
return {
|
|
1022
|
+
...super.toLogEntry(ctx),
|
|
1023
|
+
message
|
|
1024
|
+
};
|
|
944
1025
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
};
|
|
949
|
-
}
|
|
950
|
-
};
|
|
951
|
-
MeterCCReport = MeterCCReport_1 = __decorate([
|
|
952
|
-
(0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.Report)
|
|
953
|
-
], MeterCCReport);
|
|
1026
|
+
};
|
|
1027
|
+
return MeterCCReport2 = _classThis;
|
|
1028
|
+
})();
|
|
954
1029
|
function testResponseForMeterGet(sent, received) {
|
|
955
1030
|
return (sent.scale == void 0 || sent.scale === received.scale) && (sent.rateType == void 0 || sent.rateType == received.rateType);
|
|
956
1031
|
}
|
|
957
|
-
let MeterCCGet =
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
if (raw.payload.length >= 1) {
|
|
967
|
-
rateType = (raw.payload[0] & 192) >>> 6;
|
|
968
|
-
scale = (raw.payload[0] & 56) >>> 3;
|
|
969
|
-
if (scale === 7) {
|
|
970
|
-
(0, import_safe.validatePayload)(raw.payload.length >= 2);
|
|
971
|
-
scale += raw.payload[1];
|
|
972
|
-
}
|
|
1032
|
+
let MeterCCGet = (() => {
|
|
1033
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.Get), (0, import_CommandClassDecorators.expectedCCResponse)(MeterCCReport, testResponseForMeterGet)];
|
|
1034
|
+
let _classDescriptor;
|
|
1035
|
+
let _classExtraInitializers = [];
|
|
1036
|
+
let _classThis;
|
|
1037
|
+
let _classSuper = MeterCC;
|
|
1038
|
+
var MeterCCGet2 = class extends _classSuper {
|
|
1039
|
+
static {
|
|
1040
|
+
_classThis = this;
|
|
973
1041
|
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
bufferLength = 1;
|
|
996
|
-
} else if (ccVersion >= 2) {
|
|
997
|
-
scale1 = this.scale & 3;
|
|
998
|
-
bufferLength = 1;
|
|
999
|
-
} else {
|
|
1000
|
-
scale1 = 0;
|
|
1001
|
-
}
|
|
1002
|
-
let rateTypeFlags = 0;
|
|
1003
|
-
if (ccVersion >= 4 && this.rateType != void 0) {
|
|
1004
|
-
rateTypeFlags = this.rateType & 3;
|
|
1005
|
-
bufferLength = Math.max(bufferLength, 1);
|
|
1006
|
-
}
|
|
1007
|
-
this.payload = import_safe2.Bytes.alloc(bufferLength, 0);
|
|
1008
|
-
this.payload[0] = rateTypeFlags << 6 | scale1 << 3;
|
|
1009
|
-
if (scale2)
|
|
1010
|
-
this.payload[1] = scale2;
|
|
1011
|
-
return super.serialize(ctx);
|
|
1012
|
-
}
|
|
1013
|
-
toLogEntry(ctx) {
|
|
1014
|
-
const message = {};
|
|
1015
|
-
if (this.rateType != void 0) {
|
|
1016
|
-
message["rate type"] = (0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType);
|
|
1017
|
-
}
|
|
1018
|
-
if (this.scale != void 0) {
|
|
1019
|
-
if (ctx) {
|
|
1020
|
-
const type = this.getValue(ctx, MeterCCValues.type);
|
|
1021
|
-
if (type != void 0) {
|
|
1022
|
-
message.scale = ((0, import_core.getMeterScale)(type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale)).label;
|
|
1042
|
+
static {
|
|
1043
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1044
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1045
|
+
MeterCCGet2 = _classThis = _classDescriptor.value;
|
|
1046
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1047
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1048
|
+
}
|
|
1049
|
+
constructor(options) {
|
|
1050
|
+
super(options);
|
|
1051
|
+
this.rateType = options.rateType;
|
|
1052
|
+
this.scale = options.scale;
|
|
1053
|
+
}
|
|
1054
|
+
static from(raw, ctx) {
|
|
1055
|
+
let rateType;
|
|
1056
|
+
let scale;
|
|
1057
|
+
if (raw.payload.length >= 1) {
|
|
1058
|
+
rateType = (raw.payload[0] & 192) >>> 6;
|
|
1059
|
+
scale = (raw.payload[0] & 56) >>> 3;
|
|
1060
|
+
if (scale === 7) {
|
|
1061
|
+
(0, import_safe.validatePayload)(raw.payload.length >= 2);
|
|
1062
|
+
scale += raw.payload[1];
|
|
1023
1063
|
}
|
|
1064
|
+
}
|
|
1065
|
+
return new this({
|
|
1066
|
+
nodeId: ctx.sourceNodeId,
|
|
1067
|
+
rateType,
|
|
1068
|
+
scale
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
rateType;
|
|
1072
|
+
scale;
|
|
1073
|
+
serialize(ctx) {
|
|
1074
|
+
let scale1;
|
|
1075
|
+
let scale2;
|
|
1076
|
+
let bufferLength = 0;
|
|
1077
|
+
const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
|
|
1078
|
+
if (this.scale == void 0) {
|
|
1079
|
+
scale1 = 0;
|
|
1080
|
+
} else if (ccVersion >= 4 && this.scale >= 7) {
|
|
1081
|
+
scale1 = 7;
|
|
1082
|
+
scale2 = this.scale >>> 3;
|
|
1083
|
+
bufferLength = 2;
|
|
1084
|
+
} else if (ccVersion >= 3) {
|
|
1085
|
+
scale1 = this.scale & 7;
|
|
1086
|
+
bufferLength = 1;
|
|
1087
|
+
} else if (ccVersion >= 2) {
|
|
1088
|
+
scale1 = this.scale & 3;
|
|
1089
|
+
bufferLength = 1;
|
|
1024
1090
|
} else {
|
|
1025
|
-
|
|
1091
|
+
scale1 = 0;
|
|
1026
1092
|
}
|
|
1093
|
+
let rateTypeFlags = 0;
|
|
1094
|
+
if (ccVersion >= 4 && this.rateType != void 0) {
|
|
1095
|
+
rateTypeFlags = this.rateType & 3;
|
|
1096
|
+
bufferLength = Math.max(bufferLength, 1);
|
|
1097
|
+
}
|
|
1098
|
+
this.payload = import_safe2.Bytes.alloc(bufferLength, 0);
|
|
1099
|
+
this.payload[0] = rateTypeFlags << 6 | scale1 << 3;
|
|
1100
|
+
if (scale2)
|
|
1101
|
+
this.payload[1] = scale2;
|
|
1102
|
+
return super.serialize(ctx);
|
|
1027
1103
|
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
this.type = options.type;
|
|
1042
|
-
this.supportsReset = options.supportsReset;
|
|
1043
|
-
this.supportedScales = options.supportedScales;
|
|
1044
|
-
this.supportedRateTypes = options.supportedRateTypes;
|
|
1045
|
-
}
|
|
1046
|
-
static from(raw, ctx) {
|
|
1047
|
-
(0, import_safe.validatePayload)(raw.payload.length >= 2);
|
|
1048
|
-
const type = raw.payload[0] & 31;
|
|
1049
|
-
const supportsReset = !!(raw.payload[0] & 128);
|
|
1050
|
-
const hasMoreScales = !!(raw.payload[1] & 128);
|
|
1051
|
-
let supportedScales;
|
|
1052
|
-
if (hasMoreScales) {
|
|
1053
|
-
(0, import_safe.validatePayload)(raw.payload.length >= 3);
|
|
1054
|
-
const extraBytes = raw.payload[2];
|
|
1055
|
-
(0, import_safe.validatePayload)(raw.payload.length >= 3 + extraBytes);
|
|
1056
|
-
supportedScales = (0, import_safe.parseBitMask)(import_safe2.Bytes.concat([
|
|
1057
|
-
import_safe2.Bytes.from([raw.payload[1] & 127]),
|
|
1058
|
-
raw.payload.subarray(3, 3 + extraBytes)
|
|
1059
|
-
]), 0).map((scale) => scale >= 8 ? scale - 1 : scale);
|
|
1060
|
-
} else {
|
|
1061
|
-
supportedScales = (0, import_safe.parseBitMask)(import_safe2.Bytes.from([raw.payload[1]]), 0);
|
|
1062
|
-
}
|
|
1063
|
-
const supportedRateTypes = (0, import_safe.parseBitMask)(import_safe2.Bytes.from([(raw.payload[0] & 96) >>> 5]), 1);
|
|
1064
|
-
return new MeterCCSupportedReport_1({
|
|
1065
|
-
nodeId: ctx.sourceNodeId,
|
|
1066
|
-
type,
|
|
1067
|
-
supportsReset,
|
|
1068
|
-
supportedScales,
|
|
1069
|
-
supportedRateTypes
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
type;
|
|
1073
|
-
supportsReset;
|
|
1074
|
-
supportedScales;
|
|
1075
|
-
supportedRateTypes;
|
|
1076
|
-
persistValues(ctx) {
|
|
1077
|
-
if (!super.persistValues(ctx))
|
|
1078
|
-
return false;
|
|
1079
|
-
if (!this.supportsReset)
|
|
1080
|
-
return true;
|
|
1081
|
-
const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
|
|
1082
|
-
if (ccVersion < 6) {
|
|
1083
|
-
this.ensureMetadata(ctx, MeterCCValues.resetAll);
|
|
1084
|
-
} else {
|
|
1085
|
-
for (const scale of this.supportedScales) {
|
|
1086
|
-
if (!isAccumulatedValue(this.type, scale))
|
|
1087
|
-
continue;
|
|
1088
|
-
for (const rateType of this.supportedRateTypes) {
|
|
1089
|
-
const resetSingleValue = MeterCCValues.resetSingle(this.type, rateType, scale);
|
|
1090
|
-
this.ensureMetadata(ctx, resetSingleValue, {
|
|
1091
|
-
...resetSingleValue.meta,
|
|
1092
|
-
label: `Reset ${getValueLabel(this.type, scale, rateType)}`
|
|
1093
|
-
});
|
|
1104
|
+
toLogEntry(ctx) {
|
|
1105
|
+
const message = {};
|
|
1106
|
+
if (this.rateType != void 0) {
|
|
1107
|
+
message["rate type"] = (0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType);
|
|
1108
|
+
}
|
|
1109
|
+
if (this.scale != void 0) {
|
|
1110
|
+
if (ctx) {
|
|
1111
|
+
const type = this.getValue(ctx, MeterCCValues.type);
|
|
1112
|
+
if (type != void 0) {
|
|
1113
|
+
message.scale = ((0, import_core.getMeterScale)(type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale)).label;
|
|
1114
|
+
}
|
|
1115
|
+
} else {
|
|
1116
|
+
message.scale = this.scale;
|
|
1094
1117
|
}
|
|
1095
1118
|
}
|
|
1119
|
+
return {
|
|
1120
|
+
...super.toLogEntry(ctx),
|
|
1121
|
+
message
|
|
1122
|
+
};
|
|
1096
1123
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
const scalesByte1 = supportedScales[0] >>> 1 | (supportedScales.length > 1 ? 128 : 0);
|
|
1110
|
-
this.payload = import_safe2.Bytes.from([
|
|
1111
|
-
typeByte,
|
|
1112
|
-
scalesByte1
|
|
1113
|
-
]);
|
|
1114
|
-
if (supportedScales.length > 1) {
|
|
1115
|
-
this.payload = import_safe2.Bytes.concat([
|
|
1116
|
-
this.payload,
|
|
1117
|
-
import_safe2.Bytes.from([supportedScales.length - 1]),
|
|
1118
|
-
import_safe2.Bytes.from(supportedScales.subarray(1))
|
|
1119
|
-
]);
|
|
1124
|
+
};
|
|
1125
|
+
return MeterCCGet2 = _classThis;
|
|
1126
|
+
})();
|
|
1127
|
+
let MeterCCSupportedReport = (() => {
|
|
1128
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.SupportedReport), (0, import_CommandClassDecorators.ccValueProperty)("type", MeterCCValues.type), (0, import_CommandClassDecorators.ccValueProperty)("supportsReset", MeterCCValues.supportsReset), (0, import_CommandClassDecorators.ccValueProperty)("supportedScales", MeterCCValues.supportedScales), (0, import_CommandClassDecorators.ccValueProperty)("supportedRateTypes", MeterCCValues.supportedRateTypes)];
|
|
1129
|
+
let _classDescriptor;
|
|
1130
|
+
let _classExtraInitializers = [];
|
|
1131
|
+
let _classThis;
|
|
1132
|
+
let _classSuper = MeterCC;
|
|
1133
|
+
var MeterCCSupportedReport2 = class extends _classSuper {
|
|
1134
|
+
static {
|
|
1135
|
+
_classThis = this;
|
|
1120
1136
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
],
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
constructor(options) {
|
|
1160
|
-
super(options);
|
|
1161
|
-
this.type = options.type;
|
|
1162
|
-
this.scale = options.scale;
|
|
1163
|
-
this.rateType = options.rateType;
|
|
1164
|
-
this.targetValue = options.targetValue;
|
|
1165
|
-
}
|
|
1166
|
-
static from(raw, ctx) {
|
|
1167
|
-
if (raw.payload.length === 0) {
|
|
1168
|
-
return new MeterCCReset_1({
|
|
1169
|
-
nodeId: ctx.sourceNodeId
|
|
1137
|
+
static {
|
|
1138
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1139
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1140
|
+
MeterCCSupportedReport2 = _classThis = _classDescriptor.value;
|
|
1141
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1142
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1143
|
+
}
|
|
1144
|
+
constructor(options) {
|
|
1145
|
+
super(options);
|
|
1146
|
+
this.type = options.type;
|
|
1147
|
+
this.supportsReset = options.supportsReset;
|
|
1148
|
+
this.supportedScales = options.supportedScales;
|
|
1149
|
+
this.supportedRateTypes = options.supportedRateTypes;
|
|
1150
|
+
}
|
|
1151
|
+
static from(raw, ctx) {
|
|
1152
|
+
(0, import_safe.validatePayload)(raw.payload.length >= 2);
|
|
1153
|
+
const type = raw.payload[0] & 31;
|
|
1154
|
+
const supportsReset = !!(raw.payload[0] & 128);
|
|
1155
|
+
const hasMoreScales = !!(raw.payload[1] & 128);
|
|
1156
|
+
let supportedScales;
|
|
1157
|
+
if (hasMoreScales) {
|
|
1158
|
+
(0, import_safe.validatePayload)(raw.payload.length >= 3);
|
|
1159
|
+
const extraBytes = raw.payload[2];
|
|
1160
|
+
(0, import_safe.validatePayload)(raw.payload.length >= 3 + extraBytes);
|
|
1161
|
+
supportedScales = (0, import_safe.parseBitMask)(import_safe2.Bytes.concat([
|
|
1162
|
+
import_safe2.Bytes.from([raw.payload[1] & 127]),
|
|
1163
|
+
raw.payload.subarray(3, 3 + extraBytes)
|
|
1164
|
+
]), 0).map((scale) => scale >= 8 ? scale - 1 : scale);
|
|
1165
|
+
} else {
|
|
1166
|
+
supportedScales = (0, import_safe.parseBitMask)(import_safe2.Bytes.from([raw.payload[1]]), 0);
|
|
1167
|
+
}
|
|
1168
|
+
const supportedRateTypes = (0, import_safe.parseBitMask)(import_safe2.Bytes.from([(raw.payload[0] & 96) >>> 5]), 1);
|
|
1169
|
+
return new this({
|
|
1170
|
+
nodeId: ctx.sourceNodeId,
|
|
1171
|
+
type,
|
|
1172
|
+
supportsReset,
|
|
1173
|
+
supportedScales,
|
|
1174
|
+
supportedRateTypes
|
|
1170
1175
|
});
|
|
1171
1176
|
}
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1177
|
+
type;
|
|
1178
|
+
supportsReset;
|
|
1179
|
+
supportedScales;
|
|
1180
|
+
supportedRateTypes;
|
|
1181
|
+
persistValues(ctx) {
|
|
1182
|
+
if (!super.persistValues(ctx))
|
|
1183
|
+
return false;
|
|
1184
|
+
if (!this.supportsReset)
|
|
1185
|
+
return true;
|
|
1186
|
+
const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
|
|
1187
|
+
if (ccVersion < 6) {
|
|
1188
|
+
this.ensureMetadata(ctx, MeterCCValues.resetAll);
|
|
1189
|
+
} else {
|
|
1190
|
+
for (const scale of this.supportedScales) {
|
|
1191
|
+
if (!isAccumulatedValue(this.type, scale))
|
|
1192
|
+
continue;
|
|
1193
|
+
for (const rateType of this.supportedRateTypes) {
|
|
1194
|
+
const resetSingleValue = MeterCCValues.resetSingle(this.type, rateType, scale);
|
|
1195
|
+
this.ensureMetadata(ctx, resetSingleValue, {
|
|
1196
|
+
...resetSingleValue.meta,
|
|
1197
|
+
label: `Reset ${getValueLabel(this.type, scale, rateType)}`
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
return true;
|
|
1203
|
+
}
|
|
1204
|
+
serialize(ctx) {
|
|
1205
|
+
const typeByte = this.type & 31 | (this.supportedRateTypes.includes(import_Types.RateType.Consumed) ? 32 : 0) | (this.supportedRateTypes.includes(import_Types.RateType.Produced) ? 64 : 0) | (this.supportsReset ? 128 : 0);
|
|
1206
|
+
const supportedScales = (0, import_core.encodeBitMask)(
|
|
1207
|
+
this.supportedScales,
|
|
1208
|
+
void 0,
|
|
1209
|
+
// The first byte only has 7 bits for the bitmask,
|
|
1210
|
+
// so we add a fake bit for the value -1 and later shift
|
|
1211
|
+
// the first byte one to the right
|
|
1212
|
+
-1
|
|
1213
|
+
);
|
|
1214
|
+
const scalesByte1 = supportedScales[0] >>> 1 | (supportedScales.length > 1 ? 128 : 0);
|
|
1215
|
+
this.payload = import_safe2.Bytes.from([
|
|
1216
|
+
typeByte,
|
|
1217
|
+
scalesByte1
|
|
1218
|
+
]);
|
|
1219
|
+
if (supportedScales.length > 1) {
|
|
1191
1220
|
this.payload = import_safe2.Bytes.concat([
|
|
1192
1221
|
this.payload,
|
|
1193
|
-
import_safe2.Bytes.from([
|
|
1222
|
+
import_safe2.Bytes.from([supportedScales.length - 1]),
|
|
1223
|
+
import_safe2.Bytes.from(supportedScales.subarray(1))
|
|
1194
1224
|
]);
|
|
1195
1225
|
}
|
|
1226
|
+
return super.serialize(ctx);
|
|
1196
1227
|
}
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1228
|
+
toLogEntry(ctx) {
|
|
1229
|
+
const message = {
|
|
1230
|
+
"meter type": (0, import_core.getMeterName)(this.type),
|
|
1231
|
+
"supports reset": this.supportsReset,
|
|
1232
|
+
"supported scales": `${this.supportedScales.map((scale) => `
|
|
1233
|
+
\xB7 ${((0, import_core.getMeterScale)(this.type, scale) ?? (0, import_core.getUnknownMeterScale)(scale)).label}`).join("")}`,
|
|
1234
|
+
"supported rate types": this.supportedRateTypes.map((rt) => (0, import_safe3.getEnumMemberName)(import_Types.RateType, rt)).join(", ")
|
|
1235
|
+
};
|
|
1236
|
+
return {
|
|
1237
|
+
...super.toLogEntry(ctx),
|
|
1238
|
+
message
|
|
1239
|
+
};
|
|
1203
1240
|
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1241
|
+
};
|
|
1242
|
+
return MeterCCSupportedReport2 = _classThis;
|
|
1243
|
+
})();
|
|
1244
|
+
let MeterCCSupportedGet = (() => {
|
|
1245
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.SupportedGet), (0, import_CommandClassDecorators.expectedCCResponse)(MeterCCSupportedReport)];
|
|
1246
|
+
let _classDescriptor;
|
|
1247
|
+
let _classExtraInitializers = [];
|
|
1248
|
+
let _classThis;
|
|
1249
|
+
let _classSuper = MeterCC;
|
|
1250
|
+
var MeterCCSupportedGet2 = class extends _classSuper {
|
|
1251
|
+
static {
|
|
1252
|
+
_classThis = this;
|
|
1206
1253
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1254
|
+
static {
|
|
1255
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1256
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1257
|
+
MeterCCSupportedGet2 = _classThis = _classDescriptor.value;
|
|
1258
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1259
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1209
1260
|
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1261
|
+
};
|
|
1262
|
+
return MeterCCSupportedGet2 = _classThis;
|
|
1263
|
+
})();
|
|
1264
|
+
let MeterCCReset = (() => {
|
|
1265
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.Reset), (0, import_CommandClassDecorators.useSupervision)()];
|
|
1266
|
+
let _classDescriptor;
|
|
1267
|
+
let _classExtraInitializers = [];
|
|
1268
|
+
let _classThis;
|
|
1269
|
+
let _classSuper = MeterCC;
|
|
1270
|
+
var MeterCCReset2 = class extends _classSuper {
|
|
1271
|
+
static {
|
|
1272
|
+
_classThis = this;
|
|
1212
1273
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1274
|
+
static {
|
|
1275
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1276
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1277
|
+
MeterCCReset2 = _classThis = _classDescriptor.value;
|
|
1278
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1279
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1280
|
+
}
|
|
1281
|
+
constructor(options) {
|
|
1282
|
+
super(options);
|
|
1283
|
+
this.type = options.type;
|
|
1284
|
+
this.scale = options.scale;
|
|
1285
|
+
this.rateType = options.rateType;
|
|
1286
|
+
this.targetValue = options.targetValue;
|
|
1287
|
+
}
|
|
1288
|
+
static from(raw, ctx) {
|
|
1289
|
+
if (raw.payload.length === 0) {
|
|
1290
|
+
return new this({
|
|
1291
|
+
nodeId: ctx.sourceNodeId
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
const { type, rateType, scale1, value: targetValue, bytesRead: scale2Offset } = parseMeterValueAndInfo(raw.payload, 0);
|
|
1295
|
+
const scale = parseScale(scale1, raw.payload, scale2Offset);
|
|
1296
|
+
return new this({
|
|
1297
|
+
nodeId: ctx.sourceNodeId,
|
|
1298
|
+
type,
|
|
1299
|
+
rateType,
|
|
1300
|
+
targetValue,
|
|
1301
|
+
scale
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
type;
|
|
1305
|
+
scale;
|
|
1306
|
+
rateType;
|
|
1307
|
+
targetValue;
|
|
1308
|
+
serialize(ctx) {
|
|
1309
|
+
if (this.type != void 0 && this.scale != void 0 && this.rateType != void 0 && this.targetValue != void 0) {
|
|
1310
|
+
const { data: typeAndValue, scale2 } = encodeMeterValueAndInfo(this.type, this.rateType, this.scale, this.targetValue);
|
|
1311
|
+
this.payload = typeAndValue;
|
|
1312
|
+
if (scale2 != void 0) {
|
|
1313
|
+
this.payload = import_safe2.Bytes.concat([
|
|
1314
|
+
this.payload,
|
|
1315
|
+
import_safe2.Bytes.from([scale2])
|
|
1316
|
+
]);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
return super.serialize(ctx);
|
|
1320
|
+
}
|
|
1321
|
+
toLogEntry(ctx) {
|
|
1322
|
+
const message = {};
|
|
1323
|
+
if (this.type != void 0) {
|
|
1324
|
+
message.type = (0, import_core.getMeterName)(this.type);
|
|
1325
|
+
}
|
|
1326
|
+
if (this.rateType != void 0) {
|
|
1327
|
+
message["rate type"] = (0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType);
|
|
1328
|
+
}
|
|
1329
|
+
if (this.type != void 0 && this.scale != void 0) {
|
|
1330
|
+
message.scale = ((0, import_core.getMeterScale)(this.type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale)).label;
|
|
1331
|
+
}
|
|
1332
|
+
if (this.targetValue != void 0) {
|
|
1333
|
+
message["target value"] = this.targetValue;
|
|
1334
|
+
}
|
|
1335
|
+
return {
|
|
1336
|
+
...super.toLogEntry(ctx),
|
|
1337
|
+
message
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
return MeterCCReset2 = _classThis;
|
|
1342
|
+
})();
|
|
1223
1343
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1224
1344
|
0 && (module.exports = {
|
|
1225
1345
|
MeterCC,
|