@zwave-js/cc 14.0.0-beta.4 → 14.0.0-beta.5
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
|
@@ -1,10 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
6
34
|
};
|
|
7
|
-
var NotificationCC_1, NotificationCCSet_1, NotificationCCReport_1, NotificationCCGet_1, NotificationCCSupportedReport_1, NotificationCCEventSupportedReport_1, NotificationCCEventSupportedGet_1;
|
|
8
35
|
function __assertType(argName, typeName, boundHasError) {
|
|
9
36
|
const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
|
|
10
37
|
if (boundHasError()) {
|
|
@@ -123,7 +150,7 @@ import { buffer2hex, num2hex, pick } from "@zwave-js/shared/safe";
|
|
|
123
150
|
import { isArray } from "alcalzone-shared/typeguards/index.js";
|
|
124
151
|
import { CCAPI, POLL_VALUE, PhysicalCCAPI, throwUnsupportedProperty, } from "../lib/API.js";
|
|
125
152
|
import { CCRaw, CommandClass, InvalidCC, getEffectiveCCVersion, } from "../lib/CommandClass.js";
|
|
126
|
-
import { API, CCCommand,
|
|
153
|
+
import { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
|
|
127
154
|
import { isNotificationEventPayload } from "../lib/NotificationEventPayload.js";
|
|
128
155
|
import { V } from "../lib/Values.js";
|
|
129
156
|
import { NotificationCommand, UserCodeCommand } from "../lib/_Types.js";
|
|
@@ -229,116 +256,129 @@ function shouldAutoCreateSimpleDoorSensorValue(ctx, endpoint) {
|
|
|
229
256
|
// Window/door is closed
|
|
230
257
|
0x17));
|
|
231
258
|
}
|
|
232
|
-
let NotificationCCAPI =
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
259
|
+
let NotificationCCAPI = (() => {
|
|
260
|
+
let _classDecorators = [API(CommandClasses.Notification)];
|
|
261
|
+
let _classDescriptor;
|
|
262
|
+
let _classExtraInitializers = [];
|
|
263
|
+
let _classThis;
|
|
264
|
+
let _classSuper = PhysicalCCAPI;
|
|
265
|
+
var NotificationCCAPI = class extends _classSuper {
|
|
266
|
+
static { _classThis = this; }
|
|
267
|
+
static {
|
|
268
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
269
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
270
|
+
NotificationCCAPI = _classThis = _classDescriptor.value;
|
|
271
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
272
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
273
|
+
}
|
|
274
|
+
supportsCommand(cmd) {
|
|
275
|
+
switch (cmd) {
|
|
276
|
+
case NotificationCommand.Report:
|
|
277
|
+
case NotificationCommand.Get:
|
|
278
|
+
return true; // These exist starting with V1
|
|
279
|
+
case NotificationCommand.Set:
|
|
280
|
+
case NotificationCommand.SupportedGet:
|
|
281
|
+
return this.version >= 2;
|
|
282
|
+
case NotificationCommand.EventSupportedGet:
|
|
283
|
+
return this.version >= 3;
|
|
284
|
+
}
|
|
285
|
+
return super.supportsCommand(cmd);
|
|
286
|
+
}
|
|
287
|
+
get [POLL_VALUE]() {
|
|
288
|
+
return async function ({ property, propertyKey }) {
|
|
289
|
+
const valueId = {
|
|
290
|
+
commandClass: this.ccId,
|
|
291
|
+
endpoint: this.endpoint.index,
|
|
292
|
+
property,
|
|
293
|
+
propertyKey,
|
|
294
|
+
};
|
|
295
|
+
if (NotificationCCValues.notificationVariable.is(valueId)) {
|
|
296
|
+
const notificationType = this
|
|
297
|
+
.tryGetValueDB()?.getMetadata(valueId)?.ccSpecific
|
|
298
|
+
?.notificationType;
|
|
299
|
+
if (notificationType != undefined) {
|
|
300
|
+
return this.getInternal({ notificationType });
|
|
301
|
+
}
|
|
260
302
|
}
|
|
303
|
+
throwUnsupportedProperty(this.ccId, property);
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* @internal
|
|
308
|
+
*/
|
|
309
|
+
async getInternal(options) {
|
|
310
|
+
this.assertSupportsCommand(NotificationCommand, NotificationCommand.Get);
|
|
311
|
+
const cc = new NotificationCCGet({
|
|
312
|
+
nodeId: this.endpoint.nodeId,
|
|
313
|
+
endpointIndex: this.endpoint.index,
|
|
314
|
+
...options,
|
|
315
|
+
});
|
|
316
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
317
|
+
}
|
|
318
|
+
async sendReport(options) {
|
|
319
|
+
__assertType("options", "NotificationCCReportOptions", __assertType__NotificationCCReportOptions.bind(void 0, options));
|
|
320
|
+
this.assertSupportsCommand(NotificationCommand, NotificationCommand.Report);
|
|
321
|
+
const cc = new NotificationCCReport({
|
|
322
|
+
nodeId: this.endpoint.nodeId,
|
|
323
|
+
endpointIndex: this.endpoint.index,
|
|
324
|
+
...options,
|
|
325
|
+
});
|
|
326
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
327
|
+
}
|
|
328
|
+
async get(options) {
|
|
329
|
+
__assertType("options", "NotificationCCGetOptions", __assertType__NotificationCCGetOptions.bind(void 0, options));
|
|
330
|
+
const response = await this.getInternal(options);
|
|
331
|
+
if (response) {
|
|
332
|
+
return pick(response, [
|
|
333
|
+
"notificationStatus",
|
|
334
|
+
"notificationEvent",
|
|
335
|
+
"alarmLevel",
|
|
336
|
+
"eventParameters",
|
|
337
|
+
"sequenceNumber",
|
|
338
|
+
]);
|
|
261
339
|
}
|
|
262
|
-
throwUnsupportedProperty(this.ccId, property);
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* @internal
|
|
267
|
-
*/
|
|
268
|
-
async getInternal(options) {
|
|
269
|
-
this.assertSupportsCommand(NotificationCommand, NotificationCommand.Get);
|
|
270
|
-
const cc = new NotificationCCGet({
|
|
271
|
-
nodeId: this.endpoint.nodeId,
|
|
272
|
-
endpointIndex: this.endpoint.index,
|
|
273
|
-
...options,
|
|
274
|
-
});
|
|
275
|
-
return this.host.sendCommand(cc, this.commandOptions);
|
|
276
|
-
}
|
|
277
|
-
async sendReport(options) {
|
|
278
|
-
__assertType("options", "NotificationCCReportOptions", __assertType__NotificationCCReportOptions.bind(void 0, options));
|
|
279
|
-
this.assertSupportsCommand(NotificationCommand, NotificationCommand.Report);
|
|
280
|
-
const cc = new NotificationCCReport({
|
|
281
|
-
nodeId: this.endpoint.nodeId,
|
|
282
|
-
endpointIndex: this.endpoint.index,
|
|
283
|
-
...options,
|
|
284
|
-
});
|
|
285
|
-
return this.host.sendCommand(cc, this.commandOptions);
|
|
286
|
-
}
|
|
287
|
-
async get(options) {
|
|
288
|
-
__assertType("options", "NotificationCCGetOptions", __assertType__NotificationCCGetOptions.bind(void 0, options));
|
|
289
|
-
const response = await this.getInternal(options);
|
|
290
|
-
if (response) {
|
|
291
|
-
return pick(response, [
|
|
292
|
-
"notificationStatus",
|
|
293
|
-
"notificationEvent",
|
|
294
|
-
"alarmLevel",
|
|
295
|
-
"eventParameters",
|
|
296
|
-
"sequenceNumber",
|
|
297
|
-
]);
|
|
298
340
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
return this.host.sendCommand(cc, this.commandOptions);
|
|
311
|
-
}
|
|
312
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
313
|
-
async getSupported() {
|
|
314
|
-
this.assertSupportsCommand(NotificationCommand, NotificationCommand.SupportedGet);
|
|
315
|
-
const cc = new NotificationCCSupportedGet({
|
|
316
|
-
nodeId: this.endpoint.nodeId,
|
|
317
|
-
endpointIndex: this.endpoint.index,
|
|
318
|
-
});
|
|
319
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
320
|
-
if (response) {
|
|
321
|
-
return pick(response, [
|
|
322
|
-
"supportsV1Alarm",
|
|
323
|
-
"supportedNotificationTypes",
|
|
324
|
-
]);
|
|
341
|
+
async set(notificationType, notificationStatus) {
|
|
342
|
+
__assertType("notificationType", "number", __assertType__number.bind(void 0, notificationType));
|
|
343
|
+
__assertType("notificationStatus", "boolean", __assertType__boolean.bind(void 0, notificationStatus));
|
|
344
|
+
this.assertSupportsCommand(NotificationCommand, NotificationCommand.Set);
|
|
345
|
+
const cc = new NotificationCCSet({
|
|
346
|
+
nodeId: this.endpoint.nodeId,
|
|
347
|
+
endpointIndex: this.endpoint.index,
|
|
348
|
+
notificationType,
|
|
349
|
+
notificationStatus,
|
|
350
|
+
});
|
|
351
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
325
352
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
353
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
354
|
+
async getSupported() {
|
|
355
|
+
this.assertSupportsCommand(NotificationCommand, NotificationCommand.SupportedGet);
|
|
356
|
+
const cc = new NotificationCCSupportedGet({
|
|
357
|
+
nodeId: this.endpoint.nodeId,
|
|
358
|
+
endpointIndex: this.endpoint.index,
|
|
359
|
+
});
|
|
360
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
361
|
+
if (response) {
|
|
362
|
+
return pick(response, [
|
|
363
|
+
"supportsV1Alarm",
|
|
364
|
+
"supportedNotificationTypes",
|
|
365
|
+
]);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
async getSupportedEvents(notificationType) {
|
|
369
|
+
__assertType("notificationType", "number", __assertType__number.bind(void 0, notificationType));
|
|
370
|
+
this.assertSupportsCommand(NotificationCommand, NotificationCommand.EventSupportedGet);
|
|
371
|
+
const cc = new NotificationCCEventSupportedGet({
|
|
372
|
+
nodeId: this.endpoint.nodeId,
|
|
373
|
+
endpointIndex: this.endpoint.index,
|
|
374
|
+
notificationType,
|
|
375
|
+
});
|
|
376
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
377
|
+
return response?.supportedEvents;
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
return NotificationCCAPI = _classThis;
|
|
381
|
+
})();
|
|
342
382
|
export { NotificationCCAPI };
|
|
343
383
|
export function getNotificationEnumBehavior(notification, valueConfig) {
|
|
344
384
|
const variable = notification.variables.find((v) => v.states.has(valueConfig.value));
|
|
@@ -389,184 +429,199 @@ export function getNotificationValueMetadata(previous, notification, valueConfig
|
|
|
389
429
|
}
|
|
390
430
|
return metadata;
|
|
391
431
|
}
|
|
392
|
-
let NotificationCC =
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
if (!node.supportsCC(CommandClasses.Association))
|
|
407
|
-
return "pull";
|
|
408
|
-
if (node.supportsCC(CommandClasses["Association Group Information"])) {
|
|
409
|
-
try {
|
|
410
|
-
const groupsIssueingNotifications = AssociationGroupInfoCC
|
|
411
|
-
.findGroupsForIssuedCommand(ctx, node, this.ccId, NotificationCommand.Report);
|
|
412
|
-
return groupsIssueingNotifications.length > 0 ? "push" : "pull";
|
|
413
|
-
}
|
|
414
|
-
catch {
|
|
415
|
-
// We might be dealing with an older cache file, fall back to testing
|
|
416
|
-
}
|
|
432
|
+
let NotificationCC = (() => {
|
|
433
|
+
let _classDecorators = [commandClass(CommandClasses.Notification), implementedVersion(8), ccValues(NotificationCCValues)];
|
|
434
|
+
let _classDescriptor;
|
|
435
|
+
let _classExtraInitializers = [];
|
|
436
|
+
let _classThis;
|
|
437
|
+
let _classSuper = CommandClass;
|
|
438
|
+
var NotificationCC = class extends _classSuper {
|
|
439
|
+
static { _classThis = this; }
|
|
440
|
+
static {
|
|
441
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
442
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
443
|
+
NotificationCC = _classThis = _classDescriptor.value;
|
|
444
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
445
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
417
446
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
447
|
+
// former AlarmCC (v1..v2)
|
|
448
|
+
determineRequiredCCInterviews() {
|
|
449
|
+
return [
|
|
450
|
+
...super.determineRequiredCCInterviews(),
|
|
451
|
+
CommandClasses.Association,
|
|
452
|
+
CommandClasses["Multi Channel Association"],
|
|
453
|
+
CommandClasses["Association Group Information"],
|
|
454
|
+
];
|
|
455
|
+
}
|
|
456
|
+
async determineNotificationMode(ctx, api, supportedNotificationEvents) {
|
|
457
|
+
const node = this.getNode(ctx);
|
|
458
|
+
// SDS14223: If the supporting node does not support the Association Command Class,
|
|
459
|
+
// it may be concluded that the supporting node implements Pull Mode and discovery may be aborted.
|
|
460
|
+
if (!node.supportsCC(CommandClasses.Association))
|
|
461
|
+
return "pull";
|
|
462
|
+
if (node.supportsCC(CommandClasses["Association Group Information"])) {
|
|
463
|
+
try {
|
|
464
|
+
const groupsIssueingNotifications = AssociationGroupInfoCC
|
|
465
|
+
.findGroupsForIssuedCommand(ctx, node, this.ccId, NotificationCommand.Report);
|
|
466
|
+
return groupsIssueingNotifications.length > 0 ? "push" : "pull";
|
|
467
|
+
}
|
|
468
|
+
catch {
|
|
469
|
+
// We might be dealing with an older cache file, fall back to testing
|
|
440
470
|
}
|
|
441
471
|
}
|
|
442
|
-
catch {
|
|
443
|
-
/* ignore */
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
// If everything failed, e.g. because the node is V1/V2, assume this is a "push" node.
|
|
447
|
-
// If we assumed "pull", we would have to query the node regularly, which can cause
|
|
448
|
-
// the node to return old (already handled) notifications.
|
|
449
|
-
// https://github.com/zwave-js/node-zwave-js/issues/5626
|
|
450
|
-
return "push";
|
|
451
|
-
}
|
|
452
|
-
/** Whether the node implements push or pull notifications */
|
|
453
|
-
static getNotificationMode(ctx, node) {
|
|
454
|
-
return ctx
|
|
455
|
-
.getValueDB(node.id)
|
|
456
|
-
.getValue(NotificationCCValues.notificationMode.id);
|
|
457
|
-
}
|
|
458
|
-
async interview(ctx) {
|
|
459
|
-
const node = this.getNode(ctx);
|
|
460
|
-
const endpoint = this.getEndpoint(ctx);
|
|
461
|
-
const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({
|
|
462
|
-
priority: MessagePriority.NodeQuery,
|
|
463
|
-
});
|
|
464
|
-
ctx.logNode(node.id, {
|
|
465
|
-
endpoint: this.endpointIndex,
|
|
466
|
-
message: `Interviewing ${this.ccName}...`,
|
|
467
|
-
direction: "none",
|
|
468
|
-
});
|
|
469
|
-
// If one Association group issues Notification Reports,
|
|
470
|
-
// we must associate ourselves with that channel
|
|
471
|
-
try {
|
|
472
|
-
await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, NotificationCommand.Report);
|
|
473
|
-
}
|
|
474
|
-
catch {
|
|
475
472
|
ctx.logNode(node.id, {
|
|
476
|
-
endpoint:
|
|
477
|
-
message: `
|
|
478
|
-
|
|
473
|
+
endpoint: this.endpointIndex,
|
|
474
|
+
message: `determining whether this node is pull or push...`,
|
|
475
|
+
direction: "outbound",
|
|
479
476
|
});
|
|
477
|
+
// Find a notification type with at least one supported event
|
|
478
|
+
for (const [type, events] of supportedNotificationEvents) {
|
|
479
|
+
if (events.length === 0)
|
|
480
|
+
continue;
|
|
481
|
+
// Enable the event and request the status
|
|
482
|
+
await api.set(type, true);
|
|
483
|
+
try {
|
|
484
|
+
const resp = await api.get({
|
|
485
|
+
notificationType: type,
|
|
486
|
+
notificationEvent: events[0],
|
|
487
|
+
});
|
|
488
|
+
switch (resp?.notificationStatus) {
|
|
489
|
+
case 0xff:
|
|
490
|
+
return "push";
|
|
491
|
+
case 0xfe:
|
|
492
|
+
case 0x00:
|
|
493
|
+
return "pull";
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
catch {
|
|
497
|
+
/* ignore */
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
// If everything failed, e.g. because the node is V1/V2, assume this is a "push" node.
|
|
501
|
+
// If we assumed "pull", we would have to query the node regularly, which can cause
|
|
502
|
+
// the node to return old (already handled) notifications.
|
|
503
|
+
// https://github.com/zwave-js/node-zwave-js/issues/5626
|
|
504
|
+
return "push";
|
|
505
|
+
}
|
|
506
|
+
/** Whether the node implements push or pull notifications */
|
|
507
|
+
static getNotificationMode(ctx, node) {
|
|
508
|
+
return ctx
|
|
509
|
+
.getValueDB(node.id)
|
|
510
|
+
.getValue(NotificationCCValues.notificationMode.id);
|
|
480
511
|
}
|
|
481
|
-
|
|
482
|
-
|
|
512
|
+
async interview(ctx) {
|
|
513
|
+
const node = this.getNode(ctx);
|
|
514
|
+
const endpoint = this.getEndpoint(ctx);
|
|
515
|
+
const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({
|
|
516
|
+
priority: MessagePriority.NodeQuery,
|
|
517
|
+
});
|
|
483
518
|
ctx.logNode(node.id, {
|
|
484
519
|
endpoint: this.endpointIndex,
|
|
485
|
-
message:
|
|
486
|
-
direction: "
|
|
520
|
+
message: `Interviewing ${this.ccName}...`,
|
|
521
|
+
direction: "none",
|
|
487
522
|
});
|
|
488
|
-
|
|
489
|
-
|
|
523
|
+
// If one Association group issues Notification Reports,
|
|
524
|
+
// we must associate ourselves with that channel
|
|
525
|
+
try {
|
|
526
|
+
await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, NotificationCommand.Report);
|
|
527
|
+
}
|
|
528
|
+
catch {
|
|
490
529
|
ctx.logNode(node.id, {
|
|
491
|
-
endpoint:
|
|
492
|
-
message:
|
|
530
|
+
endpoint: endpoint.index,
|
|
531
|
+
message: `Configuring associations to receive ${getCCName(this.ccId)} reports failed!`,
|
|
493
532
|
level: "warn",
|
|
494
533
|
});
|
|
495
|
-
return;
|
|
496
534
|
}
|
|
497
|
-
supportsV1Alarm =
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
message: logMessage,
|
|
507
|
-
direction: "inbound",
|
|
508
|
-
});
|
|
509
|
-
if (api.version >= 3) {
|
|
510
|
-
// Query each notification for its supported events
|
|
511
|
-
for (let i = 0; i < supportedNotificationTypes.length; i++) {
|
|
512
|
-
const type = supportedNotificationTypes[i];
|
|
513
|
-
const name = supportedNotificationNames[i];
|
|
535
|
+
let supportsV1Alarm = false;
|
|
536
|
+
if (api.version >= 2) {
|
|
537
|
+
ctx.logNode(node.id, {
|
|
538
|
+
endpoint: this.endpointIndex,
|
|
539
|
+
message: "querying supported notification types...",
|
|
540
|
+
direction: "outbound",
|
|
541
|
+
});
|
|
542
|
+
const suppResponse = await api.getSupported();
|
|
543
|
+
if (!suppResponse) {
|
|
514
544
|
ctx.logNode(node.id, {
|
|
515
545
|
endpoint: this.endpointIndex,
|
|
516
|
-
message:
|
|
517
|
-
|
|
546
|
+
message: "Querying supported notification types timed out, skipping interview...",
|
|
547
|
+
level: "warn",
|
|
518
548
|
});
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
supportsV1Alarm = suppResponse.supportsV1Alarm;
|
|
552
|
+
const supportedNotificationTypes = suppResponse.supportedNotificationTypes;
|
|
553
|
+
const supportedNotificationNames = supportedNotificationTypes.map(getNotificationName);
|
|
554
|
+
const supportedNotificationEvents = new Map();
|
|
555
|
+
const logMessage = `received supported notification types:${supportedNotificationNames
|
|
556
|
+
.map((name) => `\n· ${name}`)
|
|
557
|
+
.join("")}`;
|
|
558
|
+
ctx.logNode(node.id, {
|
|
559
|
+
endpoint: this.endpointIndex,
|
|
560
|
+
message: logMessage,
|
|
561
|
+
direction: "inbound",
|
|
562
|
+
});
|
|
563
|
+
if (api.version >= 3) {
|
|
564
|
+
// Query each notification for its supported events
|
|
565
|
+
for (let i = 0; i < supportedNotificationTypes.length; i++) {
|
|
566
|
+
const type = supportedNotificationTypes[i];
|
|
567
|
+
const name = supportedNotificationNames[i];
|
|
522
568
|
ctx.logNode(node.id, {
|
|
523
569
|
endpoint: this.endpointIndex,
|
|
524
|
-
message: `
|
|
525
|
-
|
|
526
|
-
.join(", ")}`,
|
|
527
|
-
direction: "inbound",
|
|
570
|
+
message: `querying supported notification events for ${name}...`,
|
|
571
|
+
direction: "outbound",
|
|
528
572
|
});
|
|
573
|
+
const supportedEvents = await api.getSupportedEvents(type);
|
|
574
|
+
if (supportedEvents) {
|
|
575
|
+
supportedNotificationEvents.set(type, supportedEvents);
|
|
576
|
+
ctx.logNode(node.id, {
|
|
577
|
+
endpoint: this.endpointIndex,
|
|
578
|
+
message: `received supported notification events for ${name}: ${supportedEvents
|
|
579
|
+
.map(String)
|
|
580
|
+
.join(", ")}`,
|
|
581
|
+
direction: "inbound",
|
|
582
|
+
});
|
|
583
|
+
}
|
|
529
584
|
}
|
|
530
585
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
586
|
+
// Determine whether the node is a push or pull node
|
|
587
|
+
let notificationMode = this.getValue(ctx, NotificationCCValues.notificationMode);
|
|
588
|
+
if (notificationMode !== "push" && notificationMode !== "pull") {
|
|
589
|
+
notificationMode = await this.determineNotificationMode(ctx, api, supportedNotificationEvents);
|
|
590
|
+
this.setValue(ctx, NotificationCCValues.notificationMode, notificationMode);
|
|
591
|
+
}
|
|
592
|
+
if (notificationMode === "pull") {
|
|
593
|
+
await this.refreshValues(ctx);
|
|
594
|
+
} /* if (notificationMode === "push") */
|
|
595
|
+
else {
|
|
596
|
+
for (let i = 0; i < supportedNotificationTypes.length; i++) {
|
|
597
|
+
const type = supportedNotificationTypes[i];
|
|
598
|
+
const name = supportedNotificationNames[i];
|
|
599
|
+
const notification = getNotification(type);
|
|
600
|
+
// Enable reports for each notification type
|
|
601
|
+
ctx.logNode(node.id, {
|
|
602
|
+
endpoint: this.endpointIndex,
|
|
603
|
+
message: `enabling notifications for ${name}...`,
|
|
604
|
+
direction: "outbound",
|
|
605
|
+
});
|
|
606
|
+
await api.set(type, true);
|
|
607
|
+
// Set the value to idle if possible and there is no value yet
|
|
608
|
+
if (notification) {
|
|
609
|
+
const events = supportedNotificationEvents.get(type);
|
|
610
|
+
if (events) {
|
|
611
|
+
// Find all variables that are supported by this node and have an idle state
|
|
612
|
+
for (const variable of notification.variables
|
|
613
|
+
.filter((v) => !!v.idle)) {
|
|
614
|
+
if ([...variable.states.keys()].some((key) => events.includes(key))) {
|
|
615
|
+
const value = NotificationCCValues
|
|
616
|
+
.notificationVariable(notification.name, variable.name);
|
|
617
|
+
// Set the value to idle if it has no value yet
|
|
618
|
+
// TODO: GH#1028
|
|
619
|
+
// * do this only if the last update was more than 5 minutes ago
|
|
620
|
+
// * schedule an auto-idle if the last update was less than 5 minutes ago but before the current applHost start
|
|
621
|
+
if (this.getValue(ctx, value)
|
|
622
|
+
== undefined) {
|
|
623
|
+
this.setValue(ctx, value, 0);
|
|
624
|
+
}
|
|
570
625
|
}
|
|
571
626
|
}
|
|
572
627
|
}
|
|
@@ -574,777 +629,853 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
|
|
|
574
629
|
}
|
|
575
630
|
}
|
|
576
631
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
.
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
632
|
+
// Only create metadata for V1 values if necessary
|
|
633
|
+
if (api.version === 1 || supportsV1Alarm) {
|
|
634
|
+
this.ensureMetadata(ctx, NotificationCCValues.alarmType);
|
|
635
|
+
this.ensureMetadata(ctx, NotificationCCValues.alarmLevel);
|
|
636
|
+
}
|
|
637
|
+
// Also create metadata for values mapped through compat config
|
|
638
|
+
const mappings = ctx.getDeviceConfig?.(this.nodeId)
|
|
639
|
+
?.compat?.alarmMapping;
|
|
640
|
+
if (mappings) {
|
|
641
|
+
// Find all mappings to a valid notification variable
|
|
642
|
+
const supportedNotifications = new Map();
|
|
643
|
+
for (const { to } of mappings) {
|
|
644
|
+
const notification = getNotification(to.notificationType);
|
|
645
|
+
if (!notification)
|
|
646
|
+
continue;
|
|
647
|
+
const valueConfig = getNotificationValue(notification, to.notificationEvent);
|
|
648
|
+
// Remember supported notification types and events to create the internal values later
|
|
649
|
+
if (!supportedNotifications.has(to.notificationType)) {
|
|
650
|
+
supportedNotifications.set(to.notificationType, new Set());
|
|
651
|
+
}
|
|
652
|
+
const supportedNotificationTypesSet = supportedNotifications
|
|
653
|
+
.get(to.notificationType);
|
|
654
|
+
supportedNotificationTypesSet.add(to.notificationEvent);
|
|
655
|
+
if (valueConfig?.type !== "state")
|
|
656
|
+
continue;
|
|
657
|
+
const notificationValue = NotificationCCValues
|
|
658
|
+
.notificationVariable(notification.name, valueConfig.variableName);
|
|
659
|
+
// Create or update the metadata
|
|
660
|
+
const metadata = getNotificationValueMetadata(this.getMetadata(ctx, notificationValue), notification, valueConfig);
|
|
661
|
+
this.setMetadata(ctx, notificationValue, metadata);
|
|
662
|
+
// Set the value to idle if it has no value yet
|
|
663
|
+
if (valueConfig.idle) {
|
|
664
|
+
// TODO: GH#1028
|
|
665
|
+
// * do this only if the last update was more than 5 minutes ago
|
|
666
|
+
// * schedule an auto-idle if the last update was less than 5 minutes ago but before the current applHost start
|
|
667
|
+
if (this.getValue(ctx, notificationValue) == undefined) {
|
|
668
|
+
this.setValue(ctx, notificationValue, 0);
|
|
669
|
+
}
|
|
615
670
|
}
|
|
616
671
|
}
|
|
672
|
+
// Remember supported notification types and events in the cache
|
|
673
|
+
this.setValue(ctx, NotificationCCValues.supportedNotificationTypes, [...supportedNotifications.keys()]);
|
|
674
|
+
for (const [type, events] of supportedNotifications) {
|
|
675
|
+
this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);
|
|
676
|
+
}
|
|
617
677
|
}
|
|
618
|
-
// Remember
|
|
619
|
-
this.
|
|
620
|
-
for (const [type, events] of supportedNotifications) {
|
|
621
|
-
this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);
|
|
622
|
-
}
|
|
678
|
+
// Remember that the interview is complete
|
|
679
|
+
this.setInterviewComplete(ctx, true);
|
|
623
680
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
const endpoint = this.getEndpoint(ctx);
|
|
632
|
-
const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({
|
|
633
|
-
priority: MessagePriority.NodeQuery,
|
|
634
|
-
});
|
|
635
|
-
// Load supported notification types and events from cache
|
|
636
|
-
const supportedNotificationTypes = this.getValue(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];
|
|
637
|
-
const supportedNotificationNames = supportedNotificationTypes.map(getNotificationName);
|
|
638
|
-
for (let i = 0; i < supportedNotificationTypes.length; i++) {
|
|
639
|
-
const type = supportedNotificationTypes[i];
|
|
640
|
-
const name = supportedNotificationNames[i];
|
|
641
|
-
// Always query each notification for its current status
|
|
642
|
-
ctx.logNode(node.id, {
|
|
643
|
-
endpoint: this.endpointIndex,
|
|
644
|
-
message: `querying notification status for ${name}...`,
|
|
645
|
-
direction: "outbound",
|
|
646
|
-
});
|
|
647
|
-
const response = await api.getInternal({
|
|
648
|
-
notificationType: type,
|
|
681
|
+
async refreshValues(ctx) {
|
|
682
|
+
const node = this.getNode(ctx);
|
|
683
|
+
// Refreshing values only works on pull nodes
|
|
684
|
+
if (NotificationCC.getNotificationMode(ctx, node) === "pull") {
|
|
685
|
+
const endpoint = this.getEndpoint(ctx);
|
|
686
|
+
const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({
|
|
687
|
+
priority: MessagePriority.NodeQuery,
|
|
649
688
|
});
|
|
650
|
-
//
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
689
|
+
// Load supported notification types and events from cache
|
|
690
|
+
const supportedNotificationTypes = this.getValue(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];
|
|
691
|
+
const supportedNotificationNames = supportedNotificationTypes.map(getNotificationName);
|
|
692
|
+
for (let i = 0; i < supportedNotificationTypes.length; i++) {
|
|
693
|
+
const type = supportedNotificationTypes[i];
|
|
694
|
+
const name = supportedNotificationNames[i];
|
|
695
|
+
// Always query each notification for its current status
|
|
696
|
+
ctx.logNode(node.id, {
|
|
697
|
+
endpoint: this.endpointIndex,
|
|
698
|
+
message: `querying notification status for ${name}...`,
|
|
699
|
+
direction: "outbound",
|
|
700
|
+
});
|
|
701
|
+
const response = await api.getInternal({
|
|
702
|
+
notificationType: type,
|
|
703
|
+
});
|
|
704
|
+
// NotificationReports don't store their values themselves,
|
|
705
|
+
// because the behaviour is too complex and spans the lifetime
|
|
706
|
+
// of several reports. Thus we handle it in the Node instance
|
|
707
|
+
// @ts-expect-error
|
|
708
|
+
if (response)
|
|
709
|
+
await node.handleCommand(response);
|
|
710
|
+
}
|
|
711
|
+
// Remember when we did this
|
|
712
|
+
this.setValue(ctx, NotificationCCValues.lastRefresh, Date.now());
|
|
656
713
|
}
|
|
657
|
-
// Remember when we did this
|
|
658
|
-
this.setValue(ctx, NotificationCCValues.lastRefresh, Date.now());
|
|
659
714
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
commandClass(CommandClasses.Notification),
|
|
673
|
-
implementedVersion(8),
|
|
674
|
-
ccValues(NotificationCCValues)
|
|
675
|
-
], NotificationCC);
|
|
715
|
+
shouldRefreshValues(ctx) {
|
|
716
|
+
// Pull-mode nodes must be polled regularly
|
|
717
|
+
const isPullMode = NotificationCC.getNotificationMode(ctx, this.getNode(ctx)) === "pull";
|
|
718
|
+
if (!isPullMode)
|
|
719
|
+
return false;
|
|
720
|
+
const lastUpdated = this.getValue(ctx, NotificationCCValues.lastRefresh);
|
|
721
|
+
return (lastUpdated == undefined
|
|
722
|
+
|| Date.now() - lastUpdated > timespan.hours(6));
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
return NotificationCC = _classThis;
|
|
726
|
+
})();
|
|
676
727
|
export { NotificationCC };
|
|
677
|
-
let NotificationCCSet =
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
notificationStatus;
|
|
695
|
-
serialize(ctx) {
|
|
696
|
-
this.payload = Bytes.from([
|
|
697
|
-
this.notificationType,
|
|
698
|
-
this.notificationStatus ? 0xff : 0x00,
|
|
699
|
-
]);
|
|
700
|
-
return super.serialize(ctx);
|
|
701
|
-
}
|
|
702
|
-
toLogEntry(ctx) {
|
|
703
|
-
return {
|
|
704
|
-
...super.toLogEntry(ctx),
|
|
705
|
-
message: {
|
|
706
|
-
"notification type": getNotificationName(this.notificationType),
|
|
707
|
-
status: this.notificationStatus,
|
|
708
|
-
},
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
NotificationCCSet = NotificationCCSet_1 = __decorate([
|
|
713
|
-
CCCommand(NotificationCommand.Set),
|
|
714
|
-
useSupervision()
|
|
715
|
-
], NotificationCCSet);
|
|
716
|
-
export { NotificationCCSet };
|
|
717
|
-
let NotificationCCReport = NotificationCCReport_1 = class NotificationCCReport extends NotificationCC {
|
|
718
|
-
constructor(options) {
|
|
719
|
-
super(options);
|
|
720
|
-
if (options.alarmType != undefined) {
|
|
721
|
-
this.alarmType = options.alarmType;
|
|
722
|
-
this.alarmLevel = options.alarmLevel;
|
|
723
|
-
}
|
|
724
|
-
if (options.notificationType != undefined) {
|
|
728
|
+
let NotificationCCSet = (() => {
|
|
729
|
+
let _classDecorators = [CCCommand(NotificationCommand.Set), useSupervision()];
|
|
730
|
+
let _classDescriptor;
|
|
731
|
+
let _classExtraInitializers = [];
|
|
732
|
+
let _classThis;
|
|
733
|
+
let _classSuper = NotificationCC;
|
|
734
|
+
var NotificationCCSet = class extends _classSuper {
|
|
735
|
+
static { _classThis = this; }
|
|
736
|
+
static {
|
|
737
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
738
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
739
|
+
NotificationCCSet = _classThis = _classDescriptor.value;
|
|
740
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
741
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
742
|
+
}
|
|
743
|
+
constructor(options) {
|
|
744
|
+
super(options);
|
|
725
745
|
this.notificationType = options.notificationType;
|
|
726
|
-
this.notificationStatus = options.notificationStatus
|
|
727
|
-
this.notificationEvent = options.notificationEvent;
|
|
728
|
-
this.eventParameters = options.eventParameters;
|
|
729
|
-
this.sequenceNumber = options.sequenceNumber;
|
|
746
|
+
this.notificationStatus = options.notificationStatus;
|
|
730
747
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
748
|
+
static from(raw, ctx) {
|
|
749
|
+
validatePayload(raw.payload.length >= 2);
|
|
750
|
+
const notificationType = raw.payload[0];
|
|
751
|
+
const notificationStatus = raw.payload[1] === 0xff;
|
|
752
|
+
return new this({
|
|
753
|
+
nodeId: ctx.sourceNodeId,
|
|
754
|
+
notificationType,
|
|
755
|
+
notificationStatus,
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
notificationType;
|
|
759
|
+
notificationStatus;
|
|
760
|
+
serialize(ctx) {
|
|
761
|
+
this.payload = Bytes.from([
|
|
762
|
+
this.notificationType,
|
|
763
|
+
this.notificationStatus ? 0xff : 0x00,
|
|
764
|
+
]);
|
|
765
|
+
return super.serialize(ctx);
|
|
766
|
+
}
|
|
767
|
+
toLogEntry(ctx) {
|
|
768
|
+
return {
|
|
769
|
+
...super.toLogEntry(ctx),
|
|
770
|
+
message: {
|
|
771
|
+
"notification type": getNotificationName(this.notificationType),
|
|
772
|
+
status: this.notificationStatus,
|
|
773
|
+
},
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
return NotificationCCSet = _classThis;
|
|
778
|
+
})();
|
|
779
|
+
export { NotificationCCSet };
|
|
780
|
+
let NotificationCCReport = (() => {
|
|
781
|
+
let _classDecorators = [CCCommand(NotificationCommand.Report), useSupervision()];
|
|
782
|
+
let _classDescriptor;
|
|
783
|
+
let _classExtraInitializers = [];
|
|
784
|
+
let _classThis;
|
|
785
|
+
let _classSuper = NotificationCC;
|
|
786
|
+
var NotificationCCReport = class extends _classSuper {
|
|
787
|
+
static { _classThis = this; }
|
|
788
|
+
static {
|
|
789
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
790
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
791
|
+
NotificationCCReport = _classThis = _classDescriptor.value;
|
|
792
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
793
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
794
|
+
}
|
|
795
|
+
constructor(options) {
|
|
796
|
+
super(options);
|
|
797
|
+
if (options.alarmType != undefined) {
|
|
798
|
+
this.alarmType = options.alarmType;
|
|
799
|
+
this.alarmLevel = options.alarmLevel;
|
|
800
|
+
}
|
|
801
|
+
if (options.notificationType != undefined) {
|
|
802
|
+
this.notificationType = options.notificationType;
|
|
803
|
+
this.notificationStatus = options.notificationStatus ?? true;
|
|
804
|
+
this.notificationEvent = options.notificationEvent;
|
|
805
|
+
this.eventParameters = options.eventParameters;
|
|
806
|
+
this.sequenceNumber = options.sequenceNumber;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
static from(raw, ctx) {
|
|
810
|
+
validatePayload(raw.payload.length >= 2);
|
|
811
|
+
const alarmType = raw.payload[0];
|
|
812
|
+
const alarmLevel = raw.payload[1];
|
|
813
|
+
// Byte 2 used to be zensorNetSourceNodeId in V2 and V3, but we don't care about that
|
|
814
|
+
if (raw.payload.length < 7) {
|
|
815
|
+
return new this({
|
|
816
|
+
nodeId: ctx.sourceNodeId,
|
|
817
|
+
alarmType,
|
|
818
|
+
alarmLevel,
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
// V2+ requires the alarm bytes to be zero. Manufacturers don't care though, so we don't enforce that.
|
|
822
|
+
// Don't use the version to decide because we might discard notifications
|
|
823
|
+
// before the interview is complete
|
|
824
|
+
const notificationStatus = raw.payload[3];
|
|
825
|
+
const notificationType = raw.payload[4];
|
|
826
|
+
const notificationEvent = raw.payload[5];
|
|
827
|
+
const containsSeqNum = !!(raw.payload[6] & 0b1000_0000);
|
|
828
|
+
const numEventParams = raw.payload[6] & 0b11111;
|
|
829
|
+
let eventParameters;
|
|
830
|
+
if (numEventParams > 0) {
|
|
831
|
+
validatePayload(raw.payload.length >= 7 + numEventParams);
|
|
832
|
+
eventParameters = raw.payload.subarray(7, 7 + numEventParams);
|
|
833
|
+
}
|
|
834
|
+
let sequenceNumber;
|
|
835
|
+
if (containsSeqNum) {
|
|
836
|
+
validatePayload(raw.payload.length >= 7 + numEventParams + 1);
|
|
837
|
+
sequenceNumber = raw.payload[7 + numEventParams];
|
|
838
|
+
}
|
|
839
|
+
return new this({
|
|
739
840
|
nodeId: ctx.sourceNodeId,
|
|
740
841
|
alarmType,
|
|
741
842
|
alarmLevel,
|
|
843
|
+
notificationStatus,
|
|
844
|
+
notificationType,
|
|
845
|
+
notificationEvent,
|
|
846
|
+
eventParameters,
|
|
847
|
+
sequenceNumber,
|
|
742
848
|
});
|
|
743
849
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
notificationEvent,
|
|
769
|
-
eventParameters,
|
|
770
|
-
sequenceNumber,
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
persistValues(ctx) {
|
|
774
|
-
if (!super.persistValues(ctx))
|
|
775
|
-
return false;
|
|
776
|
-
const ccVersion = getEffectiveCCVersion(ctx, this);
|
|
777
|
-
// Check if we need to re-interpret the alarm values somehow
|
|
778
|
-
if (this.alarmType != undefined
|
|
779
|
-
&& this.alarmLevel != undefined
|
|
780
|
-
&& this.alarmType !== 0) {
|
|
781
|
-
if (ccVersion >= 2) {
|
|
782
|
-
// Check if the device actually supports Notification CC, but chooses
|
|
783
|
-
// to send Alarm frames instead (GH#1034)
|
|
784
|
-
const supportedNotificationTypes = this.getValue(ctx, NotificationCCValues.supportedNotificationTypes);
|
|
785
|
-
if (isArray(supportedNotificationTypes)
|
|
786
|
-
&& supportedNotificationTypes.includes(this.alarmType)) {
|
|
787
|
-
const supportedNotificationEvents = this.getValue(ctx, NotificationCCValues.supportedNotificationEvents(this.alarmType));
|
|
788
|
-
if (isArray(supportedNotificationEvents)
|
|
789
|
-
&& supportedNotificationEvents.includes(this.alarmLevel)) {
|
|
790
|
-
// This alarm frame corresponds to a valid notification event
|
|
791
|
-
ctx.logNode(this.nodeId, `treating V1 Alarm frame as Notification Report`);
|
|
792
|
-
this.notificationType = this.alarmType;
|
|
793
|
-
this.notificationEvent = this.alarmLevel;
|
|
794
|
-
this.alarmType = undefined;
|
|
795
|
-
this.alarmLevel = undefined;
|
|
850
|
+
persistValues(ctx) {
|
|
851
|
+
if (!super.persistValues(ctx))
|
|
852
|
+
return false;
|
|
853
|
+
const ccVersion = getEffectiveCCVersion(ctx, this);
|
|
854
|
+
// Check if we need to re-interpret the alarm values somehow
|
|
855
|
+
if (this.alarmType != undefined
|
|
856
|
+
&& this.alarmLevel != undefined
|
|
857
|
+
&& this.alarmType !== 0) {
|
|
858
|
+
if (ccVersion >= 2) {
|
|
859
|
+
// Check if the device actually supports Notification CC, but chooses
|
|
860
|
+
// to send Alarm frames instead (GH#1034)
|
|
861
|
+
const supportedNotificationTypes = this.getValue(ctx, NotificationCCValues.supportedNotificationTypes);
|
|
862
|
+
if (isArray(supportedNotificationTypes)
|
|
863
|
+
&& supportedNotificationTypes.includes(this.alarmType)) {
|
|
864
|
+
const supportedNotificationEvents = this.getValue(ctx, NotificationCCValues.supportedNotificationEvents(this.alarmType));
|
|
865
|
+
if (isArray(supportedNotificationEvents)
|
|
866
|
+
&& supportedNotificationEvents.includes(this.alarmLevel)) {
|
|
867
|
+
// This alarm frame corresponds to a valid notification event
|
|
868
|
+
ctx.logNode(this.nodeId, `treating V1 Alarm frame as Notification Report`);
|
|
869
|
+
this.notificationType = this.alarmType;
|
|
870
|
+
this.notificationEvent = this.alarmLevel;
|
|
871
|
+
this.alarmType = undefined;
|
|
872
|
+
this.alarmLevel = undefined;
|
|
873
|
+
}
|
|
796
874
|
}
|
|
797
875
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
876
|
+
else {
|
|
877
|
+
// V1 Alarm, check if there is a compat option to map this V1 report to a V2+ report
|
|
878
|
+
const mapping = ctx.getDeviceConfig?.(this.nodeId)?.compat?.alarmMapping;
|
|
879
|
+
const match = mapping?.find((m) => m.from.alarmType === this.alarmType
|
|
880
|
+
&& (m.from.alarmLevel == undefined
|
|
881
|
+
|| m.from.alarmLevel === this.alarmLevel));
|
|
882
|
+
if (match) {
|
|
883
|
+
ctx.logNode(this.nodeId, `compat mapping found, treating V1 Alarm frame as Notification Report`);
|
|
884
|
+
this.notificationType = match.to.notificationType;
|
|
885
|
+
this.notificationEvent = match.to.notificationEvent;
|
|
886
|
+
if (match.to.eventParameters) {
|
|
887
|
+
this.eventParameters = {};
|
|
888
|
+
for (const [key, val] of Object.entries(match.to.eventParameters)) {
|
|
889
|
+
if (typeof val === "number") {
|
|
890
|
+
this.eventParameters[key] = val;
|
|
891
|
+
}
|
|
892
|
+
else if (val === "alarmLevel") {
|
|
893
|
+
this.eventParameters[key] = this.alarmLevel;
|
|
894
|
+
}
|
|
817
895
|
}
|
|
818
896
|
}
|
|
897
|
+
// After mapping we do not set the legacy V1 values to undefined
|
|
898
|
+
// Otherwise, adding a new mapping will be a breaking change
|
|
819
899
|
}
|
|
820
|
-
// After mapping we do not set the legacy V1 values to undefined
|
|
821
|
-
// Otherwise, adding a new mapping will be a breaking change
|
|
822
900
|
}
|
|
823
901
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
this.setValue(ctx, alarmTypeValue, this.alarmType);
|
|
831
|
-
}
|
|
832
|
-
if (this.alarmLevel != undefined) {
|
|
833
|
-
const alarmLevelValue = NotificationCCValues.alarmLevel;
|
|
834
|
-
this.ensureMetadata(ctx, alarmLevelValue);
|
|
835
|
-
this.setValue(ctx, alarmLevelValue, this.alarmLevel);
|
|
836
|
-
}
|
|
837
|
-
return true;
|
|
838
|
-
}
|
|
839
|
-
alarmType;
|
|
840
|
-
alarmLevel;
|
|
841
|
-
notificationType;
|
|
842
|
-
notificationStatus;
|
|
843
|
-
notificationEvent;
|
|
844
|
-
eventParameters;
|
|
845
|
-
sequenceNumber;
|
|
846
|
-
toLogEntry(ctx) {
|
|
847
|
-
let message = {};
|
|
848
|
-
if (this.alarmType) {
|
|
849
|
-
message = {
|
|
850
|
-
"V1 alarm type": this.alarmType,
|
|
851
|
-
"V1 alarm level": this.alarmLevel,
|
|
852
|
-
};
|
|
853
|
-
}
|
|
854
|
-
let valueConfig;
|
|
855
|
-
if (this.notificationType) {
|
|
856
|
-
const notification = getNotification(this.notificationType);
|
|
857
|
-
if (notification) {
|
|
858
|
-
valueConfig = getNotificationValue(notification, this.notificationEvent);
|
|
859
|
-
}
|
|
860
|
-
if (valueConfig) {
|
|
861
|
-
message = {
|
|
862
|
-
...message,
|
|
863
|
-
"notification type": getNotificationName(this.notificationType),
|
|
864
|
-
"notification status": this.notificationStatus,
|
|
865
|
-
[`notification ${valueConfig.type}`]: valueConfig.label
|
|
866
|
-
?? `Unknown (${num2hex(this.notificationEvent)})`,
|
|
867
|
-
};
|
|
902
|
+
// Now we can interpret the event parameters and turn them into something useful
|
|
903
|
+
this.parseEventParameters(ctx);
|
|
904
|
+
if (this.alarmType != undefined) {
|
|
905
|
+
const alarmTypeValue = NotificationCCValues.alarmType;
|
|
906
|
+
this.ensureMetadata(ctx, alarmTypeValue);
|
|
907
|
+
this.setValue(ctx, alarmTypeValue, this.alarmType);
|
|
868
908
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
"notification status": this.notificationStatus,
|
|
874
|
-
"notification state": "idle",
|
|
875
|
-
};
|
|
909
|
+
if (this.alarmLevel != undefined) {
|
|
910
|
+
const alarmLevelValue = NotificationCCValues.alarmLevel;
|
|
911
|
+
this.ensureMetadata(ctx, alarmLevelValue);
|
|
912
|
+
this.setValue(ctx, alarmLevelValue, this.alarmLevel);
|
|
876
913
|
}
|
|
877
|
-
|
|
914
|
+
return true;
|
|
915
|
+
}
|
|
916
|
+
alarmType;
|
|
917
|
+
alarmLevel;
|
|
918
|
+
notificationType;
|
|
919
|
+
notificationStatus;
|
|
920
|
+
notificationEvent;
|
|
921
|
+
eventParameters;
|
|
922
|
+
sequenceNumber;
|
|
923
|
+
toLogEntry(ctx) {
|
|
924
|
+
let message = {};
|
|
925
|
+
if (this.alarmType) {
|
|
878
926
|
message = {
|
|
879
|
-
|
|
880
|
-
"
|
|
881
|
-
"notification status": this.notificationStatus,
|
|
882
|
-
"notification event": num2hex(this.notificationEvent),
|
|
927
|
+
"V1 alarm type": this.alarmType,
|
|
928
|
+
"V1 alarm level": this.alarmLevel,
|
|
883
929
|
};
|
|
884
930
|
}
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
if (typeof this.eventParameters === "number") {
|
|
891
|
-
// Try to look up the enum label
|
|
892
|
-
let found = false;
|
|
893
|
-
if (valueConfig?.parameter?.type === "enum") {
|
|
894
|
-
const label = valueConfig.parameter.values[this.eventParameters];
|
|
895
|
-
if (label) {
|
|
896
|
-
message["state parameters"] = label;
|
|
897
|
-
found = true;
|
|
898
|
-
}
|
|
931
|
+
let valueConfig;
|
|
932
|
+
if (this.notificationType) {
|
|
933
|
+
const notification = getNotification(this.notificationType);
|
|
934
|
+
if (notification) {
|
|
935
|
+
valueConfig = getNotificationValue(notification, this.notificationEvent);
|
|
899
936
|
}
|
|
900
|
-
if (
|
|
901
|
-
message
|
|
937
|
+
if (valueConfig) {
|
|
938
|
+
message = {
|
|
939
|
+
...message,
|
|
940
|
+
"notification type": getNotificationName(this.notificationType),
|
|
941
|
+
"notification status": this.notificationStatus,
|
|
942
|
+
[`notification ${valueConfig.type}`]: valueConfig.label
|
|
943
|
+
?? `Unknown (${num2hex(this.notificationEvent)})`,
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
else if (this.notificationEvent === 0x00) {
|
|
947
|
+
message = {
|
|
948
|
+
...message,
|
|
949
|
+
"notification type": this.notificationType,
|
|
950
|
+
"notification status": this.notificationStatus,
|
|
951
|
+
"notification state": "idle",
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
else {
|
|
955
|
+
message = {
|
|
956
|
+
...message,
|
|
957
|
+
"notification type": this.notificationType,
|
|
958
|
+
"notification status": this.notificationStatus,
|
|
959
|
+
"notification event": num2hex(this.notificationEvent),
|
|
960
|
+
};
|
|
902
961
|
}
|
|
903
962
|
}
|
|
904
|
-
|
|
905
|
-
message["
|
|
906
|
-
}
|
|
907
|
-
else if (this.eventParameters instanceof Duration) {
|
|
908
|
-
message["event parameters"] = this.eventParameters.toString();
|
|
963
|
+
if (this.sequenceNumber != undefined) {
|
|
964
|
+
message["sequence number"] = this.sequenceNumber;
|
|
909
965
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
966
|
+
if (this.eventParameters != undefined) {
|
|
967
|
+
if (typeof this.eventParameters === "number") {
|
|
968
|
+
// Try to look up the enum label
|
|
969
|
+
let found = false;
|
|
970
|
+
if (valueConfig?.parameter?.type === "enum") {
|
|
971
|
+
const label = valueConfig.parameter.values[this.eventParameters];
|
|
972
|
+
if (label) {
|
|
973
|
+
message["state parameters"] = label;
|
|
974
|
+
found = true;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
if (!found) {
|
|
978
|
+
message["state parameters"] = num2hex(this.eventParameters);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
else if (isUint8Array(this.eventParameters)) {
|
|
982
|
+
message["event parameters"] = buffer2hex(this.eventParameters);
|
|
983
|
+
}
|
|
984
|
+
else if (this.eventParameters instanceof Duration) {
|
|
985
|
+
message["event parameters"] = this.eventParameters.toString();
|
|
986
|
+
}
|
|
987
|
+
else {
|
|
988
|
+
message["event parameters"] = Object.entries(this.eventParameters)
|
|
989
|
+
.map(([param, val]) => `\n ${param}: ${num2hex(val)}`)
|
|
990
|
+
.join("");
|
|
991
|
+
}
|
|
914
992
|
}
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
993
|
+
else if (valueConfig?.parameter?.type === "enum"
|
|
994
|
+
&& valueConfig.parameter.default != undefined) {
|
|
995
|
+
const label = valueConfig.parameter.values[valueConfig.parameter.default];
|
|
996
|
+
if (label) {
|
|
997
|
+
message["state parameters"] = `${label} (omitted)`;
|
|
998
|
+
}
|
|
921
999
|
}
|
|
1000
|
+
return {
|
|
1001
|
+
...super.toLogEntry(ctx),
|
|
1002
|
+
message,
|
|
1003
|
+
};
|
|
922
1004
|
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
}
|
|
928
|
-
parseEventParameters(ctx) {
|
|
929
|
-
// This only makes sense for V2+ notifications
|
|
930
|
-
if (this.notificationType == undefined
|
|
931
|
-
|| this.notificationEvent == undefined) {
|
|
932
|
-
return;
|
|
933
|
-
}
|
|
934
|
-
// Look up the received notification and value in the config
|
|
935
|
-
const notification = getNotification(this.notificationType);
|
|
936
|
-
if (!notification)
|
|
937
|
-
return;
|
|
938
|
-
const valueConfig = getNotificationValue(notification, this.notificationEvent);
|
|
939
|
-
if (!valueConfig)
|
|
940
|
-
return;
|
|
941
|
-
// Parse the event parameters if possible
|
|
942
|
-
if (valueConfig.parameter?.type === "duration") {
|
|
943
|
-
// This only makes sense if the event parameters are a buffer
|
|
944
|
-
if (!isUint8Array(this.eventParameters)) {
|
|
1005
|
+
parseEventParameters(ctx) {
|
|
1006
|
+
// This only makes sense for V2+ notifications
|
|
1007
|
+
if (this.notificationType == undefined
|
|
1008
|
+
|| this.notificationEvent == undefined) {
|
|
945
1009
|
return;
|
|
946
1010
|
}
|
|
947
|
-
//
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
else if (valueConfig.parameter?.type === "commandclass") {
|
|
951
|
-
// This only makes sense if the event parameters are a buffer
|
|
952
|
-
if (!isUint8Array(this.eventParameters)) {
|
|
1011
|
+
// Look up the received notification and value in the config
|
|
1012
|
+
const notification = getNotification(this.notificationType);
|
|
1013
|
+
if (!notification)
|
|
953
1014
|
return;
|
|
1015
|
+
const valueConfig = getNotificationValue(notification, this.notificationEvent);
|
|
1016
|
+
if (!valueConfig)
|
|
1017
|
+
return;
|
|
1018
|
+
// Parse the event parameters if possible
|
|
1019
|
+
if (valueConfig.parameter?.type === "duration") {
|
|
1020
|
+
// This only makes sense if the event parameters are a buffer
|
|
1021
|
+
if (!isUint8Array(this.eventParameters)) {
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
// The parameters contain a Duration
|
|
1025
|
+
this.eventParameters = Duration.parseReport(this.eventParameters[0]);
|
|
954
1026
|
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
//
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
const cc = CommandClass.parse(this.eventParameters, {
|
|
971
|
-
...ctx,
|
|
972
|
-
frameType: "singlecast",
|
|
973
|
-
sourceNodeId: this.nodeId,
|
|
974
|
-
// Security encapsulation is handled outside of this CC,
|
|
975
|
-
// so it is not needed here:
|
|
976
|
-
hasSecurityClass: () => false,
|
|
977
|
-
getHighestSecurityClass: () => SecurityClass.None,
|
|
978
|
-
setSecurityClass: () => { },
|
|
979
|
-
securityManager: undefined,
|
|
980
|
-
securityManager2: undefined,
|
|
981
|
-
securityManagerLR: undefined,
|
|
982
|
-
});
|
|
983
|
-
validatePayload(!(cc instanceof InvalidCC));
|
|
984
|
-
cc.encapsulatingCC = this;
|
|
985
|
-
if (isNotificationEventPayload(cc)) {
|
|
986
|
-
this.eventParameters = cc
|
|
987
|
-
.toNotificationEventParameters();
|
|
988
|
-
}
|
|
989
|
-
else {
|
|
990
|
-
// If a CC has no good toJSON() representation, we're only interested in the payload
|
|
991
|
-
let json = cc.toJSON();
|
|
992
|
-
if ("nodeId" in json
|
|
993
|
-
&& "ccId" in json
|
|
994
|
-
&& "payload" in json) {
|
|
995
|
-
json = pick(json, ["payload"]);
|
|
996
|
-
}
|
|
997
|
-
this.eventParameters = json;
|
|
998
|
-
}
|
|
1027
|
+
else if (valueConfig.parameter?.type === "commandclass") {
|
|
1028
|
+
// This only makes sense if the event parameters are a buffer
|
|
1029
|
+
if (!isUint8Array(this.eventParameters)) {
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
// The parameters **should** contain a CC, however there might be some exceptions
|
|
1033
|
+
if (this.eventParameters.length === 1
|
|
1034
|
+
&& notification.type === 0x06
|
|
1035
|
+
&& (this.notificationEvent === 0x05
|
|
1036
|
+
|| this.notificationEvent === 0x06)) {
|
|
1037
|
+
// Access control -> Keypad Lock/Unlock operation
|
|
1038
|
+
// Some devices only send the User ID, not a complete CC payload
|
|
1039
|
+
this.eventParameters = {
|
|
1040
|
+
userId: this.eventParameters[0],
|
|
1041
|
+
};
|
|
999
1042
|
}
|
|
1000
|
-
|
|
1001
|
-
if
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
//
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1043
|
+
else {
|
|
1044
|
+
// Try to parse the event parameters - if this fails, we should still handle the notification report
|
|
1045
|
+
try {
|
|
1046
|
+
// Convert CommandClass instances to a standardized object representation
|
|
1047
|
+
const cc = CommandClass.parse(this.eventParameters, {
|
|
1048
|
+
...ctx,
|
|
1049
|
+
frameType: "singlecast",
|
|
1050
|
+
sourceNodeId: this.nodeId,
|
|
1051
|
+
// Security encapsulation is handled outside of this CC,
|
|
1052
|
+
// so it is not needed here:
|
|
1053
|
+
hasSecurityClass: () => false,
|
|
1054
|
+
getHighestSecurityClass: () => SecurityClass.None,
|
|
1055
|
+
setSecurityClass: () => { },
|
|
1056
|
+
securityManager: undefined,
|
|
1057
|
+
securityManager2: undefined,
|
|
1058
|
+
securityManagerLR: undefined,
|
|
1059
|
+
});
|
|
1060
|
+
validatePayload(!(cc instanceof InvalidCC));
|
|
1061
|
+
cc.encapsulatingCC = this;
|
|
1062
|
+
if (isNotificationEventPayload(cc)) {
|
|
1063
|
+
this.eventParameters = cc
|
|
1064
|
+
.toNotificationEventParameters();
|
|
1014
1065
|
}
|
|
1015
1066
|
else {
|
|
1016
|
-
|
|
1067
|
+
// If a CC has no good toJSON() representation, we're only interested in the payload
|
|
1068
|
+
let json = cc.toJSON();
|
|
1069
|
+
if ("nodeId" in json
|
|
1070
|
+
&& "ccId" in json
|
|
1071
|
+
&& "payload" in json) {
|
|
1072
|
+
json = pick(json, ["payload"]);
|
|
1073
|
+
}
|
|
1074
|
+
this.eventParameters = json;
|
|
1017
1075
|
}
|
|
1018
1076
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1077
|
+
catch (e) {
|
|
1078
|
+
if (isZWaveError(e)
|
|
1079
|
+
&& e.code
|
|
1080
|
+
=== ZWaveErrorCodes.PacketFormat_InvalidPayload
|
|
1081
|
+
&& isUint8Array(this.eventParameters)) {
|
|
1082
|
+
const { ccId, ccCommand } = CCRaw.parse(this.eventParameters);
|
|
1083
|
+
if (ccId === CommandClasses["User Code"]
|
|
1084
|
+
&& ccCommand === UserCodeCommand.Report
|
|
1085
|
+
&& this.eventParameters.length >= 3) {
|
|
1086
|
+
// Access control -> Keypad Lock/Unlock operation
|
|
1087
|
+
// Some devices report the user code with truncated UserCode reports
|
|
1088
|
+
this.eventParameters = {
|
|
1089
|
+
userId: this.eventParameters[2],
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
else {
|
|
1093
|
+
ctx.logNode(this.nodeId, `Failed to parse Notification CC event parameters, ignoring them...`, "error");
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
else {
|
|
1097
|
+
// unexpected error
|
|
1098
|
+
throw e;
|
|
1099
|
+
}
|
|
1022
1100
|
}
|
|
1023
1101
|
}
|
|
1024
1102
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1103
|
+
else if (valueConfig.parameter?.type === "value") {
|
|
1104
|
+
// This only makes sense if the event parameters are a buffer
|
|
1105
|
+
if (!isUint8Array(this.eventParameters)) {
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
// The parameters contain a named value
|
|
1109
|
+
this.eventParameters = {
|
|
1110
|
+
[valueConfig.parameter.propertyName]: Bytes.view(this.eventParameters)
|
|
1111
|
+
.readUIntBE(0, this.eventParameters.length),
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
else if (valueConfig.parameter?.type === "enum") {
|
|
1115
|
+
// The parameters may contain an enum value
|
|
1116
|
+
this.eventParameters = isUint8Array(this.eventParameters)
|
|
1117
|
+
&& this.eventParameters.length === 1
|
|
1118
|
+
? this.eventParameters[0]
|
|
1119
|
+
: undefined;
|
|
1120
|
+
// Some devices send notifications without an event parameter when they should.
|
|
1121
|
+
// In this case, fall back to the default value where possible.
|
|
1122
|
+
if (this.eventParameters == undefined
|
|
1123
|
+
&& valueConfig.parameter.default != undefined) {
|
|
1124
|
+
this.eventParameters = valueConfig.parameter.default;
|
|
1125
|
+
}
|
|
1030
1126
|
}
|
|
1031
|
-
// The parameters contain a named value
|
|
1032
|
-
this.eventParameters = {
|
|
1033
|
-
[valueConfig.parameter.propertyName]: Bytes.view(this.eventParameters)
|
|
1034
|
-
.readUIntBE(0, this.eventParameters.length),
|
|
1035
|
-
};
|
|
1036
1127
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1128
|
+
serialize(ctx) {
|
|
1129
|
+
if (this.notificationType != undefined) {
|
|
1130
|
+
if (this.notificationEvent == undefined) {
|
|
1131
|
+
throw new ZWaveError(`Notification CC reports requires the notification event to be set!`, ZWaveErrorCodes.Argument_Invalid);
|
|
1132
|
+
}
|
|
1133
|
+
else if (this.eventParameters != undefined
|
|
1134
|
+
&& !isUint8Array(this.eventParameters)) {
|
|
1135
|
+
throw new ZWaveError(`When sending Notification CC reports, the event parameters can only be buffers!`, ZWaveErrorCodes.Argument_Invalid);
|
|
1136
|
+
}
|
|
1137
|
+
const controlByte = (this.sequenceNumber != undefined ? 0b1000_0000 : 0)
|
|
1138
|
+
| ((this.eventParameters?.length ?? 0) & 0b11111);
|
|
1139
|
+
this.payload = Bytes.from([
|
|
1140
|
+
0,
|
|
1141
|
+
0,
|
|
1142
|
+
0,
|
|
1143
|
+
0xff,
|
|
1144
|
+
this.notificationType,
|
|
1145
|
+
this.notificationEvent,
|
|
1146
|
+
controlByte,
|
|
1147
|
+
]);
|
|
1148
|
+
if (this.eventParameters) {
|
|
1149
|
+
this.payload = Bytes.concat([
|
|
1150
|
+
this.payload,
|
|
1151
|
+
this.eventParameters,
|
|
1152
|
+
]);
|
|
1153
|
+
}
|
|
1154
|
+
if (this.sequenceNumber != undefined) {
|
|
1155
|
+
this.payload = Bytes.concat([
|
|
1156
|
+
this.payload,
|
|
1157
|
+
Bytes.from([this.sequenceNumber]),
|
|
1158
|
+
]);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
this.payload = Bytes.from([
|
|
1163
|
+
this.alarmType ?? 0x00,
|
|
1164
|
+
this.alarmLevel ?? 0x00,
|
|
1165
|
+
]);
|
|
1048
1166
|
}
|
|
1167
|
+
return super.serialize(ctx);
|
|
1049
1168
|
}
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1169
|
+
};
|
|
1170
|
+
return NotificationCCReport = _classThis;
|
|
1171
|
+
})();
|
|
1172
|
+
export { NotificationCCReport };
|
|
1173
|
+
let NotificationCCGet = (() => {
|
|
1174
|
+
let _classDecorators = [CCCommand(NotificationCommand.Get), expectedCCResponse(NotificationCCReport)];
|
|
1175
|
+
let _classDescriptor;
|
|
1176
|
+
let _classExtraInitializers = [];
|
|
1177
|
+
let _classThis;
|
|
1178
|
+
let _classSuper = NotificationCC;
|
|
1179
|
+
var NotificationCCGet = class extends _classSuper {
|
|
1180
|
+
static { _classThis = this; }
|
|
1181
|
+
static {
|
|
1182
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1183
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1184
|
+
NotificationCCGet = _classThis = _classDescriptor.value;
|
|
1185
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1186
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1187
|
+
}
|
|
1188
|
+
constructor(options) {
|
|
1189
|
+
super(options);
|
|
1190
|
+
if ("alarmType" in options) {
|
|
1191
|
+
this.alarmType = options.alarmType;
|
|
1055
1192
|
}
|
|
1056
|
-
else
|
|
1057
|
-
|
|
1058
|
-
|
|
1193
|
+
else {
|
|
1194
|
+
this.notificationType = options.notificationType;
|
|
1195
|
+
this.notificationEvent = options.notificationEvent;
|
|
1059
1196
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
0xff
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
this.eventParameters,
|
|
1075
|
-
]);
|
|
1197
|
+
}
|
|
1198
|
+
static from(raw, ctx) {
|
|
1199
|
+
validatePayload(raw.payload.length >= 1);
|
|
1200
|
+
if (raw.payload.length >= 2) {
|
|
1201
|
+
const notificationType = raw.payload[1];
|
|
1202
|
+
let notificationEvent;
|
|
1203
|
+
if (raw.payload.length >= 3 && notificationType != 0xff) {
|
|
1204
|
+
notificationEvent = raw.payload[2];
|
|
1205
|
+
}
|
|
1206
|
+
return new this({
|
|
1207
|
+
nodeId: ctx.sourceNodeId,
|
|
1208
|
+
notificationType,
|
|
1209
|
+
notificationEvent,
|
|
1210
|
+
});
|
|
1076
1211
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1212
|
+
else {
|
|
1213
|
+
const alarmType = raw.payload[0];
|
|
1214
|
+
return new this({
|
|
1215
|
+
nodeId: ctx.sourceNodeId,
|
|
1216
|
+
alarmType,
|
|
1217
|
+
});
|
|
1082
1218
|
}
|
|
1083
1219
|
}
|
|
1084
|
-
|
|
1220
|
+
/** Proprietary V1/V2 alarm type */
|
|
1221
|
+
alarmType;
|
|
1222
|
+
/** Regulated V3+ notification type */
|
|
1223
|
+
notificationType;
|
|
1224
|
+
notificationEvent;
|
|
1225
|
+
serialize(ctx) {
|
|
1226
|
+
const notificationEvent = this.notificationEvent === 0xff
|
|
1227
|
+
? 0x00
|
|
1228
|
+
: this.notificationEvent;
|
|
1085
1229
|
this.payload = Bytes.from([
|
|
1086
1230
|
this.alarmType ?? 0x00,
|
|
1087
|
-
this.
|
|
1231
|
+
this.notificationType ?? 0xff,
|
|
1232
|
+
notificationEvent ?? 0x00,
|
|
1088
1233
|
]);
|
|
1234
|
+
return super.serialize(ctx);
|
|
1089
1235
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
]
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1236
|
+
toLogEntry(ctx) {
|
|
1237
|
+
const message = {};
|
|
1238
|
+
if (this.alarmType != undefined) {
|
|
1239
|
+
message["V1 alarm type"] = this.alarmType;
|
|
1240
|
+
}
|
|
1241
|
+
if (this.notificationType != undefined) {
|
|
1242
|
+
message["notification type"] = getNotificationName(this.notificationType);
|
|
1243
|
+
if (this.notificationEvent != undefined) {
|
|
1244
|
+
message["notification event"] = getNotificationEventName(this.notificationType, this.notificationEvent);
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
return {
|
|
1248
|
+
...super.toLogEntry(ctx),
|
|
1249
|
+
message,
|
|
1250
|
+
};
|
|
1103
1251
|
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1252
|
+
};
|
|
1253
|
+
return NotificationCCGet = _classThis;
|
|
1254
|
+
})();
|
|
1255
|
+
export { NotificationCCGet };
|
|
1256
|
+
let NotificationCCSupportedReport = (() => {
|
|
1257
|
+
let _classDecorators = [CCCommand(NotificationCommand.SupportedReport), ccValueProperty("supportsV1Alarm", NotificationCCValues.supportsV1Alarm), ccValueProperty("supportedNotificationTypes", NotificationCCValues.supportedNotificationTypes)];
|
|
1258
|
+
let _classDescriptor;
|
|
1259
|
+
let _classExtraInitializers = [];
|
|
1260
|
+
let _classThis;
|
|
1261
|
+
let _classSuper = NotificationCC;
|
|
1262
|
+
var NotificationCCSupportedReport = class extends _classSuper {
|
|
1263
|
+
static { _classThis = this; }
|
|
1264
|
+
static {
|
|
1265
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1266
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1267
|
+
NotificationCCSupportedReport = _classThis = _classDescriptor.value;
|
|
1268
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1269
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1107
1270
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
const notificationType = raw.payload[1];
|
|
1113
|
-
let notificationEvent;
|
|
1114
|
-
if (raw.payload.length >= 3 && notificationType != 0xff) {
|
|
1115
|
-
notificationEvent = raw.payload[2];
|
|
1116
|
-
}
|
|
1117
|
-
return new NotificationCCGet_1({
|
|
1118
|
-
nodeId: ctx.sourceNodeId,
|
|
1119
|
-
notificationType,
|
|
1120
|
-
notificationEvent,
|
|
1121
|
-
});
|
|
1271
|
+
constructor(options) {
|
|
1272
|
+
super(options);
|
|
1273
|
+
this.supportsV1Alarm = options.supportsV1Alarm;
|
|
1274
|
+
this.supportedNotificationTypes = options.supportedNotificationTypes;
|
|
1122
1275
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1276
|
+
static from(raw, ctx) {
|
|
1277
|
+
validatePayload(raw.payload.length >= 1);
|
|
1278
|
+
const supportsV1Alarm = !!(raw.payload[0] & 0b1000_0000);
|
|
1279
|
+
const numBitMaskBytes = raw.payload[0] & 0b0001_1111;
|
|
1280
|
+
validatePayload(numBitMaskBytes > 0, raw.payload.length >= 1 + numBitMaskBytes);
|
|
1281
|
+
const notificationBitMask = raw.payload.subarray(1, 1 + numBitMaskBytes);
|
|
1282
|
+
const supportedNotificationTypes = parseBitMask(notificationBitMask,
|
|
1283
|
+
// bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
|
|
1284
|
+
0);
|
|
1285
|
+
return new this({
|
|
1126
1286
|
nodeId: ctx.sourceNodeId,
|
|
1127
|
-
|
|
1287
|
+
supportsV1Alarm,
|
|
1288
|
+
supportedNotificationTypes,
|
|
1128
1289
|
});
|
|
1129
1290
|
}
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
this.alarmType ?? 0x00,
|
|
1142
|
-
this.notificationType ?? 0xff,
|
|
1143
|
-
notificationEvent ?? 0x00,
|
|
1144
|
-
]);
|
|
1145
|
-
return super.serialize(ctx);
|
|
1146
|
-
}
|
|
1147
|
-
toLogEntry(ctx) {
|
|
1148
|
-
const message = {};
|
|
1149
|
-
if (this.alarmType != undefined) {
|
|
1150
|
-
message["V1 alarm type"] = this.alarmType;
|
|
1151
|
-
}
|
|
1152
|
-
if (this.notificationType != undefined) {
|
|
1153
|
-
message["notification type"] = getNotificationName(this.notificationType);
|
|
1154
|
-
if (this.notificationEvent != undefined) {
|
|
1155
|
-
message["notification event"] = getNotificationEventName(this.notificationType, this.notificationEvent);
|
|
1156
|
-
}
|
|
1291
|
+
supportsV1Alarm;
|
|
1292
|
+
supportedNotificationTypes;
|
|
1293
|
+
serialize(ctx) {
|
|
1294
|
+
const bitMask = encodeBitMask(this.supportedNotificationTypes, Math.max(...this.supportedNotificationTypes), 0);
|
|
1295
|
+
this.payload = Bytes.concat([
|
|
1296
|
+
Bytes.from([
|
|
1297
|
+
(this.supportsV1Alarm ? 0b1000_0000 : 0) | bitMask.length,
|
|
1298
|
+
]),
|
|
1299
|
+
bitMask,
|
|
1300
|
+
]);
|
|
1301
|
+
return super.serialize(ctx);
|
|
1157
1302
|
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
this.supportsV1Alarm = options.supportsV1Alarm;
|
|
1173
|
-
this.supportedNotificationTypes = options.supportedNotificationTypes;
|
|
1174
|
-
}
|
|
1175
|
-
static from(raw, ctx) {
|
|
1176
|
-
validatePayload(raw.payload.length >= 1);
|
|
1177
|
-
const supportsV1Alarm = !!(raw.payload[0] & 0b1000_0000);
|
|
1178
|
-
const numBitMaskBytes = raw.payload[0] & 0b0001_1111;
|
|
1179
|
-
validatePayload(numBitMaskBytes > 0, raw.payload.length >= 1 + numBitMaskBytes);
|
|
1180
|
-
const notificationBitMask = raw.payload.subarray(1, 1 + numBitMaskBytes);
|
|
1181
|
-
const supportedNotificationTypes = parseBitMask(notificationBitMask,
|
|
1182
|
-
// bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
|
|
1183
|
-
0);
|
|
1184
|
-
return new NotificationCCSupportedReport_1({
|
|
1185
|
-
nodeId: ctx.sourceNodeId,
|
|
1186
|
-
supportsV1Alarm,
|
|
1187
|
-
supportedNotificationTypes,
|
|
1188
|
-
});
|
|
1189
|
-
}
|
|
1190
|
-
supportsV1Alarm;
|
|
1191
|
-
supportedNotificationTypes;
|
|
1192
|
-
serialize(ctx) {
|
|
1193
|
-
const bitMask = encodeBitMask(this.supportedNotificationTypes, Math.max(...this.supportedNotificationTypes), 0);
|
|
1194
|
-
this.payload = Bytes.concat([
|
|
1195
|
-
Bytes.from([
|
|
1196
|
-
(this.supportsV1Alarm ? 0b1000_0000 : 0) | bitMask.length,
|
|
1197
|
-
]),
|
|
1198
|
-
bitMask,
|
|
1199
|
-
]);
|
|
1200
|
-
return super.serialize(ctx);
|
|
1201
|
-
}
|
|
1202
|
-
toLogEntry(ctx) {
|
|
1203
|
-
return {
|
|
1204
|
-
...super.toLogEntry(ctx),
|
|
1205
|
-
message: {
|
|
1206
|
-
"supports V1 alarm": this.supportsV1Alarm,
|
|
1207
|
-
"supported notification types": this.supportedNotificationTypes
|
|
1208
|
-
.map((t) => `\n· ${getNotificationName(t)}`)
|
|
1209
|
-
.join(""),
|
|
1210
|
-
},
|
|
1211
|
-
};
|
|
1212
|
-
}
|
|
1213
|
-
};
|
|
1214
|
-
__decorate([
|
|
1215
|
-
ccValue(NotificationCCValues.supportsV1Alarm)
|
|
1216
|
-
], NotificationCCSupportedReport.prototype, "supportsV1Alarm", void 0);
|
|
1217
|
-
__decorate([
|
|
1218
|
-
ccValue(NotificationCCValues.supportedNotificationTypes)
|
|
1219
|
-
], NotificationCCSupportedReport.prototype, "supportedNotificationTypes", void 0);
|
|
1220
|
-
NotificationCCSupportedReport = NotificationCCSupportedReport_1 = __decorate([
|
|
1221
|
-
CCCommand(NotificationCommand.SupportedReport)
|
|
1222
|
-
], NotificationCCSupportedReport);
|
|
1303
|
+
toLogEntry(ctx) {
|
|
1304
|
+
return {
|
|
1305
|
+
...super.toLogEntry(ctx),
|
|
1306
|
+
message: {
|
|
1307
|
+
"supports V1 alarm": this.supportsV1Alarm,
|
|
1308
|
+
"supported notification types": this.supportedNotificationTypes
|
|
1309
|
+
.map((t) => `\n· ${getNotificationName(t)}`)
|
|
1310
|
+
.join(""),
|
|
1311
|
+
},
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1315
|
+
return NotificationCCSupportedReport = _classThis;
|
|
1316
|
+
})();
|
|
1223
1317
|
export { NotificationCCSupportedReport };
|
|
1224
|
-
let NotificationCCSupportedGet =
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1318
|
+
let NotificationCCSupportedGet = (() => {
|
|
1319
|
+
let _classDecorators = [CCCommand(NotificationCommand.SupportedGet), expectedCCResponse(NotificationCCSupportedReport)];
|
|
1320
|
+
let _classDescriptor;
|
|
1321
|
+
let _classExtraInitializers = [];
|
|
1322
|
+
let _classThis;
|
|
1323
|
+
let _classSuper = NotificationCC;
|
|
1324
|
+
var NotificationCCSupportedGet = class extends _classSuper {
|
|
1325
|
+
static { _classThis = this; }
|
|
1326
|
+
static {
|
|
1327
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1328
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1329
|
+
NotificationCCSupportedGet = _classThis = _classDescriptor.value;
|
|
1330
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1331
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
return NotificationCCSupportedGet = _classThis;
|
|
1335
|
+
})();
|
|
1230
1336
|
export { NotificationCCSupportedGet };
|
|
1231
|
-
let NotificationCCEventSupportedReport =
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1337
|
+
let NotificationCCEventSupportedReport = (() => {
|
|
1338
|
+
let _classDecorators = [CCCommand(NotificationCommand.EventSupportedReport)];
|
|
1339
|
+
let _classDescriptor;
|
|
1340
|
+
let _classExtraInitializers = [];
|
|
1341
|
+
let _classThis;
|
|
1342
|
+
let _classSuper = NotificationCC;
|
|
1343
|
+
var NotificationCCEventSupportedReport = class extends _classSuper {
|
|
1344
|
+
static { _classThis = this; }
|
|
1345
|
+
static {
|
|
1346
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1347
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1348
|
+
NotificationCCEventSupportedReport = _classThis = _classDescriptor.value;
|
|
1349
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1350
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1351
|
+
}
|
|
1352
|
+
constructor(options) {
|
|
1353
|
+
super(options);
|
|
1354
|
+
this.notificationType = options.notificationType;
|
|
1355
|
+
this.supportedEvents = options.supportedEvents;
|
|
1356
|
+
}
|
|
1357
|
+
static from(raw, ctx) {
|
|
1358
|
+
validatePayload(raw.payload.length >= 1);
|
|
1359
|
+
const notificationType = raw.payload[0];
|
|
1360
|
+
const numBitMaskBytes = raw.payload[1] & 0b000_11111;
|
|
1361
|
+
if (numBitMaskBytes === 0) {
|
|
1362
|
+
// Notification type is not supported
|
|
1363
|
+
return new this({
|
|
1364
|
+
nodeId: ctx.sourceNodeId,
|
|
1365
|
+
notificationType,
|
|
1366
|
+
supportedEvents: [],
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
validatePayload(raw.payload.length >= 2 + numBitMaskBytes);
|
|
1370
|
+
const eventBitMask = raw.payload.subarray(2, 2 + numBitMaskBytes);
|
|
1371
|
+
const supportedEvents = parseBitMask(eventBitMask,
|
|
1372
|
+
// In this mask, bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
|
|
1373
|
+
0);
|
|
1374
|
+
return new this({
|
|
1244
1375
|
nodeId: ctx.sourceNodeId,
|
|
1245
1376
|
notificationType,
|
|
1246
|
-
supportedEvents
|
|
1377
|
+
supportedEvents,
|
|
1247
1378
|
});
|
|
1248
1379
|
}
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
const valueConfig = getNotificationValue(notification, value);
|
|
1277
|
-
if (valueConfig?.type === "state") {
|
|
1278
|
-
const notificationValue = NotificationCCValues
|
|
1279
|
-
.notificationVariable(notification.name, valueConfig.variableName);
|
|
1280
|
-
// After we've created the metadata initially, extend it
|
|
1281
|
-
const metadata = getNotificationValueMetadata(isFirst
|
|
1282
|
-
? undefined
|
|
1283
|
-
: this.getMetadata(ctx, notificationValue), notification, valueConfig);
|
|
1284
|
-
this.setMetadata(ctx, notificationValue, metadata);
|
|
1285
|
-
isFirst = false;
|
|
1380
|
+
persistValues(ctx) {
|
|
1381
|
+
if (!super.persistValues(ctx))
|
|
1382
|
+
return false;
|
|
1383
|
+
// Store which events this notification supports
|
|
1384
|
+
this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(this.notificationType), this.supportedEvents);
|
|
1385
|
+
// For each event, predefine the value metadata
|
|
1386
|
+
const notification = getNotification(this.notificationType);
|
|
1387
|
+
if (!notification) {
|
|
1388
|
+
// This is an unknown notification
|
|
1389
|
+
this.setMetadata(ctx, NotificationCCValues.unknownNotificationType(this.notificationType));
|
|
1390
|
+
}
|
|
1391
|
+
else {
|
|
1392
|
+
// This is a standardized notification
|
|
1393
|
+
let isFirst = true;
|
|
1394
|
+
for (const value of this.supportedEvents) {
|
|
1395
|
+
// Find out which property we need to update
|
|
1396
|
+
const valueConfig = getNotificationValue(notification, value);
|
|
1397
|
+
if (valueConfig?.type === "state") {
|
|
1398
|
+
const notificationValue = NotificationCCValues
|
|
1399
|
+
.notificationVariable(notification.name, valueConfig.variableName);
|
|
1400
|
+
// After we've created the metadata initially, extend it
|
|
1401
|
+
const metadata = getNotificationValueMetadata(isFirst
|
|
1402
|
+
? undefined
|
|
1403
|
+
: this.getMetadata(ctx, notificationValue), notification, valueConfig);
|
|
1404
|
+
this.setMetadata(ctx, notificationValue, metadata);
|
|
1405
|
+
isFirst = false;
|
|
1406
|
+
}
|
|
1286
1407
|
}
|
|
1287
1408
|
}
|
|
1409
|
+
return true;
|
|
1288
1410
|
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
};
|
|
1314
|
-
NotificationCCEventSupportedReport = NotificationCCEventSupportedReport_1 = __decorate([
|
|
1315
|
-
CCCommand(NotificationCommand.EventSupportedReport)
|
|
1316
|
-
], NotificationCCEventSupportedReport);
|
|
1411
|
+
notificationType;
|
|
1412
|
+
supportedEvents;
|
|
1413
|
+
serialize(ctx) {
|
|
1414
|
+
this.payload = Bytes.from([this.notificationType, 0]);
|
|
1415
|
+
if (this.supportedEvents.length > 0) {
|
|
1416
|
+
const bitMask = encodeBitMask(this.supportedEvents, Math.max(...this.supportedEvents), 0);
|
|
1417
|
+
this.payload[1] = bitMask.length;
|
|
1418
|
+
this.payload = Bytes.concat([this.payload, bitMask]);
|
|
1419
|
+
}
|
|
1420
|
+
return super.serialize(ctx);
|
|
1421
|
+
}
|
|
1422
|
+
toLogEntry(ctx) {
|
|
1423
|
+
return {
|
|
1424
|
+
...super.toLogEntry(ctx),
|
|
1425
|
+
message: {
|
|
1426
|
+
"notification type": getNotificationName(this.notificationType),
|
|
1427
|
+
"supported events": this.supportedEvents
|
|
1428
|
+
.map((e) => `\n· ${getNotificationValueName(this.notificationType, e)}`)
|
|
1429
|
+
.join(""),
|
|
1430
|
+
},
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
return NotificationCCEventSupportedReport = _classThis;
|
|
1435
|
+
})();
|
|
1317
1436
|
export { NotificationCCEventSupportedReport };
|
|
1318
|
-
let NotificationCCEventSupportedGet =
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1437
|
+
let NotificationCCEventSupportedGet = (() => {
|
|
1438
|
+
let _classDecorators = [CCCommand(NotificationCommand.EventSupportedGet), expectedCCResponse(NotificationCCEventSupportedReport)];
|
|
1439
|
+
let _classDescriptor;
|
|
1440
|
+
let _classExtraInitializers = [];
|
|
1441
|
+
let _classThis;
|
|
1442
|
+
let _classSuper = NotificationCC;
|
|
1443
|
+
var NotificationCCEventSupportedGet = class extends _classSuper {
|
|
1444
|
+
static { _classThis = this; }
|
|
1445
|
+
static {
|
|
1446
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1447
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1448
|
+
NotificationCCEventSupportedGet = _classThis = _classDescriptor.value;
|
|
1449
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1450
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1451
|
+
}
|
|
1452
|
+
constructor(options) {
|
|
1453
|
+
super(options);
|
|
1454
|
+
this.notificationType = options.notificationType;
|
|
1455
|
+
}
|
|
1456
|
+
static from(raw, ctx) {
|
|
1457
|
+
validatePayload(raw.payload.length >= 1);
|
|
1458
|
+
const notificationType = raw.payload[0];
|
|
1459
|
+
return new this({
|
|
1460
|
+
nodeId: ctx.sourceNodeId,
|
|
1461
|
+
notificationType,
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
notificationType;
|
|
1465
|
+
serialize(ctx) {
|
|
1466
|
+
this.payload = Bytes.from([this.notificationType]);
|
|
1467
|
+
return super.serialize(ctx);
|
|
1468
|
+
}
|
|
1469
|
+
toLogEntry(ctx) {
|
|
1470
|
+
return {
|
|
1471
|
+
...super.toLogEntry(ctx),
|
|
1472
|
+
message: {
|
|
1473
|
+
"notification type": getNotificationName(this.notificationType),
|
|
1474
|
+
},
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
};
|
|
1478
|
+
return NotificationCCEventSupportedGet = _classThis;
|
|
1479
|
+
})();
|
|
1349
1480
|
export { NotificationCCEventSupportedGet };
|
|
1350
1481
|
//# sourceMappingURL=NotificationCC.js.map
|