@zwave-js/cc 15.25.1 → 15.25.3
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 +15 -17
- package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
- package/build/cjs/cc/AssociationCC.d.ts +1 -1
- package/build/cjs/cc/AssociationCC.js +5 -2
- package/build/cjs/cc/AssociationCC.js.map +2 -2
- package/build/cjs/cc/AssociationGroupInfoCC.js +23 -18
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/BarrierOperatorCC.js +9 -7
- package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
- package/build/cjs/cc/BasicCC.js +3 -2
- package/build/cjs/cc/BasicCC.js.map +2 -2
- package/build/cjs/cc/BatteryCC.js +3 -2
- package/build/cjs/cc/BatteryCC.js.map +2 -2
- package/build/cjs/cc/BinarySensorCC.js +8 -6
- package/build/cjs/cc/BinarySensorCC.js.map +2 -2
- package/build/cjs/cc/BinarySwitchCC.js +3 -2
- package/build/cjs/cc/BinarySwitchCC.js.map +2 -2
- package/build/cjs/cc/CentralSceneCC.js +9 -7
- package/build/cjs/cc/CentralSceneCC.js.map +2 -2
- package/build/cjs/cc/ClockCC.js +3 -2
- package/build/cjs/cc/ClockCC.js.map +2 -2
- package/build/cjs/cc/ColorSwitchCC.js +9 -6
- package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
- package/build/cjs/cc/ConfigurationCC.js +27 -27
- package/build/cjs/cc/ConfigurationCC.js.map +2 -2
- package/build/cjs/cc/DoorLockCC.js +49 -63
- package/build/cjs/cc/DoorLockCC.js.map +2 -2
- package/build/cjs/cc/DoorLockLoggingCC.js +3 -2
- package/build/cjs/cc/DoorLockLoggingCC.js.map +2 -2
- package/build/cjs/cc/EnergyProductionCC.js +3 -2
- package/build/cjs/cc/EnergyProductionCC.js.map +2 -2
- package/build/cjs/cc/EntryControlCC.js +5 -3
- package/build/cjs/cc/EntryControlCC.js.map +2 -2
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +2 -1
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlModeCC.js +9 -8
- package/build/cjs/cc/HumidityControlModeCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlOperatingStateCC.js +3 -2
- package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlSetpointCC.js +19 -17
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.js +5 -2
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/IrrigationCC.js +26 -27
- package/build/cjs/cc/IrrigationCC.js.map +2 -2
- package/build/cjs/cc/LanguageCC.js +3 -2
- package/build/cjs/cc/LanguageCC.js.map +2 -2
- package/build/cjs/cc/LockCC.js +3 -2
- package/build/cjs/cc/LockCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.js +4 -1
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
- package/build/cjs/cc/MeterCC.js +14 -13
- package/build/cjs/cc/MeterCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelAssociationCC.js +5 -2
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelCC.d.ts +1 -1
- package/build/cjs/cc/MultiChannelCC.js +19 -22
- package/build/cjs/cc/MultiChannelCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSensorCC.js +13 -8
- package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSwitchCC.js +5 -3
- package/build/cjs/cc/MultilevelSwitchCC.js.map +2 -2
- package/build/cjs/cc/NodeNamingCC.js +3 -2
- package/build/cjs/cc/NodeNamingCC.js.map +2 -2
- package/build/cjs/cc/NotificationCC.js +11 -11
- package/build/cjs/cc/NotificationCC.js.map +2 -2
- package/build/cjs/cc/ProtectionCC.js +16 -15
- package/build/cjs/cc/ProtectionCC.js.map +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.js +2 -1
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
- package/build/cjs/cc/ScheduleEntryLockCC.js +2 -1
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
- package/build/cjs/cc/Security2CC.js +15 -24
- package/build/cjs/cc/Security2CC.js.map +2 -2
- package/build/cjs/cc/SecurityCC.js +10 -17
- package/build/cjs/cc/SecurityCC.js.map +2 -2
- package/build/cjs/cc/SoundSwitchCC.js +2 -1
- package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanModeCC.js +9 -7
- package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanStateCC.js +3 -2
- package/build/cjs/cc/ThermostatFanStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatModeCC.js +9 -7
- package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatOperatingStateCC.js +4 -4
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetbackCC.js +3 -2
- package/build/cjs/cc/ThermostatSetbackCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetpointCC.js +9 -5
- package/build/cjs/cc/ThermostatSetpointCC.js.map +2 -2
- package/build/cjs/cc/TimeCC.js +2 -1
- package/build/cjs/cc/TimeCC.js.map +2 -2
- package/build/cjs/cc/TimeParametersCC.js +2 -1
- package/build/cjs/cc/TimeParametersCC.js.map +2 -2
- package/build/cjs/cc/UserCodeCC.js +6 -6
- package/build/cjs/cc/UserCodeCC.js.map +2 -2
- package/build/cjs/cc/UserCredentialCC.js +5 -2
- package/build/cjs/cc/UserCredentialCC.js.map +2 -2
- package/build/cjs/cc/VersionCC.js +2 -1
- package/build/cjs/cc/VersionCC.js.map +2 -2
- package/build/cjs/cc/WakeUpCC.js +2 -1
- package/build/cjs/cc/WakeUpCC.js.map +2 -2
- package/build/cjs/cc/WindowCoveringCC.js +10 -7
- package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
- package/build/cjs/cc/ZWavePlusCC.js +2 -1
- package/build/cjs/cc/ZWavePlusCC.js.map +2 -2
- package/build/cjs/cc/_CCValues.generated.d.ts +4 -4
- package/build/cjs/cc/_CCValues.generated.js +2 -2
- package/build/cjs/cc/_CCValues.generated.js.map +1 -1
- package/build/cjs/cc/index.d.ts +3 -3
- package/build/cjs/cc/index.js.map +2 -2
- package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +1 -1
- package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +2 -2
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +3 -2
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +2 -2
- package/build/cjs/lib/API.js.map +2 -2
- package/build/cjs/lib/CommandClass.d.ts +5 -1
- package/build/cjs/lib/CommandClass.js +25 -3
- package/build/cjs/lib/CommandClass.js.map +2 -2
- package/build/cjs/lib/CommandClassDecorators.d.ts +4 -4
- package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
- package/build/cjs/lib/Security2/Extension.d.ts +6 -4
- package/build/cjs/lib/Security2/Extension.js +22 -20
- package/build/cjs/lib/Security2/Extension.js.map +2 -2
- package/build/cjs/lib/_Types.js.map +1 -1
- package/build/cjs/lib/utils.js +14 -8
- package/build/cjs/lib/utils.js.map +2 -2
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +14 -18
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/AssociationCC.d.ts +1 -1
- package/build/esm/cc/AssociationCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC.js +3 -0
- 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 +24 -22
- 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 +8 -8
- 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 +2 -1
- 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 +2 -1
- 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 +7 -7
- 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 +2 -1
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +9 -8
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClockCC.d.ts.map +1 -1
- package/build/esm/cc/ClockCC.js +2 -1
- 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 +8 -7
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +32 -29
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC.js +73 -74
- 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 +2 -1
- package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/esm/cc/EnergyProductionCC.d.ts.map +1 -1
- package/build/esm/cc/EnergyProductionCC.js +2 -1
- 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 +3 -1
- 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 +1 -0
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.js +8 -9
- 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 +2 -1
- 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 +18 -23
- package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +3 -0
- 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 +29 -24
- 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 +2 -1
- 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 +2 -1
- package/build/esm/cc/LockCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +4 -1
- 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 +15 -19
- 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 +3 -0
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +19 -23
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +14 -19
- 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 +3 -1
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC.js +2 -1
- 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 +11 -14
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +15 -22
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +1 -0
- 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 +1 -0
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.d.ts.map +1 -1
- package/build/esm/cc/Security2CC.js +15 -32
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.d.ts.map +1 -1
- package/build/esm/cc/SecurityCC.js +10 -21
- 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 +1 -0
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +8 -8
- 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 +2 -1
- 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 +8 -8
- 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 +4 -5
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js +2 -1
- 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 +8 -9
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TimeCC.d.ts.map +1 -1
- package/build/esm/cc/TimeCC.js +1 -0
- 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 +1 -0
- package/build/esm/cc/TimeParametersCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +5 -7
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
- package/build/esm/cc/UserCredentialCC.js +4 -1
- package/build/esm/cc/UserCredentialCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +1 -0
- 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 +1 -0
- 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 +9 -9
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +1 -0
- package/build/esm/cc/ZWavePlusCC.js.map +1 -1
- package/build/esm/cc/_CCValues.generated.d.ts +4 -4
- package/build/esm/cc/_CCValues.generated.js +2 -2
- package/build/esm/cc/_CCValues.generated.js.map +1 -1
- package/build/esm/cc/index.d.ts +3 -3
- package/build/esm/cc/index.d.ts.map +1 -1
- package/build/esm/cc/index.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +1 -1
- package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
- package/build/esm/cc/manufacturerProprietary/Decorators.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +2 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/lib/API.js.map +1 -1
- package/build/esm/lib/CommandClass.d.ts +5 -1
- package/build/esm/lib/CommandClass.d.ts.map +1 -1
- package/build/esm/lib/CommandClass.js +30 -4
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/CommandClassDecorators.d.ts +4 -4
- package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
- package/build/esm/lib/CommandClassDecorators.js.map +1 -1
- package/build/esm/lib/Security2/Extension.d.ts +6 -4
- package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
- package/build/esm/lib/Security2/Extension.js +23 -21
- package/build/esm/lib/Security2/Extension.js.map +1 -1
- package/build/esm/lib/_Types.js +1 -1
- package/build/esm/lib/utils.d.ts.map +1 -1
- package/build/esm/lib/utils.js +15 -9
- package/build/esm/lib/utils.js.map +1 -1
- package/package.json +7 -7
|
@@ -339,7 +339,8 @@ let NotificationCC = (() => {
|
|
|
339
339
|
const node = this.getNode(ctx);
|
|
340
340
|
const endpoint = this.getEndpoint(ctx);
|
|
341
341
|
const api = import_API.CCAPI.create(import_core.CommandClasses.Notification, ctx, endpoint).withOptions({
|
|
342
|
-
priority: import_core.MessagePriority.NodeQuery
|
|
342
|
+
priority: import_core.MessagePriority.NodeQuery,
|
|
343
|
+
tag: "interview"
|
|
343
344
|
});
|
|
344
345
|
ctx.logNode(node.id, {
|
|
345
346
|
endpoint: this.endpointIndex,
|
|
@@ -375,8 +376,7 @@ let NotificationCC = (() => {
|
|
|
375
376
|
const supportedNotificationTypes = suppResponse.supportedNotificationTypes;
|
|
376
377
|
const supportedNotificationNames = supportedNotificationTypes.map(import_core.getNotificationName);
|
|
377
378
|
const supportedNotificationEvents = /* @__PURE__ */ new Map();
|
|
378
|
-
const logMessage =
|
|
379
|
-
\xB7 ${name}`).join("")}`;
|
|
379
|
+
const logMessage = (0, import_core.logText)("received supported notification types:", { nested: (0, import_core.logList)(supportedNotificationNames) });
|
|
380
380
|
ctx.logNode(node.id, {
|
|
381
381
|
endpoint: this.endpointIndex,
|
|
382
382
|
message: logMessage,
|
|
@@ -410,10 +410,12 @@ let NotificationCC = (() => {
|
|
|
410
410
|
}
|
|
411
411
|
if (notificationMode === "pull") {
|
|
412
412
|
await this.refreshValues(ctx, {
|
|
413
|
+
tag: "interview",
|
|
413
414
|
onProgress: /* @__PURE__ */ __name((completed, total) => node.reportInterviewProgress(completed, total), "onProgress")
|
|
414
415
|
});
|
|
415
416
|
} else {
|
|
416
417
|
await this.refreshValues(ctx, {
|
|
418
|
+
tag: "interview",
|
|
417
419
|
onProgress: /* @__PURE__ */ __name((completed, total) => node.reportInterviewProgress(completed, total), "onProgress")
|
|
418
420
|
});
|
|
419
421
|
for (let i = 0; i < supportedNotificationTypes.length; i++) {
|
|
@@ -544,7 +546,7 @@ let NotificationCC = (() => {
|
|
|
544
546
|
const events = NotificationCC2.getSupportedNotificationEvents(ctx, this.getNode(ctx), type);
|
|
545
547
|
if (!events)
|
|
546
548
|
continue;
|
|
547
|
-
for (const variable of notification.variables.filter((v) =>
|
|
549
|
+
for (const variable of notification.variables.filter((v) => v.idle)) {
|
|
548
550
|
if ([...variable.states.keys()].some((key) => events.includes(key))) {
|
|
549
551
|
const value = import_CCValues_generated.NotificationCCValues.notificationVariable(notification.name, variable.name);
|
|
550
552
|
if (this.getValue(ctx, value) == void 0) {
|
|
@@ -558,7 +560,8 @@ let NotificationCC = (() => {
|
|
|
558
560
|
const node = this.getNode(ctx);
|
|
559
561
|
const endpoint = this.getEndpoint(ctx);
|
|
560
562
|
const api = import_API.CCAPI.create(import_core.CommandClasses.Notification, ctx, endpoint).withOptions({
|
|
561
|
-
priority: options?.priority ?? import_core.MessagePriority.NodeQuery
|
|
563
|
+
priority: options?.priority ?? import_core.MessagePriority.NodeQuery,
|
|
564
|
+
tag: options?.tag
|
|
562
565
|
});
|
|
563
566
|
const supportedNotificationTypes = this.getValue(ctx, import_CCValues_generated.NotificationCCValues.supportedNotificationTypes) ?? [];
|
|
564
567
|
const supportedNotificationNames = supportedNotificationTypes.map(import_core.getNotificationName);
|
|
@@ -838,8 +841,7 @@ let NotificationCCReport = (() => {
|
|
|
838
841
|
} else if (this.eventParameters instanceof import_core.Duration) {
|
|
839
842
|
message["event parameters"] = this.eventParameters.toString();
|
|
840
843
|
} else {
|
|
841
|
-
message["event parameters"] = Object.entries(this.eventParameters).map(([param, val]) => `
|
|
842
|
-
${param}: ${(0, import_shared.num2hex)(val)}`).join("");
|
|
844
|
+
message["event parameters"] = (0, import_core.logList)(Object.entries(this.eventParameters).map(([param, val]) => `${param}: ${(0, import_shared.num2hex)(val)}`));
|
|
843
845
|
}
|
|
844
846
|
} else if (valueConfig?.parameter?.type === "enum" && valueConfig.parameter.default != void 0) {
|
|
845
847
|
const label = valueConfig.parameter.values[valueConfig.parameter.default];
|
|
@@ -1125,8 +1127,7 @@ let NotificationCCSupportedReport = (() => {
|
|
|
1125
1127
|
...super.toLogEntry(ctx),
|
|
1126
1128
|
message: {
|
|
1127
1129
|
"supports V1 alarm": this.supportsV1Alarm,
|
|
1128
|
-
"supported notification types": this.supportedNotificationTypes.map((t) =>
|
|
1129
|
-
\xB7 ${(0, import_core.getNotificationName)(t)}`).join("")
|
|
1130
|
+
"supported notification types": (0, import_core.logList)(this.supportedNotificationTypes.map((t) => (0, import_core.getNotificationName)(t)))
|
|
1130
1131
|
}
|
|
1131
1132
|
};
|
|
1132
1133
|
}
|
|
@@ -1242,8 +1243,7 @@ let NotificationCCEventSupportedReport = (() => {
|
|
|
1242
1243
|
...super.toLogEntry(ctx),
|
|
1243
1244
|
message: {
|
|
1244
1245
|
"notification type": (0, import_core.getNotificationName)(this.notificationType),
|
|
1245
|
-
"supported events": this.supportedEvents.map((e) =>
|
|
1246
|
-
\xB7 ${(0, import_core.getNotificationValueName)(this.notificationType, e)}`).join("")
|
|
1246
|
+
"supported events": (0, import_core.logList)(this.supportedEvents.map((e) => (0, import_core.getNotificationValueName)(this.notificationType, e)))
|
|
1247
1247
|
}
|
|
1248
1248
|
};
|
|
1249
1249
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src_gen/cc/NotificationCC.ts"],
|
|
4
|
-
"sourcesContent": ["import * as __validateArgs from \"./NotificationCC._validateArgs.js\";\nconst { validateArgs_NotificationCCAPI_sendReport, validateArgs_NotificationCCAPI_get, validateArgs_NotificationCCAPI_set, validateArgs_NotificationCCAPI_getSupportedEvents } = __validateArgs;\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport { CommandClasses, type ControlsCC, Duration, type EndpointId, type GetEndpoint, type GetNode, type GetSupportedCCVersion, type GetValueDB, type LogNode, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type NodeId, type Notification, type NotificationState, type NotificationValue, SecurityClass, type SinglecastCC, type SupervisionResult, type SupportsCC, type ValueID, ValueMetadata, type ValueMetadataNumeric, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, getCCName, getNotification, getNotificationEventName, getNotificationName, getNotificationValue, getNotificationValueName, isZWaveError, parseBitMask, timespan, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, type BytesView, buffer2hex, isUint8Array, num2hex, pick, } from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport { CCAPI, POLL_VALUE, PhysicalCCAPI, type PollValueImplementation, throwUnsupportedProperty, } from \"../lib/API.js\";\nimport { CCRaw, CommandClass, type InterviewContext, InvalidCC, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, getEffectiveCCVersion, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, getCCCommandConstructor, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { isNotificationEventPayload } from \"../lib/NotificationEventPayload.js\";\nimport { V } from \"../lib/Values.js\";\nimport { NotificationCommand, UserCodeCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { ApplicationStatusCCRejectedRequest } from \"./ApplicationStatusCC.js\";\nimport { AssociationGroupInfoCC } from \"./AssociationGroupInfoCC.js\";\nimport { NotificationCCValues } from \"./_CCValues.generated.js\";\nexport { NotificationCCValues };\nexport function shouldAutoCreateSyntheticDoorSensorValue(ctx: GetValueDB, endpoint: EndpointId): boolean {\n const valueDB = ctx.tryGetValueDB(endpoint.nodeId);\n if (!valueDB)\n return false;\n const supportedACEvents = valueDB.getValue<readonly number[]>(NotificationCCValues.supportedNotificationEvents(\n // Access Control\n 0x06).endpoint(endpoint.index));\n if (!supportedACEvents)\n return false;\n return (supportedACEvents.includes(\n // Window/door is open\n 0x16)\n && supportedACEvents.includes(\n // Window/door is closed\n 0x17));\n}\n@API(CommandClasses.Notification)\nexport class NotificationCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: NotificationCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case NotificationCommand.Report:\n case NotificationCommand.Get:\n return true; // These exist starting with V1\n case NotificationCommand.Set:\n case NotificationCommand.SupportedGet:\n return this.version >= 2;\n case NotificationCommand.EventSupportedGet:\n return this.version >= 3;\n }\n return super.supportsCommand(cmd);\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: NotificationCCAPI, { property, propertyKey }) {\n const valueId: ValueID = {\n commandClass: this.ccId,\n endpoint: this.endpoint.index,\n property,\n propertyKey,\n };\n if (NotificationCCValues.notificationVariable.is(valueId)) {\n const notificationType: number | undefined = this\n .tryGetValueDB()?.getMetadata(valueId)?.ccSpecific\n ?.notificationType;\n if (notificationType != undefined) {\n return this.getInternal({ notificationType });\n }\n }\n throwUnsupportedProperty(this.ccId, property);\n };\n }\n /**\n * @internal\n */\n public async getInternal(options: NotificationCCGetOptions): Promise<NotificationCCReport | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Get);\n const cc = new NotificationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n return this.host.sendCommand<NotificationCCReport>(cc, this.commandOptions);\n }\n @validateArgs_NotificationCCAPI_sendReport()\n public async sendReport(options: NotificationCCReportOptions): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Report);\n const cc = new NotificationCCReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_NotificationCCAPI_get()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get(options: NotificationCCGetOptions) {\n const response = await this.getInternal(options);\n if (response) {\n return pick(response, [\n \"notificationStatus\",\n \"notificationEvent\",\n \"alarmLevel\",\n \"eventParameters\",\n \"sequenceNumber\",\n ]);\n }\n }\n @validateArgs_NotificationCCAPI_set()\n public async set(notificationType: number, notificationStatus: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Set);\n const cc = new NotificationCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n notificationType,\n notificationStatus,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupported() {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.SupportedGet);\n const cc = new NotificationCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<NotificationCCSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"supportsV1Alarm\",\n \"supportedNotificationTypes\",\n ]);\n }\n }\n @validateArgs_NotificationCCAPI_getSupportedEvents()\n public async getSupportedEvents(notificationType: number): Promise<MaybeNotKnown<readonly number[]>> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.EventSupportedGet);\n const cc = new NotificationCCEventSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n notificationType,\n });\n const response = await this.host.sendCommand<NotificationCCEventSupportedReport>(cc, this.commandOptions);\n return response?.supportedEvents;\n }\n}\nexport function getNotificationEnumBehavior(notification: Notification, valueConfig: NotificationState): \"none\" | \"extend\" | \"replace\" {\n const variable = notification.variables.find((v) => v.states.has(valueConfig.value));\n if (!variable)\n return \"none\";\n const numStatesWithEnums = [...variable.states.values()].filter((val) => val.parameter?.type === \"enum\").length;\n if (numStatesWithEnums === 0)\n return \"none\";\n // An enum value replaces the original value if there is only a single possible state\n // which also has an enum parameter\n if (numStatesWithEnums === 1 && variable.states.size === 1) {\n return \"replace\";\n }\n return \"extend\";\n}\nexport function getNotificationStateValueWithEnum(stateValue: number, enumValue: number): number {\n return (stateValue << 8) | enumValue;\n}\n/**\n * Returns the metadata to use for a known notification value.\n * Can be used to extend a previously defined metadata,\n * e.g. for V2 notifications that don't allow discovering supported events.\n */\nexport function getNotificationValueMetadata(previous: ValueMetadataNumeric | undefined, notification: Notification, valueConfig: NotificationState): ValueMetadataNumeric {\n const metadata: ValueMetadataNumeric = previous ?? {\n ...ValueMetadata.ReadOnlyUInt8,\n label: valueConfig.variableName,\n states: {},\n ccSpecific: {\n notificationType: notification.type,\n },\n };\n if (valueConfig.idle) {\n metadata.states![0] = \"idle\";\n }\n const enumBehavior = getNotificationEnumBehavior(notification, valueConfig);\n if (enumBehavior !== \"replace\") {\n metadata.states![valueConfig.value] = valueConfig.label;\n }\n if (valueConfig.parameter?.type === \"enum\") {\n for (const [key, label] of Object.entries(valueConfig.parameter.values)) {\n const value = parseInt(key);\n const stateKey = enumBehavior === \"replace\"\n ? value\n : getNotificationStateValueWithEnum(valueConfig.value, value);\n metadata.states![stateKey] = label;\n }\n }\n return metadata;\n}\n@commandClass(CommandClasses.Notification)\n@implementedVersion(8)\n@ccValues(NotificationCCValues)\nexport class NotificationCC extends CommandClass {\n declare ccCommand: NotificationCommand;\n // former AlarmCC (v1..v2)\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n CommandClasses[\"Multi Channel Association\"],\n CommandClasses[\"Association Group Information\"],\n ];\n }\n private async determineNotificationMode(ctx: GetValueDB & GetNode<NodeId & SupportsCC> & LogNode, api: NotificationCCAPI, supportedNotificationEvents: ReadonlyMap<number, readonly number[]>): Promise<\"push\" | \"pull\"> {\n const node = this.getNode(ctx)!;\n // SDS14223: If the supporting node does not support the Association Command Class,\n // it may be concluded that the supporting node implements Pull Mode and discovery may be aborted.\n if (!node.supportsCC(CommandClasses.Association))\n return \"pull\";\n if (node.supportsCC(CommandClasses[\"Association Group Information\"])) {\n try {\n const groupsIssueingNotifications = AssociationGroupInfoCC\n .findGroupsForIssuedCommand(ctx, node, this.ccId, NotificationCommand.Report);\n return groupsIssueingNotifications.length > 0 ? \"push\" : \"pull\";\n }\n catch {\n // We might be dealing with an older cache file, fall back to testing\n }\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `determining whether this node is pull or push...`,\n direction: \"outbound\",\n });\n // Find a notification type with at least one supported event\n for (const [type, events] of supportedNotificationEvents) {\n if (events.length === 0)\n continue;\n // Enable the event and request the status\n await api.set(type, true);\n try {\n const resp = await api.get({\n notificationType: type,\n notificationEvent: events[0],\n });\n switch (resp?.notificationStatus) {\n case 0xff:\n return \"push\";\n case 0xfe:\n case 0x00:\n return \"pull\";\n }\n }\n catch {\n /* ignore */\n }\n }\n // If everything failed, e.g. because the node is V1/V2, assume this is a \"push\" node.\n // If we assumed \"pull\", we would have to query the node regularly, which can cause\n // the node to return old (already handled) notifications.\n // https://github.com/zwave-js/zwave-js/issues/5626\n return \"push\";\n }\n /** Whether the node implements push or pull notifications */\n public static getNotificationMode(ctx: GetValueDB, node: NodeId): MaybeNotKnown<\"push\" | \"pull\"> {\n return ctx\n .getValueDB(node.id)\n .getValue(NotificationCCValues.notificationMode.id);\n }\n /** Returns the supported notification events for a given notification type */\n public static getSupportedNotificationEvents(ctx: GetValueDB, node: NodeId, type: number): MaybeNotKnown<readonly number[]> {\n return ctx\n .getValueDB(node.id)\n .getValue(NotificationCCValues.supportedNotificationEvents(type).id);\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // If one Association group issues Notification Reports,\n // we must associate ourselves with that channel\n try {\n await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, NotificationCommand.Report);\n }\n catch {\n ctx.logNode(node.id, {\n endpoint: endpoint.index,\n message: `Configuring associations to receive ${getCCName(this.ccId)} reports failed!`,\n level: \"warn\",\n });\n }\n let supportsV1Alarm = false;\n if (api.version >= 2) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported notification types...\",\n direction: \"outbound\",\n });\n const suppResponse = await api.getSupported();\n if (!suppResponse) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported notification types timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n supportsV1Alarm = suppResponse.supportsV1Alarm;\n const supportedNotificationTypes = suppResponse.supportedNotificationTypes;\n const supportedNotificationNames = supportedNotificationTypes.map(getNotificationName);\n const supportedNotificationEvents = new Map<number, readonly number[]>();\n const logMessage = `received supported notification types:${supportedNotificationNames\n .map((name) => `\\n\u00B7 ${name}`)\n .join(\"\")}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n if (api.version >= 3) {\n // Query each notification for its supported events\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying supported notification events for ${name}...`,\n direction: \"outbound\",\n });\n const supportedEvents = await api.getSupportedEvents(type);\n if (supportedEvents) {\n supportedNotificationEvents.set(type, supportedEvents);\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `received supported notification events for ${name}: ${supportedEvents\n .map(String)\n .join(\", \")}`,\n direction: \"inbound\",\n });\n }\n node.reportInterviewProgress(i + 1, supportedNotificationTypes.length);\n }\n }\n // Determine whether the node is a push or pull node\n let notificationMode = this.getValue<\"push\" | \"pull\">(ctx, NotificationCCValues.notificationMode);\n if (notificationMode !== \"push\" && notificationMode !== \"pull\") {\n notificationMode = await this.determineNotificationMode(ctx, api, supportedNotificationEvents);\n this.setValue(ctx, NotificationCCValues.notificationMode, notificationMode);\n }\n if (notificationMode === \"pull\") {\n await this.refreshValues(ctx, {\n onProgress: (completed, total) => node.reportInterviewProgress(completed, total),\n });\n } /* if (notificationMode === \"push\") */\n else {\n // First, query the current state of each supported notification\n await this.refreshValues(ctx, {\n onProgress: (completed, total) => node.reportInterviewProgress(completed, total),\n });\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n // Enable reports for each notification type\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `enabling notifications for ${name}...`,\n direction: \"outbound\",\n });\n await api.set(type, true);\n node.reportInterviewProgress(i + 1, supportedNotificationTypes.length);\n }\n }\n }\n // Only create metadata for V1 values if necessary\n if (api.version === 1 || supportsV1Alarm) {\n this.ensureMetadata(ctx, NotificationCCValues.alarmType);\n this.ensureMetadata(ctx, NotificationCCValues.alarmLevel);\n }\n // Create metadata and internal values for alarm mappings\n this.applyAlarmMappingCompat(ctx);\n // Apply notification remappings\n this.applyNotificationRemappings(ctx);\n // Set idle values from (potentially remapped) supported events\n this.initNotificationIdleValues(ctx);\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n /**\n * Applies the `alarmMapping` compat flag by adding metadata and supported notification\n * types/events for the alarm mapping targets.\n */\n private applyAlarmMappingCompat(ctx: InterviewContext): void {\n const mappings = ctx.getDeviceConfig?.(this.nodeId as number)\n ?.compat?.alarmMapping;\n if (!mappings)\n return;\n const node = this.getNode(ctx)!;\n const supportedNotifications = new Map<number, Set<number>>();\n // Preserve the notification types and events discovered during the interview\n for (const type of (this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [])) {\n supportedNotifications.set(type, new Set(NotificationCC.getSupportedNotificationEvents(ctx, node, type) ?? []));\n }\n // Find all mappings to a valid notification variable\n for (const { to } of mappings) {\n const notification = getNotification(to.notificationType);\n if (!notification)\n continue;\n const valueConfig = getNotificationValue(notification, to.notificationEvent);\n // Remember supported notification types and events to create the internal values later\n if (!supportedNotifications.has(to.notificationType)) {\n supportedNotifications.set(to.notificationType, new Set());\n }\n const supportedNotificationTypesSet = supportedNotifications\n .get(to.notificationType)!;\n supportedNotificationTypesSet.add(to.notificationEvent);\n if (valueConfig?.type !== \"state\")\n continue;\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n // Create or update the metadata\n const metadata = getNotificationValueMetadata(this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n }\n // Remember supported notification types and events in the cache\n this.setValue(ctx, NotificationCCValues.supportedNotificationTypes, [...supportedNotifications.keys()]);\n for (const [type, events] of supportedNotifications) {\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);\n }\n }\n /**\n * Applies the `remapNotifications` compat flag by modifying the supported notification\n * types/events in cache and creating metadata for remapping targets.\n */\n private applyNotificationRemappings(ctx: InterviewContext): void {\n const remappings = ctx.getDeviceConfig?.(this.nodeId as number)\n ?.compat?.remapNotifications;\n if (!remappings?.length)\n return;\n ctx.logNode(this.nodeId as number, {\n message: `Applying notification remapping compat flag...`,\n direction: \"none\",\n level: \"verbose\",\n });\n // Load current supported types and events from cache\n const supportedTypes = new Set<number>(this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? []);\n const supportedEvents = new Map<number, Set<number>>();\n for (const type of supportedTypes) {\n const events = NotificationCC.getSupportedNotificationEvents(ctx, this.getNode(ctx)!, type);\n if (events) {\n supportedEvents.set(type, new Set(events));\n }\n }\n for (const mapping of remappings) {\n // Remove the original event from supported events\n const fromEvents = supportedEvents.get(mapping.from.notificationType);\n if (fromEvents) {\n fromEvents.delete(mapping.from.notificationEvent);\n if (fromEvents.size === 0) {\n supportedEvents.delete(mapping.from.notificationType);\n supportedTypes.delete(mapping.from.notificationType);\n }\n }\n // Only add target events for normal remaps\n if (mapping.action.type === \"remap\") {\n const to = mapping.action.to;\n supportedTypes.add(to.notificationType);\n if (!supportedEvents.has(to.notificationType)) {\n supportedEvents.set(to.notificationType, new Set());\n }\n supportedEvents.get(to.notificationType)!.add(to.notificationEvent);\n }\n }\n // Persist updated supported types and events\n this.setValue(ctx, NotificationCCValues.supportedNotificationTypes, [...supportedTypes]);\n for (const [type, events] of supportedEvents) {\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);\n }\n // Rebuild metadata for all supported events (since we may have removed\n // some events and added others, the previous metadata may be stale)\n for (const [type, events] of supportedEvents) {\n const notification = getNotification(type);\n if (!notification)\n continue;\n let isFirst = true;\n for (const value of events) {\n const valueConfig = getNotificationValue(notification, value);\n if (valueConfig?.type !== \"state\")\n continue;\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n const metadata = getNotificationValueMetadata(isFirst\n ? undefined\n : this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n isFirst = false;\n }\n }\n }\n /**\n * Sets idle values for all supported notification variables that have an idle state\n * and don't have a value yet.\n */\n private initNotificationIdleValues(ctx: InterviewContext): void {\n const supportedTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];\n for (const type of supportedTypes) {\n const notification = getNotification(type);\n if (!notification)\n continue;\n // Reads supported events from cache so it works correctly\n // after compat remappings have been applied.\n const events = NotificationCC.getSupportedNotificationEvents(ctx, this.getNode(ctx)!, type);\n if (!events)\n continue;\n // Find all variables that are supported by this node and have an idle state\n for (const variable of notification.variables\n .filter((v) => !!v.idle)) {\n if ([...variable.states.keys()].some((key) => events.includes(key))) {\n const value = NotificationCCValues\n .notificationVariable(notification.name, variable.name);\n // Set the value to idle if it has no value yet\n // TODO: GH#1028\n // * do this only if the last update was more than 5 minutes ago\n // * schedule an auto-idle if the last update was less than 5 minutes ago but before the current applHost start\n if (this.getValue(ctx, value) == undefined) {\n this.setValue(ctx, value, 0);\n }\n }\n }\n }\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n });\n // Load supported notification types and events from cache\n const supportedNotificationTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];\n const supportedNotificationNames = supportedNotificationTypes.map(getNotificationName);\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n // Always query each notification for its current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying notification status for ${name}...`,\n direction: \"outbound\",\n });\n const response = await api.getInternal({\n notificationType: type,\n });\n // NotificationReports don't store their values themselves,\n // because the behaviour is too complex and spans the lifetime\n // of several reports. Thus we handle it in the Node instance\n if (response) {\n // @ts-expect-error\n await node.handleCommand(response);\n }\n options?.onProgress?.(i + 1, supportedNotificationTypes.length);\n }\n // Remember when we did this\n this.setValue(ctx, NotificationCCValues.lastRefresh, Date.now());\n }\n public shouldRefreshValues(this: SinglecastCC<this>, ctx: GetValueDB & GetSupportedCCVersion & GetDeviceConfig & GetNode<NodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>>): boolean {\n // Pull-mode nodes must be polled regularly\n const isPullMode = NotificationCC.getNotificationMode(ctx, this.getNode(ctx)!) === \"pull\";\n if (!isPullMode)\n return false;\n const lastUpdated = this.getValue<number>(ctx, NotificationCCValues.lastRefresh);\n return (lastUpdated == undefined\n || Date.now() - lastUpdated > timespan.hours(6));\n }\n}\n// @publicAPI\nexport interface NotificationCCSetOptions {\n notificationType: number;\n notificationStatus: boolean;\n}\nfunction getCCResponseForNotificationCCSet(ctx: GetNode<NodeId & SupportsCC>, sent: NotificationCCSet) {\n // CC:0071.03.06.11.008: A receiving node MAY deny the deactivation\n // of a specific Notification Type. In that case, the receiving node\n // MUST respond to this command with an Application Rejected Request\n // Command.\n if (sent.isSinglecast()\n && !sent.notificationStatus\n && !sent.isEncapsulatedWith(CommandClasses.Supervision)\n && ctx.getNode(sent.nodeId)?.supportsCC(CommandClasses[\"Application Status\"])) {\n return ApplicationStatusCCRejectedRequest;\n }\n}\n@CCCommand(NotificationCommand.Set)\n@expectedCCResponse(getCCResponseForNotificationCCSet)\n@useSupervision()\nexport class NotificationCCSet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCSetOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n this.notificationStatus = options.notificationStatus;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCSet {\n validatePayload(raw.payload.length >= 2);\n const notificationType = raw.payload[0];\n const notificationStatus = raw.payload[1] === 0xff;\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n notificationStatus,\n });\n }\n public notificationType: number;\n public notificationStatus: boolean;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.notificationType,\n this.notificationStatus ? 0xff : 0x00,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n status: this.notificationStatus,\n },\n };\n }\n}\n// @publicAPI\nexport type NotificationCCReportOptions = {\n alarmType?: number;\n alarmLevel?: number;\n notificationType?: number;\n notificationEvent?: number;\n notificationStatus?: number;\n eventParameters?: BytesView;\n sequenceNumber?: number;\n};\n@CCCommand(NotificationCommand.Report)\n@useSupervision()\nexport class NotificationCCReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCReportOptions>) {\n super(options);\n if (options.alarmType != undefined) {\n this.alarmType = options.alarmType;\n this.alarmLevel = options.alarmLevel;\n }\n if (options.notificationType != undefined) {\n this.notificationType = options.notificationType;\n this.notificationStatus = options.notificationStatus ?? true;\n this.notificationEvent = options.notificationEvent;\n this.eventParameters = options.eventParameters;\n this.sequenceNumber = options.sequenceNumber;\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCReport {\n validatePayload(raw.payload.length >= 2);\n const alarmType = raw.payload[0];\n const alarmLevel = raw.payload[1];\n // Byte 2 used to be zensorNetSourceNodeId in V2 and V3, but we don't care about that\n if (raw.payload.length < 7) {\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n alarmLevel,\n });\n }\n // V2+ requires the alarm bytes to be zero. Manufacturers don't care though, so we don't enforce that.\n // Don't use the version to decide because we might discard notifications\n // before the interview is complete\n const notificationStatus = raw.payload[3];\n const notificationType = raw.payload[4];\n const notificationEvent = raw.payload[5];\n const containsSeqNum = !!(raw.payload[6] & 128);\n const numEventParams = raw.payload[6] & 0b11111;\n let eventParameters: BytesView | undefined;\n if (numEventParams > 0) {\n validatePayload(raw.payload.length >= 7 + numEventParams);\n eventParameters = raw.payload.subarray(7, 7 + numEventParams);\n }\n let sequenceNumber: number | undefined;\n if (containsSeqNum) {\n validatePayload(raw.payload.length >= 7 + numEventParams + 1);\n sequenceNumber = raw.payload[7 + numEventParams];\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n alarmLevel,\n notificationStatus,\n notificationType,\n notificationEvent,\n eventParameters,\n sequenceNumber,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const ccVersion = getEffectiveCCVersion(ctx, this);\n // Check if we need to re-interpret the alarm values somehow\n if (this.alarmType != undefined\n && this.alarmLevel != undefined\n && this.alarmType !== 0) {\n if (ccVersion >= 2) {\n // Check if the device actually supports Notification CC, but chooses\n // to send Alarm frames instead (GH#1034)\n const supportedNotificationTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes);\n if (isArray(supportedNotificationTypes)\n && supportedNotificationTypes.includes(this.alarmType)) {\n const supportedNotificationEvents = NotificationCC\n .getSupportedNotificationEvents(ctx, this.getNode(ctx)!, this.alarmType);\n if (isArray(supportedNotificationEvents)\n && supportedNotificationEvents.includes(this.alarmLevel)) {\n // This alarm frame corresponds to a valid notification event\n ctx.logNode(this.nodeId as number, `treating V1 Alarm frame as Notification Report`);\n this.notificationType = this.alarmType;\n this.notificationEvent = this.alarmLevel;\n this.alarmType = undefined;\n this.alarmLevel = undefined;\n }\n }\n }\n else {\n // V1 Alarm, check if there is a compat option to map this V1 report to a V2+ report\n const mapping = ctx.getDeviceConfig?.(this.nodeId as number)?.compat?.alarmMapping;\n const match = mapping?.find((m) => m.from.alarmType === this.alarmType\n && (m.from.alarmLevel == undefined\n || m.from.alarmLevel === this.alarmLevel));\n if (match) {\n ctx.logNode(this.nodeId as number, `compat mapping found, treating V1 Alarm frame as Notification Report`);\n this.notificationType = match.to.notificationType;\n this.notificationEvent = match.to.notificationEvent;\n if (match.to.eventParameters) {\n this.eventParameters = {};\n for (const [key, val] of Object.entries(match.to.eventParameters)) {\n if (typeof val === \"number\") {\n this.eventParameters[key] = val;\n }\n else if (val === \"alarmLevel\") {\n this.eventParameters[key] = this.alarmLevel;\n }\n }\n }\n // After mapping we do not set the legacy V1 values to undefined\n // Otherwise, adding a new mapping will be a breaking change\n }\n }\n }\n // Now we can interpret the event parameters and turn them into something useful\n this.parseEventParameters(ctx);\n if (this.alarmType != undefined) {\n const alarmTypeValue = NotificationCCValues.alarmType;\n this.ensureMetadata(ctx, alarmTypeValue);\n this.setValue(ctx, alarmTypeValue, this.alarmType);\n }\n if (this.alarmLevel != undefined) {\n const alarmLevelValue = NotificationCCValues.alarmLevel;\n this.ensureMetadata(ctx, alarmLevelValue);\n this.setValue(ctx, alarmLevelValue, this.alarmLevel);\n }\n return true;\n }\n public alarmType: number | undefined;\n public alarmLevel: number | undefined;\n public notificationType: number | undefined;\n public notificationStatus: boolean | number | undefined;\n public notificationEvent: number | undefined;\n public eventParameters: BytesView | Duration | Record<string, number> | number | undefined;\n public sequenceNumber: number | undefined;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n let message: MessageRecord = {};\n if (this.alarmType) {\n message = {\n \"V1 alarm type\": this.alarmType,\n \"V1 alarm level\": this.alarmLevel!,\n };\n }\n let valueConfig: NotificationValue | undefined;\n if (this.notificationType) {\n const notification = getNotification(this.notificationType);\n if (notification) {\n valueConfig = getNotificationValue(notification, this.notificationEvent!);\n }\n if (valueConfig) {\n message = {\n ...message,\n \"notification type\": getNotificationName(this.notificationType),\n \"notification status\": this.notificationStatus!,\n [`notification ${valueConfig.type}`]: valueConfig.label\n ?? `Unknown (${num2hex(this.notificationEvent)})`,\n };\n }\n else if (this.notificationEvent === 0x00) {\n message = {\n ...message,\n \"notification type\": this.notificationType,\n \"notification status\": this.notificationStatus!,\n \"notification state\": \"idle\",\n };\n }\n else {\n message = {\n ...message,\n \"notification type\": this.notificationType,\n \"notification status\": this.notificationStatus!,\n \"notification event\": num2hex(this.notificationEvent),\n };\n }\n }\n if (this.sequenceNumber != undefined) {\n message[\"sequence number\"] = this.sequenceNumber;\n }\n if (this.eventParameters != undefined) {\n if (typeof this.eventParameters === \"number\") {\n // Try to look up the enum label\n let found = false;\n if (valueConfig?.parameter?.type === \"enum\") {\n const label = valueConfig.parameter.values[this.eventParameters];\n if (label) {\n message[\"state parameters\"] = label;\n found = true;\n }\n }\n if (!found) {\n message[\"state parameters\"] = num2hex(this.eventParameters);\n }\n }\n else if (isUint8Array(this.eventParameters)) {\n message[\"event parameters\"] = buffer2hex(this.eventParameters);\n }\n else if (this.eventParameters instanceof Duration) {\n message[\"event parameters\"] = this.eventParameters.toString();\n }\n else {\n message[\"event parameters\"] = Object.entries(this.eventParameters)\n .map(([param, val]) => `\\n ${param}: ${num2hex(val)}`)\n .join(\"\");\n }\n }\n else if (valueConfig?.parameter?.type === \"enum\"\n && valueConfig.parameter.default != undefined) {\n const label = valueConfig.parameter.values[valueConfig.parameter.default];\n if (label) {\n message[\"state parameters\"] = `${label} (omitted)`;\n }\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n private parseEventParameters(ctx: PersistValuesContext): void {\n // This only makes sense for V2+ notifications\n if (this.notificationType == undefined\n || this.notificationEvent == undefined) {\n return;\n }\n // Look up the received notification and value in the config\n const notification = getNotification(this.notificationType);\n if (!notification)\n return;\n const valueConfig = getNotificationValue(notification, this.notificationEvent);\n if (!valueConfig)\n return;\n // Parse the event parameters if possible\n if (valueConfig.parameter?.type === \"duration\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // The parameters contain a Duration\n this.eventParameters = Duration.parseReport(this.eventParameters[0]);\n }\n else if (valueConfig.parameter?.type === \"commandclass\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // The parameters **should** contain a CC, however there might be some exceptions\n if (this.eventParameters.length === 1\n && notification.type === 0x06\n && (this.notificationEvent === 0x05\n || this.notificationEvent === 0x06)) {\n // Access control -> Keypad Lock/Unlock operation\n // Some devices only send the User ID, not a complete CC payload\n this.eventParameters = {\n userId: this.eventParameters[0],\n };\n }\n else {\n // Try to parse the event parameters - if this fails, we should still handle the notification report\n try {\n // Convert CommandClass instances to a standardized object representation\n // We do not want to parse asynchronously here, but the `CommandClass.parse` method is async.\n // However, we only deal with simple CCs that can be parsed synchronously. We can do this\n // by replicating what `CommandClass.parse` does: determine the correct CC class and call its\n // `from` method. If that returns a CC instance, we're good to continue.\n const raw = CCRaw.parse(this.eventParameters);\n if (raw.ccCommand == undefined) {\n validatePayload.fail(\"event parameters contain an invalid CC\");\n }\n const CommandConstructor = getCCCommandConstructor(raw.ccId, raw.ccCommand);\n if (!CommandConstructor) {\n validatePayload.fail(\"event parameters contain an invalid CC\");\n }\n const cc = CommandConstructor.from(raw, {\n ...ctx,\n frameType: \"singlecast\",\n sourceNodeId: this.nodeId as number,\n // Security encapsulation is handled outside of this CC,\n // so it is not needed here:\n hasSecurityClass: () => false,\n getHighestSecurityClass: () => SecurityClass.None,\n setSecurityClass: () => { },\n securityManager: undefined,\n securityManager2: undefined,\n securityManagerLR: undefined,\n });\n if (cc instanceof Promise) {\n validatePayload.fail(\"Cannot asynchronously parse CC from event parameters\");\n }\n validatePayload(!(cc instanceof InvalidCC));\n cc.encapsulatingCC = this as any;\n if (isNotificationEventPayload(cc)) {\n this.eventParameters = cc\n .toNotificationEventParameters();\n }\n else {\n // If a CC has no good toJSON() representation, we're only interested in the payload\n let json = cc.toJSON();\n if (\"nodeId\" in json\n && \"ccId\" in json\n && \"payload\" in json) {\n json = pick(json, [\"payload\"]);\n }\n this.eventParameters = json;\n }\n }\n catch (e) {\n if (isZWaveError(e)\n && e.code\n === ZWaveErrorCodes.PacketFormat_InvalidPayload\n && isUint8Array(this.eventParameters)) {\n const { ccId, ccCommand } = CCRaw.parse(this.eventParameters);\n if (ccId === CommandClasses[\"User Code\"]\n && ccCommand === UserCodeCommand.Report\n && this.eventParameters.length >= 3) {\n // Access control -> Keypad Lock/Unlock operation\n // Some devices report the user code with truncated UserCode reports\n this.eventParameters = {\n userId: this.eventParameters[2],\n };\n }\n else {\n ctx.logNode(this.nodeId as number, `Failed to parse Notification CC event parameters, ignoring them...`, \"error\");\n }\n }\n else {\n // unexpected error\n throw e;\n }\n }\n }\n }\n else if (valueConfig.parameter?.type === \"value\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // readUIntBE supports at most 6 bytes; a longer (or empty) value\n // must not reach it, or it throws a RangeError that would escape\n // the parser and crash the driver\n validatePayload(this.eventParameters.length >= 1\n && this.eventParameters.length <= 6);\n // The parameters contain a named value\n this.eventParameters = {\n [valueConfig.parameter.propertyName]: Bytes.view(this.eventParameters)\n .readUIntBE(0, this.eventParameters.length),\n };\n }\n else if (valueConfig.parameter?.type === \"enum\") {\n // The parameters may contain an enum value\n this.eventParameters = isUint8Array(this.eventParameters)\n && this.eventParameters.length === 1\n ? this.eventParameters[0]\n : undefined;\n // Some devices send notifications without an event parameter when they should.\n // In this case, fall back to the default value where possible.\n if (this.eventParameters == undefined\n && valueConfig.parameter.default != undefined) {\n this.eventParameters = valueConfig.parameter.default;\n }\n }\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n if (this.notificationType != undefined) {\n if (this.notificationEvent == undefined) {\n throw new ZWaveError(`Notification CC reports requires the notification event to be set!`, ZWaveErrorCodes.Argument_Invalid);\n }\n else if (this.eventParameters != undefined\n && !isUint8Array(this.eventParameters)) {\n throw new ZWaveError(`When sending Notification CC reports, the event parameters can only be buffers!`, ZWaveErrorCodes.Argument_Invalid);\n }\n const controlByte = (this.sequenceNumber != undefined ? 128 : 0)\n | ((this.eventParameters?.length ?? 0) & 0b11111);\n this.payload = Bytes.from([\n 0,\n 0,\n 0,\n 0xff,\n this.notificationType,\n this.notificationEvent,\n controlByte,\n ]);\n if (this.eventParameters) {\n this.payload = Bytes.concat([\n this.payload,\n this.eventParameters,\n ]);\n }\n if (this.sequenceNumber != undefined) {\n this.payload = Bytes.concat([\n this.payload,\n [this.sequenceNumber],\n ]);\n }\n }\n else {\n this.payload = Bytes.from([\n this.alarmType ?? 0x00,\n this.alarmLevel ?? 0x00,\n ]);\n }\n return super.serialize(ctx);\n }\n}\n// @publicAPI\nexport type NotificationCCGetOptions = {\n alarmType: number;\n} | {\n notificationType: number;\n notificationEvent?: number;\n};\n@CCCommand(NotificationCommand.Get)\n@expectedCCResponse(NotificationCCReport)\nexport class NotificationCCGet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCGetOptions>) {\n super(options);\n if (\"alarmType\" in options) {\n this.alarmType = options.alarmType;\n }\n else {\n this.notificationType = options.notificationType;\n this.notificationEvent = options.notificationEvent;\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCGet {\n validatePayload(raw.payload.length >= 1);\n if (raw.payload.length >= 2) {\n const notificationType = raw.payload[1];\n let notificationEvent: number | undefined;\n if (raw.payload.length >= 3 && notificationType != 0xff) {\n notificationEvent = raw.payload[2];\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n notificationEvent,\n });\n }\n else {\n const alarmType = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n });\n }\n }\n /** Proprietary V1/V2 alarm type */\n public alarmType: number | undefined;\n /** Regulated V3+ notification type */\n public notificationType: number | undefined;\n public notificationEvent: number | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const notificationEvent = this.notificationEvent === 0xff\n ? 0x00\n : this.notificationEvent;\n this.payload = Bytes.from([\n this.alarmType ?? 0x00,\n this.notificationType ?? 0xff,\n notificationEvent ?? 0x00,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.alarmType != undefined) {\n message[\"V1 alarm type\"] = this.alarmType;\n }\n if (this.notificationType != undefined) {\n message[\"notification type\"] = getNotificationName(this.notificationType);\n if (this.notificationEvent != undefined) {\n message[\"notification event\"] = getNotificationEventName(this.notificationType, this.notificationEvent);\n }\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface NotificationCCSupportedReportOptions {\n supportsV1Alarm: boolean;\n supportedNotificationTypes: number[];\n}\n@CCCommand(NotificationCommand.SupportedReport)\n@ccValueProperty(\"supportsV1Alarm\", NotificationCCValues.supportsV1Alarm)\n@ccValueProperty(\"supportedNotificationTypes\", NotificationCCValues.supportedNotificationTypes)\nexport class NotificationCCSupportedReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCSupportedReportOptions>) {\n super(options);\n this.supportsV1Alarm = options.supportsV1Alarm;\n this.supportedNotificationTypes = options.supportedNotificationTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const supportsV1Alarm = !!(raw.payload[0] & 128);\n const numBitMaskBytes = raw.payload[0] & 31;\n validatePayload(numBitMaskBytes > 0, raw.payload.length >= 1 + numBitMaskBytes);\n const notificationBitMask = raw.payload.subarray(1, 1 + numBitMaskBytes);\n const supportedNotificationTypes = parseBitMask(notificationBitMask, \n // bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0\n 0);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportsV1Alarm,\n supportedNotificationTypes,\n });\n }\n public supportsV1Alarm: boolean;\n public supportedNotificationTypes: number[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const bitMask = encodeBitMask(this.supportedNotificationTypes, Math.max(...this.supportedNotificationTypes), 0);\n this.payload = Bytes.concat([\n [\n (this.supportsV1Alarm ? 128 : 0) | bitMask.length,\n ],\n bitMask,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supports V1 alarm\": this.supportsV1Alarm,\n \"supported notification types\": this.supportedNotificationTypes\n .map((t) => `\\n\u00B7 ${getNotificationName(t)}`)\n .join(\"\"),\n },\n };\n }\n}\n@CCCommand(NotificationCommand.SupportedGet)\n@expectedCCResponse(NotificationCCSupportedReport)\nexport class NotificationCCSupportedGet extends NotificationCC {\n}\n// @publicAPI\nexport interface NotificationCCEventSupportedReportOptions {\n notificationType: number;\n supportedEvents: number[];\n}\n@CCCommand(NotificationCommand.EventSupportedReport)\nexport class NotificationCCEventSupportedReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCEventSupportedReportOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n this.supportedEvents = options.supportedEvents;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCEventSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const notificationType = raw.payload[0];\n const numBitMaskBytes = raw.payload[1] & 31;\n if (numBitMaskBytes === 0) {\n // Notification type is not supported\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n supportedEvents: [],\n });\n }\n validatePayload(raw.payload.length >= 2 + numBitMaskBytes);\n const eventBitMask = raw.payload.subarray(2, 2 + numBitMaskBytes);\n const supportedEvents = parseBitMask(eventBitMask, \n // In this mask, bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0\n 0);\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n supportedEvents,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Store which events this notification supports\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(this.notificationType), this.supportedEvents);\n // For each event, predefine the value metadata\n const notification = getNotification(this.notificationType);\n if (!notification) {\n // This is an unknown notification\n this.setMetadata(ctx, NotificationCCValues.unknownNotificationType(this.notificationType));\n }\n else {\n // This is a standardized notification\n let isFirst = true;\n for (const value of this.supportedEvents) {\n // Find out which property we need to update\n const valueConfig = getNotificationValue(notification, value);\n if (valueConfig?.type === \"state\") {\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n // After we've created the metadata initially, extend it\n const metadata = getNotificationValueMetadata(isFirst\n ? undefined\n : this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n isFirst = false;\n }\n }\n }\n return true;\n }\n public notificationType: number;\n public supportedEvents: number[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.notificationType, 0]);\n if (this.supportedEvents.length > 0) {\n const bitMask = encodeBitMask(this.supportedEvents, Math.max(...this.supportedEvents), 0);\n this.payload[1] = bitMask.length;\n this.payload = Bytes.concat([this.payload, bitMask]);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n \"supported events\": this.supportedEvents\n .map((e) => `\\n\u00B7 ${getNotificationValueName(this.notificationType, e)}`)\n .join(\"\"),\n },\n };\n }\n}\n// @publicAPI\nexport interface NotificationCCEventSupportedGetOptions {\n notificationType: number;\n}\n@CCCommand(NotificationCommand.EventSupportedGet)\n@expectedCCResponse(NotificationCCEventSupportedReport)\nexport class NotificationCCEventSupportedGet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCEventSupportedGetOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCEventSupportedGet {\n validatePayload(raw.payload.length >= 1);\n const notificationType = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n });\n }\n public notificationType: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.notificationType]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n },\n };\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAGhC,kBAA6rB;AAC7rB,oBAAgF;AAChF,wBAAwB;AACxB,iBAA0G;AAC1G,0BAA+K;AAC/K,oCAA0J;AAC1J,sCAA2C;AAE3C,mBAAqD;AAErD,cAAyB;AACzB,iCAAmD;AACnD,oCAAuC;AACvC,gCAAqC;AAfrC,MAAM,EAAE,2CAA2C,oCAAoC,oCAAoC,kDAAiD,IAAK;AAiB3K,SAAU,yCAAyC,KAAiB,UAAoB;AAC1F,QAAM,UAAU,IAAI,cAAc,SAAS,MAAM;AACjD,MAAI,CAAC;AACD,WAAO;AACX,QAAM,oBAAoB,QAAQ,SAA4B,+CAAqB;;IAEnF;EAAI,EAAE,SAAS,SAAS,KAAK,CAAC;AAC9B,MAAI,CAAC;AACD,WAAO;AACX,SAAQ,kBAAkB;;IAE1B;EAAI,KACG,kBAAkB;;IAErB;EA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OAAO;AACb,WAAK,mBAAmB,QAAQ;IACpC;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,mBAAmB,IAAI,QAAQ,CAAC;AACtC,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ;OACH;IACL;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,gBAAgB,CAAC;AACjD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,yBAAqB,iCAAoB,KAAK,gBAAgB;;;IAG1E;;;;",
|
|
4
|
+
"sourcesContent": ["import * as __validateArgs from \"./NotificationCC._validateArgs.js\";\nconst { validateArgs_NotificationCCAPI_sendReport, validateArgs_NotificationCCAPI_get, validateArgs_NotificationCCAPI_set, validateArgs_NotificationCCAPI_getSupportedEvents } = __validateArgs;\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport { CommandClasses, type ControlsCC, Duration, type EndpointId, type GetEndpoint, type GetNode, type GetSupportedCCVersion, type GetValueDB, type LogNode, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type NodeId, type Notification, type NotificationState, type NotificationValue, SecurityClass, type SinglecastCC, type SupervisionResult, type SupportsCC, type ValueID, ValueMetadata, type ValueMetadataNumeric, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, getCCName, getNotification, getNotificationEventName, getNotificationName, getNotificationValue, getNotificationValueName, isZWaveError, logList, logText, parseBitMask, timespan, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, type BytesView, buffer2hex, isUint8Array, num2hex, pick, } from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport { CCAPI, POLL_VALUE, PhysicalCCAPI, type PollValueImplementation, throwUnsupportedProperty, } from \"../lib/API.js\";\nimport { CCRaw, CommandClass, type InterviewContext, InvalidCC, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, getEffectiveCCVersion, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, getCCCommandConstructor, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { isNotificationEventPayload } from \"../lib/NotificationEventPayload.js\";\nimport { V } from \"../lib/Values.js\";\nimport { NotificationCommand, UserCodeCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { ApplicationStatusCCRejectedRequest } from \"./ApplicationStatusCC.js\";\nimport { AssociationGroupInfoCC } from \"./AssociationGroupInfoCC.js\";\nimport { NotificationCCValues } from \"./_CCValues.generated.js\";\nexport { NotificationCCValues };\nexport function shouldAutoCreateSyntheticDoorSensorValue(ctx: GetValueDB, endpoint: EndpointId): boolean {\n const valueDB = ctx.tryGetValueDB(endpoint.nodeId);\n if (!valueDB)\n return false;\n const supportedACEvents = valueDB.getValue<readonly number[]>(NotificationCCValues.supportedNotificationEvents(\n // Access Control\n 0x06).endpoint(endpoint.index));\n if (!supportedACEvents)\n return false;\n return (supportedACEvents.includes(\n // Window/door is open\n 0x16)\n && supportedACEvents.includes(\n // Window/door is closed\n 0x17));\n}\n@API(CommandClasses.Notification)\nexport class NotificationCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: NotificationCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case NotificationCommand.Report:\n case NotificationCommand.Get:\n return true; // These exist starting with V1\n case NotificationCommand.Set:\n case NotificationCommand.SupportedGet:\n return this.version >= 2;\n case NotificationCommand.EventSupportedGet:\n return this.version >= 3;\n }\n return super.supportsCommand(cmd);\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: NotificationCCAPI, { property, propertyKey }) {\n const valueId: ValueID = {\n commandClass: this.ccId,\n endpoint: this.endpoint.index,\n property,\n propertyKey,\n };\n if (NotificationCCValues.notificationVariable.is(valueId)) {\n const notificationType: number | undefined = this\n .tryGetValueDB()?.getMetadata(valueId)?.ccSpecific\n ?.notificationType;\n if (notificationType != undefined) {\n return this.getInternal({ notificationType });\n }\n }\n throwUnsupportedProperty(this.ccId, property);\n };\n }\n /**\n * @internal\n */\n public async getInternal(options: NotificationCCGetOptions): Promise<NotificationCCReport | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Get);\n const cc = new NotificationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n return this.host.sendCommand<NotificationCCReport>(cc, this.commandOptions);\n }\n @validateArgs_NotificationCCAPI_sendReport()\n public async sendReport(options: NotificationCCReportOptions): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Report);\n const cc = new NotificationCCReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_NotificationCCAPI_get()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get(options: NotificationCCGetOptions) {\n const response = await this.getInternal(options);\n if (response) {\n return pick(response, [\n \"notificationStatus\",\n \"notificationEvent\",\n \"alarmLevel\",\n \"eventParameters\",\n \"sequenceNumber\",\n ]);\n }\n }\n @validateArgs_NotificationCCAPI_set()\n public async set(notificationType: number, notificationStatus: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Set);\n const cc = new NotificationCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n notificationType,\n notificationStatus,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupported() {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.SupportedGet);\n const cc = new NotificationCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<NotificationCCSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"supportsV1Alarm\",\n \"supportedNotificationTypes\",\n ]);\n }\n }\n @validateArgs_NotificationCCAPI_getSupportedEvents()\n public async getSupportedEvents(notificationType: number): Promise<MaybeNotKnown<readonly number[]>> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.EventSupportedGet);\n const cc = new NotificationCCEventSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n notificationType,\n });\n const response = await this.host.sendCommand<NotificationCCEventSupportedReport>(cc, this.commandOptions);\n return response?.supportedEvents;\n }\n}\nexport function getNotificationEnumBehavior(notification: Notification, valueConfig: NotificationState): \"none\" | \"extend\" | \"replace\" {\n const variable = notification.variables.find((v) => v.states.has(valueConfig.value));\n if (!variable)\n return \"none\";\n const numStatesWithEnums = [...variable.states.values()].filter((val) => val.parameter?.type === \"enum\").length;\n if (numStatesWithEnums === 0)\n return \"none\";\n // An enum value replaces the original value if there is only a single possible state\n // which also has an enum parameter\n if (numStatesWithEnums === 1 && variable.states.size === 1) {\n return \"replace\";\n }\n return \"extend\";\n}\nexport function getNotificationStateValueWithEnum(stateValue: number, enumValue: number): number {\n return (stateValue << 8) | enumValue;\n}\n/**\n * Returns the metadata to use for a known notification value.\n * Can be used to extend a previously defined metadata,\n * e.g. for V2 notifications that don't allow discovering supported events.\n */\nexport function getNotificationValueMetadata(previous: ValueMetadataNumeric | undefined, notification: Notification, valueConfig: NotificationState): ValueMetadataNumeric {\n const metadata: ValueMetadataNumeric = previous ?? {\n ...ValueMetadata.ReadOnlyUInt8,\n label: valueConfig.variableName,\n states: {},\n ccSpecific: {\n notificationType: notification.type,\n },\n };\n if (valueConfig.idle) {\n metadata.states![0] = \"idle\";\n }\n const enumBehavior = getNotificationEnumBehavior(notification, valueConfig);\n if (enumBehavior !== \"replace\") {\n metadata.states![valueConfig.value] = valueConfig.label;\n }\n if (valueConfig.parameter?.type === \"enum\") {\n for (const [key, label] of Object.entries(valueConfig.parameter.values)) {\n const value = parseInt(key);\n const stateKey = enumBehavior === \"replace\"\n ? value\n : getNotificationStateValueWithEnum(valueConfig.value, value);\n metadata.states![stateKey] = label;\n }\n }\n return metadata;\n}\n@commandClass(CommandClasses.Notification)\n@implementedVersion(8)\n@ccValues(NotificationCCValues)\nexport class NotificationCC extends CommandClass {\n declare ccCommand: NotificationCommand;\n // former AlarmCC (v1..v2)\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n CommandClasses[\"Multi Channel Association\"],\n CommandClasses[\"Association Group Information\"],\n ];\n }\n private async determineNotificationMode(ctx: GetValueDB & GetNode<NodeId & SupportsCC> & LogNode, api: NotificationCCAPI, supportedNotificationEvents: ReadonlyMap<number, readonly number[]>): Promise<\"push\" | \"pull\"> {\n const node = this.getNode(ctx)!;\n // SDS14223: If the supporting node does not support the Association Command Class,\n // it may be concluded that the supporting node implements Pull Mode and discovery may be aborted.\n if (!node.supportsCC(CommandClasses.Association))\n return \"pull\";\n if (node.supportsCC(CommandClasses[\"Association Group Information\"])) {\n try {\n const groupsIssueingNotifications = AssociationGroupInfoCC\n .findGroupsForIssuedCommand(ctx, node, this.ccId, NotificationCommand.Report);\n return groupsIssueingNotifications.length > 0 ? \"push\" : \"pull\";\n }\n catch {\n // We might be dealing with an older cache file, fall back to testing\n }\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `determining whether this node is pull or push...`,\n direction: \"outbound\",\n });\n // Find a notification type with at least one supported event\n for (const [type, events] of supportedNotificationEvents) {\n if (events.length === 0)\n continue;\n // Enable the event and request the status\n await api.set(type, true);\n try {\n const resp = await api.get({\n notificationType: type,\n notificationEvent: events[0],\n });\n switch (resp?.notificationStatus) {\n case 0xff:\n return \"push\";\n case 0xfe:\n case 0x00:\n return \"pull\";\n }\n }\n catch {\n /* ignore */\n }\n }\n // If everything failed, e.g. because the node is V1/V2, assume this is a \"push\" node.\n // If we assumed \"pull\", we would have to query the node regularly, which can cause\n // the node to return old (already handled) notifications.\n // https://github.com/zwave-js/zwave-js/issues/5626\n return \"push\";\n }\n /** Whether the node implements push or pull notifications */\n public static getNotificationMode(ctx: GetValueDB, node: NodeId): MaybeNotKnown<\"push\" | \"pull\"> {\n return ctx\n .getValueDB(node.id)\n .getValue(NotificationCCValues.notificationMode.id);\n }\n /** Returns the supported notification events for a given notification type */\n public static getSupportedNotificationEvents(ctx: GetValueDB, node: NodeId, type: number): MaybeNotKnown<readonly number[]> {\n return ctx\n .getValueDB(node.id)\n .getValue(NotificationCCValues.supportedNotificationEvents(type).id);\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // If one Association group issues Notification Reports,\n // we must associate ourselves with that channel\n try {\n await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, NotificationCommand.Report);\n }\n catch {\n ctx.logNode(node.id, {\n endpoint: endpoint.index,\n message: `Configuring associations to receive ${getCCName(this.ccId)} reports failed!`,\n level: \"warn\",\n });\n }\n let supportsV1Alarm = false;\n if (api.version >= 2) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported notification types...\",\n direction: \"outbound\",\n });\n const suppResponse = await api.getSupported();\n if (!suppResponse) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported notification types timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n supportsV1Alarm = suppResponse.supportsV1Alarm;\n const supportedNotificationTypes = suppResponse.supportedNotificationTypes;\n const supportedNotificationNames = supportedNotificationTypes.map(getNotificationName);\n const supportedNotificationEvents = new Map<number, readonly number[]>();\n const logMessage = logText(\"received supported notification types:\", { nested: logList(supportedNotificationNames) });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n if (api.version >= 3) {\n // Query each notification for its supported events\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying supported notification events for ${name}...`,\n direction: \"outbound\",\n });\n const supportedEvents = await api.getSupportedEvents(type);\n if (supportedEvents) {\n supportedNotificationEvents.set(type, supportedEvents);\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `received supported notification events for ${name}: ${supportedEvents\n .map(String)\n .join(\", \")}`,\n direction: \"inbound\",\n });\n }\n node.reportInterviewProgress(i + 1, supportedNotificationTypes.length);\n }\n }\n // Determine whether the node is a push or pull node\n let notificationMode = this.getValue<\"push\" | \"pull\">(ctx, NotificationCCValues.notificationMode);\n if (notificationMode !== \"push\" && notificationMode !== \"pull\") {\n notificationMode = await this.determineNotificationMode(ctx, api, supportedNotificationEvents);\n this.setValue(ctx, NotificationCCValues.notificationMode, notificationMode);\n }\n if (notificationMode === \"pull\") {\n await this.refreshValues(ctx, {\n tag: \"interview\",\n onProgress: (completed, total) => node.reportInterviewProgress(completed, total),\n });\n } /* if (notificationMode === \"push\") */\n else {\n // First, query the current state of each supported notification\n await this.refreshValues(ctx, {\n tag: \"interview\",\n onProgress: (completed, total) => node.reportInterviewProgress(completed, total),\n });\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n // Enable reports for each notification type\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `enabling notifications for ${name}...`,\n direction: \"outbound\",\n });\n await api.set(type, true);\n node.reportInterviewProgress(i + 1, supportedNotificationTypes.length);\n }\n }\n }\n // Only create metadata for V1 values if necessary\n if (api.version === 1 || supportsV1Alarm) {\n this.ensureMetadata(ctx, NotificationCCValues.alarmType);\n this.ensureMetadata(ctx, NotificationCCValues.alarmLevel);\n }\n // Create metadata and internal values for alarm mappings\n this.applyAlarmMappingCompat(ctx);\n // Apply notification remappings\n this.applyNotificationRemappings(ctx);\n // Set idle values from (potentially remapped) supported events\n this.initNotificationIdleValues(ctx);\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n /**\n * Applies the `alarmMapping` compat flag by adding metadata and supported notification\n * types/events for the alarm mapping targets.\n */\n private applyAlarmMappingCompat(ctx: InterviewContext): void {\n const mappings = ctx.getDeviceConfig?.(this.nodeId as number)\n ?.compat?.alarmMapping;\n if (!mappings)\n return;\n const node = this.getNode(ctx)!;\n const supportedNotifications = new Map<number, Set<number>>();\n // Preserve the notification types and events discovered during the interview\n for (const type of (this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [])) {\n supportedNotifications.set(type, new Set(NotificationCC.getSupportedNotificationEvents(ctx, node, type) ?? []));\n }\n // Find all mappings to a valid notification variable\n for (const { to } of mappings) {\n const notification = getNotification(to.notificationType);\n if (!notification)\n continue;\n const valueConfig = getNotificationValue(notification, to.notificationEvent);\n // Remember supported notification types and events to create the internal values later\n if (!supportedNotifications.has(to.notificationType)) {\n supportedNotifications.set(to.notificationType, new Set());\n }\n const supportedNotificationTypesSet = supportedNotifications\n .get(to.notificationType)!;\n supportedNotificationTypesSet.add(to.notificationEvent);\n if (valueConfig?.type !== \"state\")\n continue;\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n // Create or update the metadata\n const metadata = getNotificationValueMetadata(this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n }\n // Remember supported notification types and events in the cache\n this.setValue(ctx, NotificationCCValues.supportedNotificationTypes, [...supportedNotifications.keys()]);\n for (const [type, events] of supportedNotifications) {\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);\n }\n }\n /**\n * Applies the `remapNotifications` compat flag by modifying the supported notification\n * types/events in cache and creating metadata for remapping targets.\n */\n private applyNotificationRemappings(ctx: InterviewContext): void {\n const remappings = ctx.getDeviceConfig?.(this.nodeId as number)\n ?.compat?.remapNotifications;\n if (!remappings?.length)\n return;\n ctx.logNode(this.nodeId as number, {\n message: `Applying notification remapping compat flag...`,\n direction: \"none\",\n level: \"verbose\",\n });\n // Load current supported types and events from cache\n const supportedTypes = new Set<number>(this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? []);\n const supportedEvents = new Map<number, Set<number>>();\n for (const type of supportedTypes) {\n const events = NotificationCC.getSupportedNotificationEvents(ctx, this.getNode(ctx)!, type);\n if (events) {\n supportedEvents.set(type, new Set(events));\n }\n }\n for (const mapping of remappings) {\n // Remove the original event from supported events\n const fromEvents = supportedEvents.get(mapping.from.notificationType);\n if (fromEvents) {\n fromEvents.delete(mapping.from.notificationEvent);\n if (fromEvents.size === 0) {\n supportedEvents.delete(mapping.from.notificationType);\n supportedTypes.delete(mapping.from.notificationType);\n }\n }\n // Only add target events for normal remaps\n if (mapping.action.type === \"remap\") {\n const to = mapping.action.to;\n supportedTypes.add(to.notificationType);\n if (!supportedEvents.has(to.notificationType)) {\n supportedEvents.set(to.notificationType, new Set());\n }\n supportedEvents.get(to.notificationType)!.add(to.notificationEvent);\n }\n }\n // Persist updated supported types and events\n this.setValue(ctx, NotificationCCValues.supportedNotificationTypes, [...supportedTypes]);\n for (const [type, events] of supportedEvents) {\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);\n }\n // Rebuild metadata for all supported events (since we may have removed\n // some events and added others, the previous metadata may be stale)\n for (const [type, events] of supportedEvents) {\n const notification = getNotification(type);\n if (!notification)\n continue;\n let isFirst = true;\n for (const value of events) {\n const valueConfig = getNotificationValue(notification, value);\n if (valueConfig?.type !== \"state\")\n continue;\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n const metadata = getNotificationValueMetadata(isFirst\n ? undefined\n : this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n isFirst = false;\n }\n }\n }\n /**\n * Sets idle values for all supported notification variables that have an idle state\n * and don't have a value yet.\n */\n private initNotificationIdleValues(ctx: InterviewContext): void {\n const supportedTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];\n for (const type of supportedTypes) {\n const notification = getNotification(type);\n if (!notification)\n continue;\n // Reads supported events from cache so it works correctly\n // after compat remappings have been applied.\n const events = NotificationCC.getSupportedNotificationEvents(ctx, this.getNode(ctx)!, type);\n if (!events)\n continue;\n // Find all variables that are supported by this node and have an idle state\n for (const variable of notification.variables\n .filter((v) => v.idle)) {\n if ([...variable.states.keys()].some((key) => events.includes(key))) {\n const value = NotificationCCValues\n .notificationVariable(notification.name, variable.name);\n // Set the value to idle if it has no value yet\n // TODO: GH#1028\n // * do this only if the last update was more than 5 minutes ago\n // * schedule an auto-idle if the last update was less than 5 minutes ago but before the current applHost start\n if (this.getValue(ctx, value) == undefined) {\n this.setValue(ctx, value, 0);\n }\n }\n }\n }\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Load supported notification types and events from cache\n const supportedNotificationTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];\n const supportedNotificationNames = supportedNotificationTypes.map(getNotificationName);\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n // Always query each notification for its current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying notification status for ${name}...`,\n direction: \"outbound\",\n });\n const response = await api.getInternal({\n notificationType: type,\n });\n // NotificationReports don't store their values themselves,\n // because the behaviour is too complex and spans the lifetime\n // of several reports. Thus we handle it in the Node instance\n if (response) {\n // @ts-expect-error\n await node.handleCommand(response);\n }\n options?.onProgress?.(i + 1, supportedNotificationTypes.length);\n }\n // Remember when we did this\n this.setValue(ctx, NotificationCCValues.lastRefresh, Date.now());\n }\n public shouldRefreshValues(this: SinglecastCC<this>, ctx: GetValueDB & GetSupportedCCVersion & GetDeviceConfig & GetNode<NodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>>): boolean {\n // Pull-mode nodes must be polled regularly\n const isPullMode = NotificationCC.getNotificationMode(ctx, this.getNode(ctx)!) === \"pull\";\n if (!isPullMode)\n return false;\n const lastUpdated = this.getValue<number>(ctx, NotificationCCValues.lastRefresh);\n return (lastUpdated == undefined\n || Date.now() - lastUpdated > timespan.hours(6));\n }\n}\n// @publicAPI\nexport interface NotificationCCSetOptions {\n notificationType: number;\n notificationStatus: boolean;\n}\nfunction getCCResponseForNotificationCCSet(ctx: GetNode<NodeId & SupportsCC>, sent: NotificationCCSet) {\n // CC:0071.03.06.11.008: A receiving node MAY deny the deactivation\n // of a specific Notification Type. In that case, the receiving node\n // MUST respond to this command with an Application Rejected Request\n // Command.\n if (sent.isSinglecast()\n && !sent.notificationStatus\n && !sent.isEncapsulatedWith(CommandClasses.Supervision)\n && ctx.getNode(sent.nodeId)?.supportsCC(CommandClasses[\"Application Status\"])) {\n return ApplicationStatusCCRejectedRequest;\n }\n}\n@CCCommand(NotificationCommand.Set)\n@expectedCCResponse(getCCResponseForNotificationCCSet)\n@useSupervision()\nexport class NotificationCCSet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCSetOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n this.notificationStatus = options.notificationStatus;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCSet {\n validatePayload(raw.payload.length >= 2);\n const notificationType = raw.payload[0];\n const notificationStatus = raw.payload[1] === 0xff;\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n notificationStatus,\n });\n }\n public notificationType: number;\n public notificationStatus: boolean;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.notificationType,\n this.notificationStatus ? 0xff : 0x00,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n status: this.notificationStatus,\n },\n };\n }\n}\n// @publicAPI\nexport type NotificationCCReportOptions = {\n alarmType?: number;\n alarmLevel?: number;\n notificationType?: number;\n notificationEvent?: number;\n notificationStatus?: number;\n eventParameters?: BytesView;\n sequenceNumber?: number;\n};\n@CCCommand(NotificationCommand.Report)\n@useSupervision()\nexport class NotificationCCReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCReportOptions>) {\n super(options);\n if (options.alarmType != undefined) {\n this.alarmType = options.alarmType;\n this.alarmLevel = options.alarmLevel;\n }\n if (options.notificationType != undefined) {\n this.notificationType = options.notificationType;\n this.notificationStatus = options.notificationStatus ?? true;\n this.notificationEvent = options.notificationEvent;\n this.eventParameters = options.eventParameters;\n this.sequenceNumber = options.sequenceNumber;\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCReport {\n validatePayload(raw.payload.length >= 2);\n const alarmType = raw.payload[0];\n const alarmLevel = raw.payload[1];\n // Byte 2 used to be zensorNetSourceNodeId in V2 and V3, but we don't care about that\n if (raw.payload.length < 7) {\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n alarmLevel,\n });\n }\n // V2+ requires the alarm bytes to be zero. Manufacturers don't care though, so we don't enforce that.\n // Don't use the version to decide because we might discard notifications\n // before the interview is complete\n const notificationStatus = raw.payload[3];\n const notificationType = raw.payload[4];\n const notificationEvent = raw.payload[5];\n const containsSeqNum = !!(raw.payload[6] & 128);\n const numEventParams = raw.payload[6] & 0b11111;\n let eventParameters: BytesView | undefined;\n if (numEventParams > 0) {\n validatePayload(raw.payload.length >= 7 + numEventParams);\n eventParameters = raw.payload.subarray(7, 7 + numEventParams);\n }\n let sequenceNumber: number | undefined;\n if (containsSeqNum) {\n validatePayload(raw.payload.length >= 7 + numEventParams + 1);\n sequenceNumber = raw.payload[7 + numEventParams];\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n alarmLevel,\n notificationStatus,\n notificationType,\n notificationEvent,\n eventParameters,\n sequenceNumber,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const ccVersion = getEffectiveCCVersion(ctx, this);\n // Check if we need to re-interpret the alarm values somehow\n if (this.alarmType != undefined\n && this.alarmLevel != undefined\n && this.alarmType !== 0) {\n if (ccVersion >= 2) {\n // Check if the device actually supports Notification CC, but chooses\n // to send Alarm frames instead (GH#1034)\n const supportedNotificationTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes);\n if (isArray(supportedNotificationTypes)\n && supportedNotificationTypes.includes(this.alarmType)) {\n const supportedNotificationEvents = NotificationCC\n .getSupportedNotificationEvents(ctx, this.getNode(ctx)!, this.alarmType);\n if (isArray(supportedNotificationEvents)\n && supportedNotificationEvents.includes(this.alarmLevel)) {\n // This alarm frame corresponds to a valid notification event\n ctx.logNode(this.nodeId as number, `treating V1 Alarm frame as Notification Report`);\n this.notificationType = this.alarmType;\n this.notificationEvent = this.alarmLevel;\n this.alarmType = undefined;\n this.alarmLevel = undefined;\n }\n }\n }\n else {\n // V1 Alarm, check if there is a compat option to map this V1 report to a V2+ report\n const mapping = ctx.getDeviceConfig?.(this.nodeId as number)?.compat?.alarmMapping;\n const match = mapping?.find((m) => m.from.alarmType === this.alarmType\n && (m.from.alarmLevel == undefined\n || m.from.alarmLevel === this.alarmLevel));\n if (match) {\n ctx.logNode(this.nodeId as number, `compat mapping found, treating V1 Alarm frame as Notification Report`);\n this.notificationType = match.to.notificationType;\n this.notificationEvent = match.to.notificationEvent;\n if (match.to.eventParameters) {\n this.eventParameters = {};\n for (const [key, val] of Object.entries(match.to.eventParameters)) {\n if (typeof val === \"number\") {\n this.eventParameters[key] = val;\n }\n else if (val === \"alarmLevel\") {\n this.eventParameters[key] = this.alarmLevel;\n }\n }\n }\n // After mapping we do not set the legacy V1 values to undefined\n // Otherwise, adding a new mapping will be a breaking change\n }\n }\n }\n // Now we can interpret the event parameters and turn them into something useful\n this.parseEventParameters(ctx);\n if (this.alarmType != undefined) {\n const alarmTypeValue = NotificationCCValues.alarmType;\n this.ensureMetadata(ctx, alarmTypeValue);\n this.setValue(ctx, alarmTypeValue, this.alarmType);\n }\n if (this.alarmLevel != undefined) {\n const alarmLevelValue = NotificationCCValues.alarmLevel;\n this.ensureMetadata(ctx, alarmLevelValue);\n this.setValue(ctx, alarmLevelValue, this.alarmLevel);\n }\n return true;\n }\n public alarmType: number | undefined;\n public alarmLevel: number | undefined;\n public notificationType: number | undefined;\n public notificationStatus: boolean | number | undefined;\n public notificationEvent: number | undefined;\n public eventParameters: BytesView | Duration | Record<string, number> | number | undefined;\n public sequenceNumber: number | undefined;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n let message: MessageRecord = {};\n if (this.alarmType) {\n message = {\n \"V1 alarm type\": this.alarmType,\n \"V1 alarm level\": this.alarmLevel!,\n };\n }\n let valueConfig: NotificationValue | undefined;\n if (this.notificationType) {\n const notification = getNotification(this.notificationType);\n if (notification) {\n valueConfig = getNotificationValue(notification, this.notificationEvent!);\n }\n if (valueConfig) {\n message = {\n ...message,\n \"notification type\": getNotificationName(this.notificationType),\n \"notification status\": this.notificationStatus!,\n [`notification ${valueConfig.type}`]: valueConfig.label\n ?? `Unknown (${num2hex(this.notificationEvent)})`,\n };\n }\n else if (this.notificationEvent === 0x00) {\n message = {\n ...message,\n \"notification type\": this.notificationType,\n \"notification status\": this.notificationStatus!,\n \"notification state\": \"idle\",\n };\n }\n else {\n message = {\n ...message,\n \"notification type\": this.notificationType,\n \"notification status\": this.notificationStatus!,\n \"notification event\": num2hex(this.notificationEvent),\n };\n }\n }\n if (this.sequenceNumber != undefined) {\n message[\"sequence number\"] = this.sequenceNumber;\n }\n if (this.eventParameters != undefined) {\n if (typeof this.eventParameters === \"number\") {\n // Try to look up the enum label\n let found = false;\n if (valueConfig?.parameter?.type === \"enum\") {\n const label = valueConfig.parameter.values[this.eventParameters];\n if (label) {\n message[\"state parameters\"] = label;\n found = true;\n }\n }\n if (!found) {\n message[\"state parameters\"] = num2hex(this.eventParameters);\n }\n }\n else if (isUint8Array(this.eventParameters)) {\n message[\"event parameters\"] = buffer2hex(this.eventParameters);\n }\n else if (this.eventParameters instanceof Duration) {\n message[\"event parameters\"] = this.eventParameters.toString();\n }\n else {\n message[\"event parameters\"] = logList(Object.entries(this.eventParameters)\n .map(([param, val]) => `${param}: ${num2hex(val)}`));\n }\n }\n else if (valueConfig?.parameter?.type === \"enum\"\n && valueConfig.parameter.default != undefined) {\n const label = valueConfig.parameter.values[valueConfig.parameter.default];\n if (label) {\n message[\"state parameters\"] = `${label} (omitted)`;\n }\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n private parseEventParameters(ctx: PersistValuesContext): void {\n // This only makes sense for V2+ notifications\n if (this.notificationType == undefined\n || this.notificationEvent == undefined) {\n return;\n }\n // Look up the received notification and value in the config\n const notification = getNotification(this.notificationType);\n if (!notification)\n return;\n const valueConfig = getNotificationValue(notification, this.notificationEvent);\n if (!valueConfig)\n return;\n // Parse the event parameters if possible\n if (valueConfig.parameter?.type === \"duration\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // The parameters contain a Duration\n this.eventParameters = Duration.parseReport(this.eventParameters[0]);\n }\n else if (valueConfig.parameter?.type === \"commandclass\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // The parameters **should** contain a CC, however there might be some exceptions\n if (this.eventParameters.length === 1\n && notification.type === 0x06\n && (this.notificationEvent === 0x05\n || this.notificationEvent === 0x06)) {\n // Access control -> Keypad Lock/Unlock operation\n // Some devices only send the User ID, not a complete CC payload\n this.eventParameters = {\n userId: this.eventParameters[0],\n };\n }\n else {\n // Try to parse the event parameters - if this fails, we should still handle the notification report\n try {\n // Convert CommandClass instances to a standardized object representation\n // We do not want to parse asynchronously here, but the `CommandClass.parse` method is async.\n // However, we only deal with simple CCs that can be parsed synchronously. We can do this\n // by replicating what `CommandClass.parse` does: determine the correct CC class and call its\n // `from` method. If that returns a CC instance, we're good to continue.\n const raw = CCRaw.parse(this.eventParameters);\n if (raw.ccCommand == undefined) {\n validatePayload.fail(\"event parameters contain an invalid CC\");\n }\n const CommandConstructor = getCCCommandConstructor(raw.ccId, raw.ccCommand);\n if (!CommandConstructor) {\n validatePayload.fail(\"event parameters contain an invalid CC\");\n }\n const cc = CommandConstructor.from(raw, {\n ...ctx,\n frameType: \"singlecast\",\n sourceNodeId: this.nodeId as number,\n // Security encapsulation is handled outside of this CC,\n // so it is not needed here:\n hasSecurityClass: () => false,\n getHighestSecurityClass: () => SecurityClass.None,\n setSecurityClass: () => { },\n securityManager: undefined,\n securityManager2: undefined,\n securityManagerLR: undefined,\n });\n if (cc instanceof Promise) {\n validatePayload.fail(\"Cannot asynchronously parse CC from event parameters\");\n }\n validatePayload(!(cc instanceof InvalidCC));\n cc.encapsulatingCC = this as any;\n if (isNotificationEventPayload(cc)) {\n this.eventParameters = cc\n .toNotificationEventParameters();\n }\n else {\n // If a CC has no good toJSON() representation, we're only interested in the payload\n let json = cc.toJSON();\n if (\"nodeId\" in json\n && \"ccId\" in json\n && \"payload\" in json) {\n json = pick(json, [\"payload\"]);\n }\n this.eventParameters = json;\n }\n }\n catch (e) {\n if (isZWaveError(e)\n && e.code\n === ZWaveErrorCodes.PacketFormat_InvalidPayload\n && isUint8Array(this.eventParameters)) {\n const { ccId, ccCommand } = CCRaw.parse(this.eventParameters);\n if (ccId === CommandClasses[\"User Code\"]\n && ccCommand === UserCodeCommand.Report\n && this.eventParameters.length >= 3) {\n // Access control -> Keypad Lock/Unlock operation\n // Some devices report the user code with truncated UserCode reports\n this.eventParameters = {\n userId: this.eventParameters[2],\n };\n }\n else {\n ctx.logNode(this.nodeId as number, `Failed to parse Notification CC event parameters, ignoring them...`, \"error\");\n }\n }\n else {\n // unexpected error\n throw e;\n }\n }\n }\n }\n else if (valueConfig.parameter?.type === \"value\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // readUIntBE supports at most 6 bytes; a longer (or empty) value\n // must not reach it, or it throws a RangeError that would escape\n // the parser and crash the driver\n validatePayload(this.eventParameters.length >= 1\n && this.eventParameters.length <= 6);\n // The parameters contain a named value\n this.eventParameters = {\n [valueConfig.parameter.propertyName]: Bytes.view(this.eventParameters)\n .readUIntBE(0, this.eventParameters.length),\n };\n }\n else if (valueConfig.parameter?.type === \"enum\") {\n // The parameters may contain an enum value\n this.eventParameters = isUint8Array(this.eventParameters)\n && this.eventParameters.length === 1\n ? this.eventParameters[0]\n : undefined;\n // Some devices send notifications without an event parameter when they should.\n // In this case, fall back to the default value where possible.\n if (this.eventParameters == undefined\n && valueConfig.parameter.default != undefined) {\n this.eventParameters = valueConfig.parameter.default;\n }\n }\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n if (this.notificationType != undefined) {\n if (this.notificationEvent == undefined) {\n throw new ZWaveError(`Notification CC reports requires the notification event to be set!`, ZWaveErrorCodes.Argument_Invalid);\n }\n else if (this.eventParameters != undefined\n && !isUint8Array(this.eventParameters)) {\n throw new ZWaveError(`When sending Notification CC reports, the event parameters can only be buffers!`, ZWaveErrorCodes.Argument_Invalid);\n }\n const controlByte = (this.sequenceNumber != undefined ? 128 : 0)\n | ((this.eventParameters?.length ?? 0) & 0b11111);\n this.payload = Bytes.from([\n 0,\n 0,\n 0,\n 0xff,\n this.notificationType,\n this.notificationEvent,\n controlByte,\n ]);\n if (this.eventParameters) {\n this.payload = Bytes.concat([\n this.payload,\n this.eventParameters,\n ]);\n }\n if (this.sequenceNumber != undefined) {\n this.payload = Bytes.concat([\n this.payload,\n [this.sequenceNumber],\n ]);\n }\n }\n else {\n this.payload = Bytes.from([\n this.alarmType ?? 0x00,\n this.alarmLevel ?? 0x00,\n ]);\n }\n return super.serialize(ctx);\n }\n}\n// @publicAPI\nexport type NotificationCCGetOptions = {\n alarmType: number;\n} | {\n notificationType: number;\n notificationEvent?: number;\n};\n@CCCommand(NotificationCommand.Get)\n@expectedCCResponse(NotificationCCReport)\nexport class NotificationCCGet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCGetOptions>) {\n super(options);\n if (\"alarmType\" in options) {\n this.alarmType = options.alarmType;\n }\n else {\n this.notificationType = options.notificationType;\n this.notificationEvent = options.notificationEvent;\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCGet {\n validatePayload(raw.payload.length >= 1);\n if (raw.payload.length >= 2) {\n const notificationType = raw.payload[1];\n let notificationEvent: number | undefined;\n if (raw.payload.length >= 3 && notificationType != 0xff) {\n notificationEvent = raw.payload[2];\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n notificationEvent,\n });\n }\n else {\n const alarmType = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n });\n }\n }\n /** Proprietary V1/V2 alarm type */\n public alarmType: number | undefined;\n /** Regulated V3+ notification type */\n public notificationType: number | undefined;\n public notificationEvent: number | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const notificationEvent = this.notificationEvent === 0xff\n ? 0x00\n : this.notificationEvent;\n this.payload = Bytes.from([\n this.alarmType ?? 0x00,\n this.notificationType ?? 0xff,\n notificationEvent ?? 0x00,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.alarmType != undefined) {\n message[\"V1 alarm type\"] = this.alarmType;\n }\n if (this.notificationType != undefined) {\n message[\"notification type\"] = getNotificationName(this.notificationType);\n if (this.notificationEvent != undefined) {\n message[\"notification event\"] = getNotificationEventName(this.notificationType, this.notificationEvent);\n }\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface NotificationCCSupportedReportOptions {\n supportsV1Alarm: boolean;\n supportedNotificationTypes: number[];\n}\n@CCCommand(NotificationCommand.SupportedReport)\n@ccValueProperty(\"supportsV1Alarm\", NotificationCCValues.supportsV1Alarm)\n@ccValueProperty(\"supportedNotificationTypes\", NotificationCCValues.supportedNotificationTypes)\nexport class NotificationCCSupportedReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCSupportedReportOptions>) {\n super(options);\n this.supportsV1Alarm = options.supportsV1Alarm;\n this.supportedNotificationTypes = options.supportedNotificationTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const supportsV1Alarm = !!(raw.payload[0] & 128);\n const numBitMaskBytes = raw.payload[0] & 31;\n validatePayload(numBitMaskBytes > 0, raw.payload.length >= 1 + numBitMaskBytes);\n const notificationBitMask = raw.payload.subarray(1, 1 + numBitMaskBytes);\n const supportedNotificationTypes = parseBitMask(notificationBitMask, \n // bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0\n 0);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportsV1Alarm,\n supportedNotificationTypes,\n });\n }\n public supportsV1Alarm: boolean;\n public supportedNotificationTypes: number[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const bitMask = encodeBitMask(this.supportedNotificationTypes, Math.max(...this.supportedNotificationTypes), 0);\n this.payload = Bytes.concat([\n [\n (this.supportsV1Alarm ? 128 : 0) | bitMask.length,\n ],\n bitMask,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supports V1 alarm\": this.supportsV1Alarm,\n \"supported notification types\": logList(this.supportedNotificationTypes.map((t) => getNotificationName(t))),\n },\n };\n }\n}\n@CCCommand(NotificationCommand.SupportedGet)\n@expectedCCResponse(NotificationCCSupportedReport)\nexport class NotificationCCSupportedGet extends NotificationCC {\n}\n// @publicAPI\nexport interface NotificationCCEventSupportedReportOptions {\n notificationType: number;\n supportedEvents: number[];\n}\n@CCCommand(NotificationCommand.EventSupportedReport)\nexport class NotificationCCEventSupportedReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCEventSupportedReportOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n this.supportedEvents = options.supportedEvents;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCEventSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const notificationType = raw.payload[0];\n const numBitMaskBytes = raw.payload[1] & 31;\n if (numBitMaskBytes === 0) {\n // Notification type is not supported\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n supportedEvents: [],\n });\n }\n validatePayload(raw.payload.length >= 2 + numBitMaskBytes);\n const eventBitMask = raw.payload.subarray(2, 2 + numBitMaskBytes);\n const supportedEvents = parseBitMask(eventBitMask, \n // In this mask, bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0\n 0);\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n supportedEvents,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Store which events this notification supports\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(this.notificationType), this.supportedEvents);\n // For each event, predefine the value metadata\n const notification = getNotification(this.notificationType);\n if (!notification) {\n // This is an unknown notification\n this.setMetadata(ctx, NotificationCCValues.unknownNotificationType(this.notificationType));\n }\n else {\n // This is a standardized notification\n let isFirst = true;\n for (const value of this.supportedEvents) {\n // Find out which property we need to update\n const valueConfig = getNotificationValue(notification, value);\n if (valueConfig?.type === \"state\") {\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n // After we've created the metadata initially, extend it\n const metadata = getNotificationValueMetadata(isFirst\n ? undefined\n : this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n isFirst = false;\n }\n }\n }\n return true;\n }\n public notificationType: number;\n public supportedEvents: number[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.notificationType, 0]);\n if (this.supportedEvents.length > 0) {\n const bitMask = encodeBitMask(this.supportedEvents, Math.max(...this.supportedEvents), 0);\n this.payload[1] = bitMask.length;\n this.payload = Bytes.concat([this.payload, bitMask]);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n \"supported events\": logList(this.supportedEvents.map((e) => getNotificationValueName(this.notificationType, e))),\n },\n };\n }\n}\n// @publicAPI\nexport interface NotificationCCEventSupportedGetOptions {\n notificationType: number;\n}\n@CCCommand(NotificationCommand.EventSupportedGet)\n@expectedCCResponse(NotificationCCEventSupportedReport)\nexport class NotificationCCEventSupportedGet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCEventSupportedGetOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCEventSupportedGet {\n validatePayload(raw.payload.length >= 1);\n const notificationType = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n });\n }\n public notificationType: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.notificationType]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n },\n };\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;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vD;AACA,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,yBAAqB,iCAAoB,KAAK,gBAAgB;UAC9D,wBAAoB,qBAAQ,KAAK,gBAAgB,IAAI,CAAC,UAAM,sCAAyB,KAAK,kBAAkB,CAAC,CAAC,CAAC;;;IAG3H;;;;IAQS,mCAA+B,MAAA;8BAF3C,yCAAU,iCAAoB,iBAAiB,OAC/C,kDAAmB,kCAAkC,CAAC;;;;oBACF;uDAAA,YAAc;WAAA;;;;;;;;AAAnE,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAA4D;AAC3E,YAAM,OAAO;AACb,WAAK,mBAAmB,QAAQ;IACpC;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,mBAAmB,IAAI,QAAQ,CAAC;AACtC,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ;OACH;IACL;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,gBAAgB,CAAC;AACjD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,yBAAqB,iCAAoB,KAAK,gBAAgB;;;IAG1E;;;;",
|
|
6
6
|
"names": ["NotificationCC"]
|
|
7
7
|
}
|
|
@@ -262,7 +262,8 @@ let ProtectionCC = (() => {
|
|
|
262
262
|
const node = this.getNode(ctx);
|
|
263
263
|
const endpoint = this.getEndpoint(ctx);
|
|
264
264
|
const api = import_API.CCAPI.create(import_core.CommandClasses.Protection, ctx, endpoint).withOptions({
|
|
265
|
-
priority: import_core.MessagePriority.NodeQuery
|
|
265
|
+
priority: import_core.MessagePriority.NodeQuery,
|
|
266
|
+
tag: "interview"
|
|
266
267
|
});
|
|
267
268
|
ctx.logNode(node.id, {
|
|
268
269
|
endpoint: this.endpointIndex,
|
|
@@ -277,13 +278,14 @@ let ProtectionCC = (() => {
|
|
|
277
278
|
});
|
|
278
279
|
const resp = await api.getSupported();
|
|
279
280
|
if (resp) {
|
|
280
|
-
const logMessage =
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
RF protection states:
|
|
286
|
-
|
|
281
|
+
const logMessage = (0, import_core.logText)("received protection capabilities:", {
|
|
282
|
+
nested: (0, import_core.logDict)({
|
|
283
|
+
"exclusive control": resp.supportsExclusiveControl,
|
|
284
|
+
timeout: resp.supportsTimeout,
|
|
285
|
+
"local protection states": (0, import_core.logList)(resp.supportedLocalStates.map((local) => (0, import_shared.getEnumMemberName)(import_Types.LocalProtectionState, local))),
|
|
286
|
+
"RF protection states": (0, import_core.logList)(resp.supportedRFStates.map((local) => (0, import_shared.getEnumMemberName)(import_Types.RFProtectionState, local)))
|
|
287
|
+
})
|
|
288
|
+
});
|
|
287
289
|
ctx.logNode(node.id, {
|
|
288
290
|
message: logMessage,
|
|
289
291
|
direction: "inbound"
|
|
@@ -292,7 +294,7 @@ RF protection states: ${resp.supportedRFStates.map((local) => (0, import_shar
|
|
|
292
294
|
hadCriticalTimeout = true;
|
|
293
295
|
}
|
|
294
296
|
}
|
|
295
|
-
await this.refreshValues(ctx);
|
|
297
|
+
await this.refreshValues(ctx, { tag: "interview" });
|
|
296
298
|
if (!hadCriticalTimeout)
|
|
297
299
|
this.setInterviewComplete(ctx, true);
|
|
298
300
|
}
|
|
@@ -300,7 +302,8 @@ RF protection states: ${resp.supportedRFStates.map((local) => (0, import_shar
|
|
|
300
302
|
const node = this.getNode(ctx);
|
|
301
303
|
const endpoint = this.getEndpoint(ctx);
|
|
302
304
|
const api = import_API.CCAPI.create(import_core.CommandClasses.Protection, ctx, endpoint).withOptions({
|
|
303
|
-
priority: options?.priority ?? import_core.MessagePriority.NodeQuery
|
|
305
|
+
priority: options?.priority ?? import_core.MessagePriority.NodeQuery,
|
|
306
|
+
tag: options?.tag
|
|
304
307
|
});
|
|
305
308
|
const supportsExclusiveControl = !!this.getValue(ctx, import_CCValues_generated.ProtectionCCValues.supportsExclusiveControl);
|
|
306
309
|
const supportsTimeout = !!this.getValue(ctx, import_CCValues_generated.ProtectionCCValues.supportsTimeout);
|
|
@@ -342,7 +345,7 @@ rf ${(0, import_shared.getEnumMemberName)(import_Types.RFProtectionState, pr
|
|
|
342
345
|
const nodeId = await api.getExclusiveControl();
|
|
343
346
|
if (nodeId != void 0) {
|
|
344
347
|
ctx.logNode(node.id, {
|
|
345
|
-
message: (nodeId !== 0 ?
|
|
348
|
+
message: (nodeId !== 0 ? (0, import_core.getNodeTag)(nodeId) : `no node`) + ` has exclusive control`,
|
|
346
349
|
direction: "inbound"
|
|
347
350
|
});
|
|
348
351
|
}
|
|
@@ -574,10 +577,8 @@ let ProtectionCCSupportedReport = (() => {
|
|
|
574
577
|
message: {
|
|
575
578
|
"supports exclusive control": this.supportsExclusiveControl,
|
|
576
579
|
"supports timeout": this.supportsTimeout,
|
|
577
|
-
"local protection states": this.supportedLocalStates.map((local) => (0, import_shared.getEnumMemberName)(import_Types.LocalProtectionState, local))
|
|
578
|
-
|
|
579
|
-
"RF protection states": this.supportedRFStates.map((rf) => (0, import_shared.getEnumMemberName)(import_Types.RFProtectionState, rf)).map((str) => `
|
|
580
|
-
\xB7 ${str}`).join("")
|
|
580
|
+
"local protection states": (0, import_core.logList)(this.supportedLocalStates.map((local) => (0, import_shared.getEnumMemberName)(import_Types.LocalProtectionState, local))),
|
|
581
|
+
"RF protection states": (0, import_core.logList)(this.supportedRFStates.map((rf) => (0, import_shared.getEnumMemberName)(import_Types.RFProtectionState, rf)))
|
|
581
582
|
}
|
|
582
583
|
};
|
|
583
584
|
}
|