@zwave-js/cc 15.1.1 → 15.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/cc/AlarmSensorCC.d.ts +7 -7
- package/build/cjs/cc/AlarmSensorCC.js +22 -23
- package/build/cjs/cc/AlarmSensorCC.js.map +3 -3
- package/build/cjs/cc/AssociationCC.d.ts +8 -9
- package/build/cjs/cc/AssociationCC.js +29 -29
- package/build/cjs/cc/AssociationCC.js.map +3 -3
- package/build/cjs/cc/AssociationGroupInfoCC.d.ts +7 -7
- package/build/cjs/cc/AssociationGroupInfoCC.js +31 -32
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +3 -3
- package/build/cjs/cc/BarrierOperatorCC.d.ts +8 -8
- package/build/cjs/cc/BarrierOperatorCC.js +35 -36
- package/build/cjs/cc/BarrierOperatorCC.js.map +3 -3
- package/build/cjs/cc/BasicCC.d.ts +4 -4
- package/build/cjs/cc/BasicCC.js +23 -24
- package/build/cjs/cc/BasicCC.js.map +3 -3
- package/build/cjs/cc/BasicWindowCoveringCC._validateArgs.d.ts +3 -0
- package/build/cjs/cc/BasicWindowCoveringCC._validateArgs.js +64 -0
- package/build/cjs/cc/BasicWindowCoveringCC._validateArgs.js.map +7 -0
- package/build/cjs/cc/BasicWindowCoveringCC.d.ts +90 -0
- package/build/cjs/cc/BasicWindowCoveringCC.js +273 -0
- package/build/cjs/cc/BasicWindowCoveringCC.js.map +7 -0
- package/build/cjs/cc/BatteryCC.d.ts +4 -7
- package/build/cjs/cc/BatteryCC.js +18 -20
- package/build/cjs/cc/BatteryCC.js.map +3 -3
- package/build/cjs/cc/BinarySensorCC.d.ts +5 -5
- package/build/cjs/cc/BinarySensorCC.js +20 -21
- package/build/cjs/cc/BinarySensorCC.js.map +3 -3
- package/build/cjs/cc/BinarySwitchCC._validateArgs.js +2 -2
- package/build/cjs/cc/BinarySwitchCC.d.ts +6 -6
- package/build/cjs/cc/BinarySwitchCC.js +26 -26
- package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
- package/build/cjs/cc/CRC16CC.d.ts +3 -3
- package/build/cjs/cc/CRC16CC.js +15 -15
- package/build/cjs/cc/CRC16CC.js.map +3 -3
- package/build/cjs/cc/CentralSceneCC.d.ts +8 -8
- package/build/cjs/cc/CentralSceneCC.js +23 -24
- package/build/cjs/cc/CentralSceneCC.js.map +3 -3
- package/build/cjs/cc/ClimateControlScheduleCC.d.ts +6 -6
- package/build/cjs/cc/ClimateControlScheduleCC.js +19 -20
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +3 -3
- package/build/cjs/cc/ClockCC.d.ts +3 -4
- package/build/cjs/cc/ClockCC.js +13 -14
- package/build/cjs/cc/ClockCC.js.map +3 -3
- package/build/cjs/cc/ColorSwitchCC.d.ts +3 -4
- package/build/cjs/cc/ColorSwitchCC.js +22 -24
- package/build/cjs/cc/ColorSwitchCC.js.map +3 -3
- package/build/cjs/cc/ConfigurationCC.d.ts +3 -3
- package/build/cjs/cc/ConfigurationCC.js +114 -115
- package/build/cjs/cc/ConfigurationCC.js.map +3 -3
- package/build/cjs/cc/DeviceResetLocallyCC.d.ts +2 -2
- package/build/cjs/cc/DeviceResetLocallyCC.js +5 -5
- package/build/cjs/cc/DeviceResetLocallyCC.js.map +1 -1
- package/build/cjs/cc/DoorLockCC.d.ts +29 -29
- package/build/cjs/cc/DoorLockCC.js +39 -40
- package/build/cjs/cc/DoorLockCC.js.map +3 -3
- package/build/cjs/cc/DoorLockLoggingCC.d.ts +4 -4
- package/build/cjs/cc/DoorLockLoggingCC.js +13 -14
- package/build/cjs/cc/DoorLockLoggingCC.js.map +3 -3
- package/build/cjs/cc/EnergyProductionCC.d.ts +2 -3
- package/build/cjs/cc/EnergyProductionCC.js.map +2 -2
- package/build/cjs/cc/EntryControlCC.d.ts +8 -8
- package/build/cjs/cc/EntryControlCC.js +41 -42
- package/build/cjs/cc/EntryControlCC.js.map +3 -3
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.d.ts +9 -10
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +52 -53
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +3 -3
- package/build/cjs/cc/HailCC.js +2 -2
- package/build/cjs/cc/HailCC.js.map +1 -1
- package/build/cjs/cc/HumidityControlModeCC.d.ts +5 -5
- package/build/cjs/cc/HumidityControlModeCC.js +20 -21
- package/build/cjs/cc/HumidityControlModeCC.js.map +3 -3
- package/build/cjs/cc/HumidityControlOperatingStateCC.d.ts +3 -3
- package/build/cjs/cc/HumidityControlOperatingStateCC.js +9 -9
- package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +3 -3
- package/build/cjs/cc/HumidityControlSetpointCC.d.ts +6 -6
- package/build/cjs/cc/HumidityControlSetpointCC.js +43 -44
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +3 -3
- package/build/cjs/cc/InclusionControllerCC.d.ts +2 -3
- package/build/cjs/cc/InclusionControllerCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.d.ts +3 -3
- package/build/cjs/cc/IndicatorCC.js +50 -52
- package/build/cjs/cc/IndicatorCC.js.map +3 -3
- package/build/cjs/cc/IrrigationCC.d.ts +3 -3
- package/build/cjs/cc/IrrigationCC.js +74 -75
- package/build/cjs/cc/IrrigationCC.js.map +3 -3
- package/build/cjs/cc/LanguageCC.d.ts +5 -6
- package/build/cjs/cc/LanguageCC.js +14 -15
- package/build/cjs/cc/LanguageCC.js.map +3 -3
- package/build/cjs/cc/LockCC.d.ts +4 -4
- package/build/cjs/cc/LockCC.js +10 -10
- package/build/cjs/cc/LockCC.js.map +3 -3
- package/build/cjs/cc/ManufacturerProprietaryCC.d.ts +3 -3
- package/build/cjs/cc/ManufacturerProprietaryCC.js +10 -10
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +3 -3
- package/build/cjs/cc/ManufacturerSpecificCC.d.ts +7 -8
- package/build/cjs/cc/ManufacturerSpecificCC.js +20 -21
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +3 -3
- package/build/cjs/cc/MeterCC.d.ts +4 -6
- package/build/cjs/cc/MeterCC.js +52 -54
- package/build/cjs/cc/MeterCC.js.map +3 -3
- package/build/cjs/cc/MultiChannelAssociationCC.d.ts +7 -8
- package/build/cjs/cc/MultiChannelAssociationCC.js +34 -35
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +3 -3
- package/build/cjs/cc/MultiChannelCC.d.ts +11 -11
- package/build/cjs/cc/MultiChannelCC.js +53 -53
- package/build/cjs/cc/MultiChannelCC.js.map +3 -3
- package/build/cjs/cc/MultiCommandCC.d.ts +3 -3
- package/build/cjs/cc/MultiCommandCC.js +13 -13
- package/build/cjs/cc/MultiCommandCC.js.map +3 -3
- package/build/cjs/cc/MultilevelSensorCC.d.ts +4 -7
- package/build/cjs/cc/MultilevelSensorCC.js +26 -28
- package/build/cjs/cc/MultilevelSensorCC.js.map +3 -3
- package/build/cjs/cc/MultilevelSwitchCC._validateArgs.js +3 -3
- package/build/cjs/cc/MultilevelSwitchCC.d.ts +13 -13
- package/build/cjs/cc/MultilevelSwitchCC.js +36 -37
- package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
- package/build/cjs/cc/NoOperationCC.js +4 -4
- package/build/cjs/cc/NoOperationCC.js.map +1 -1
- package/build/cjs/cc/NodeNamingCC.d.ts +5 -5
- package/build/cjs/cc/NodeNamingCC.js +20 -20
- package/build/cjs/cc/NodeNamingCC.js.map +3 -3
- package/build/cjs/cc/NotificationCC.d.ts +4 -5
- package/build/cjs/cc/NotificationCC.js +66 -68
- package/build/cjs/cc/NotificationCC.js.map +3 -3
- package/build/cjs/cc/PowerlevelCC.d.ts +3 -3
- package/build/cjs/cc/PowerlevelCC.js +25 -26
- package/build/cjs/cc/PowerlevelCC.js.map +3 -3
- package/build/cjs/cc/ProtectionCC._validateArgs.js +2 -2
- package/build/cjs/cc/ProtectionCC.d.ts +11 -11
- package/build/cjs/cc/ProtectionCC.js +35 -36
- package/build/cjs/cc/ProtectionCC.js.map +3 -3
- package/build/cjs/cc/SceneActivationCC._validateArgs.js +2 -2
- package/build/cjs/cc/SceneActivationCC.d.ts +5 -6
- package/build/cjs/cc/SceneActivationCC.js +10 -10
- package/build/cjs/cc/SceneActivationCC.js.map +3 -3
- package/build/cjs/cc/SceneActuatorConfigurationCC._validateArgs.js +2 -2
- package/build/cjs/cc/SceneActuatorConfigurationCC.d.ts +5 -5
- package/build/cjs/cc/SceneActuatorConfigurationCC.js +19 -20
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +3 -3
- package/build/cjs/cc/SceneControllerConfigurationCC._validateArgs.js +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.d.ts +6 -6
- package/build/cjs/cc/SceneControllerConfigurationCC.js +25 -26
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +3 -3
- package/build/cjs/cc/ScheduleEntryLockCC.d.ts +2 -3
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
- package/build/cjs/cc/Security2CC.d.ts +3 -4
- package/build/cjs/cc/Security2CC.js +60 -62
- package/build/cjs/cc/Security2CC.js.map +3 -3
- package/build/cjs/cc/SecurityCC.d.ts +3 -4
- package/build/cjs/cc/SecurityCC.js +25 -26
- package/build/cjs/cc/SecurityCC.js.map +3 -3
- package/build/cjs/cc/SoundSwitchCC.d.ts +7 -7
- package/build/cjs/cc/SoundSwitchCC.js +28 -29
- package/build/cjs/cc/SoundSwitchCC.js.map +3 -3
- package/build/cjs/cc/SupervisionCC.d.ts +4 -4
- package/build/cjs/cc/SupervisionCC.js +28 -29
- package/build/cjs/cc/SupervisionCC.js.map +3 -3
- package/build/cjs/cc/ThermostatFanModeCC.d.ts +6 -6
- package/build/cjs/cc/ThermostatFanModeCC.js +21 -22
- package/build/cjs/cc/ThermostatFanModeCC.js.map +3 -3
- package/build/cjs/cc/ThermostatFanStateCC.d.ts +3 -3
- package/build/cjs/cc/ThermostatFanStateCC.js +9 -9
- package/build/cjs/cc/ThermostatFanStateCC.js.map +3 -3
- package/build/cjs/cc/ThermostatModeCC.d.ts +6 -6
- package/build/cjs/cc/ThermostatModeCC.js +30 -31
- package/build/cjs/cc/ThermostatModeCC.js.map +3 -3
- package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +3 -4
- package/build/cjs/cc/ThermostatOperatingStateCC.js +9 -9
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +3 -3
- package/build/cjs/cc/ThermostatSetbackCC.d.ts +3 -3
- package/build/cjs/cc/ThermostatSetbackCC.js +14 -15
- package/build/cjs/cc/ThermostatSetbackCC.js.map +3 -3
- package/build/cjs/cc/ThermostatSetpointCC.d.ts +6 -6
- package/build/cjs/cc/ThermostatSetpointCC.js +48 -49
- package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
- package/build/cjs/cc/TimeCC.d.ts +3 -4
- package/build/cjs/cc/TimeCC.js +9 -10
- package/build/cjs/cc/TimeCC.js.map +3 -3
- package/build/cjs/cc/TimeParametersCC.d.ts +3 -4
- package/build/cjs/cc/TimeParametersCC.js +2 -2
- package/build/cjs/cc/TimeParametersCC.js.map +2 -2
- package/build/cjs/cc/TransportServiceCC.d.ts +3 -3
- package/build/cjs/cc/TransportServiceCC.js +44 -45
- package/build/cjs/cc/TransportServiceCC.js.map +3 -3
- package/build/cjs/cc/UserCodeCC.d.ts +19 -19
- package/build/cjs/cc/UserCodeCC.js +102 -103
- package/build/cjs/cc/UserCodeCC.js.map +3 -3
- package/build/cjs/cc/VersionCC.d.ts +17 -17
- package/build/cjs/cc/VersionCC.js +46 -47
- package/build/cjs/cc/VersionCC.js.map +3 -3
- package/build/cjs/cc/WakeUpCC.d.ts +6 -6
- package/build/cjs/cc/WakeUpCC.js +16 -17
- package/build/cjs/cc/WakeUpCC.js.map +3 -3
- package/build/cjs/cc/WindowCoveringCC.d.ts +3 -4
- package/build/cjs/cc/WindowCoveringCC.js +17 -18
- package/build/cjs/cc/WindowCoveringCC.js.map +3 -3
- package/build/cjs/cc/ZWavePlusCC.d.ts +8 -8
- package/build/cjs/cc/ZWavePlusCC.js +15 -16
- package/build/cjs/cc/ZWavePlusCC.js.map +3 -3
- package/build/cjs/cc/ZWaveProtocolCC.d.ts +2 -2
- package/build/cjs/cc/ZWaveProtocolCC.js +35 -35
- package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
- package/build/cjs/cc/_CCValues.generated.d.ts +124 -0
- package/build/cjs/cc/_CCValues.generated.js +93 -26
- package/build/cjs/cc/_CCValues.generated.js.map +3 -3
- package/build/cjs/cc/index.d.ts +2 -0
- package/build/cjs/cc/index.js +9 -0
- package/build/cjs/cc/index.js.map +2 -2
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.d.ts +3 -3
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +14 -14
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/cjs/lib/API.d.ts +5 -3
- package/build/cjs/lib/API.js.map +2 -2
- package/build/cjs/lib/CommandClass.d.ts +5 -6
- package/build/cjs/lib/CommandClass.js +45 -45
- package/build/cjs/lib/CommandClass.js.map +3 -3
- package/build/cjs/lib/CommandClassDecorators.d.ts +2 -2
- package/build/cjs/lib/CommandClassDecorators.js +3 -3
- package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
- package/build/cjs/lib/Security2/Extension.d.ts +2 -2
- package/build/cjs/lib/Security2/Extension.js +17 -17
- package/build/cjs/lib/Security2/Extension.js.map +3 -3
- package/build/cjs/lib/SetValueResult.d.ts +1 -1
- package/build/cjs/lib/SetValueResult.js.map +1 -1
- package/build/cjs/lib/Values.d.ts +3 -3
- package/build/cjs/lib/Values.js +6 -6
- package/build/cjs/lib/Values.js.map +2 -2
- package/build/cjs/lib/_Types.d.ts +6 -2
- package/build/cjs/lib/_Types.js +10 -3
- package/build/cjs/lib/_Types.js.map +3 -3
- package/build/cjs/lib/serializers.d.ts +1 -1
- package/build/cjs/lib/serializers.js +5 -5
- package/build/cjs/lib/serializers.js.map +2 -2
- package/build/cjs/lib/traits.d.ts +2 -2
- package/build/cjs/lib/utils.d.ts +2 -2
- package/build/cjs/lib/utils.js +60 -60
- package/build/cjs/lib/utils.js.map +3 -3
- package/build/esm/cc/AlarmSensorCC.d.ts +7 -7
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +2 -3
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/AssociationCC.d.ts +8 -9
- package/build/esm/cc/AssociationCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC.js +2 -2
- package/build/esm/cc/AssociationCC.js.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts +7 -7
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +2 -3
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts +8 -8
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +2 -3
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.d.ts +4 -4
- package/build/esm/cc/BasicCC.d.ts.map +1 -1
- package/build/esm/cc/BasicCC.js +2 -3
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BasicWindowCoveringCC._validateArgs.d.ts +3 -0
- package/build/esm/cc/BasicWindowCoveringCC._validateArgs.d.ts.map +1 -0
- package/build/esm/cc/BasicWindowCoveringCC._validateArgs.js +22 -0
- package/build/esm/cc/BasicWindowCoveringCC._validateArgs.js.map +1 -0
- package/build/esm/cc/BasicWindowCoveringCC.d.ts +90 -0
- package/build/esm/cc/BasicWindowCoveringCC.d.ts.map +1 -0
- package/build/esm/cc/BasicWindowCoveringCC.js +215 -0
- package/build/esm/cc/BasicWindowCoveringCC.js.map +1 -0
- package/build/esm/cc/BatteryCC.d.ts +4 -7
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +2 -4
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySensorCC.d.ts +5 -5
- package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySensorCC.js +2 -3
- package/build/esm/cc/BinarySensorCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC._validateArgs.js +1 -1
- package/build/esm/cc/BinarySwitchCC._validateArgs.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.d.ts +6 -6
- package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +2 -2
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CRC16CC.d.ts +3 -3
- package/build/esm/cc/CRC16CC.d.ts.map +1 -1
- package/build/esm/cc/CRC16CC.js +2 -2
- package/build/esm/cc/CRC16CC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.d.ts +8 -8
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +2 -3
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts +6 -6
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +2 -3
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.d.ts +3 -4
- package/build/esm/cc/ClockCC.d.ts.map +1 -1
- package/build/esm/cc/ClockCC.js +2 -3
- package/build/esm/cc/ClockCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.d.ts +3 -4
- package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +2 -4
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts +3 -3
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +2 -3
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.d.ts +2 -2
- package/build/esm/cc/DeviceResetLocallyCC.d.ts.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.js +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC.d.ts +29 -29
- package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC.js +2 -3
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.d.ts +4 -4
- package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.js +2 -3
- package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/esm/cc/EnergyProductionCC.d.ts +2 -3
- package/build/esm/cc/EnergyProductionCC.d.ts.map +1 -1
- package/build/esm/cc/EnergyProductionCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts +8 -8
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +2 -3
- package/build/esm/cc/EntryControlCC.js.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts +9 -10
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js +2 -3
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/esm/cc/HailCC.js +1 -1
- package/build/esm/cc/HailCC.js.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.d.ts +5 -5
- package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.js +2 -3
- package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts +3 -3
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.js +2 -2
- package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.d.ts +6 -6
- package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +2 -3
- package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/esm/cc/InclusionControllerCC.d.ts +2 -3
- package/build/esm/cc/InclusionControllerCC.d.ts.map +1 -1
- package/build/esm/cc/InclusionControllerCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts +3 -3
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +2 -4
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts +3 -3
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +2 -3
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.d.ts +5 -6
- package/build/esm/cc/LanguageCC.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC.js +2 -3
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/LockCC.d.ts +4 -4
- package/build/esm/cc/LockCC.d.ts.map +1 -1
- package/build/esm/cc/LockCC.js +2 -2
- package/build/esm/cc/LockCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.d.ts +3 -3
- package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js +2 -2
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.d.ts +7 -8
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +2 -3
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts +4 -6
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +2 -4
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.d.ts +7 -8
- package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.js +2 -3
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts +11 -11
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +2 -2
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultiCommandCC.d.ts +3 -3
- package/build/esm/cc/MultiCommandCC.d.ts.map +1 -1
- package/build/esm/cc/MultiCommandCC.js +2 -2
- package/build/esm/cc/MultiCommandCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.d.ts +4 -7
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +2 -4
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC._validateArgs.js +1 -1
- package/build/esm/cc/MultilevelSwitchCC._validateArgs.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts +13 -13
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +2 -3
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NoOperationCC.js +1 -1
- package/build/esm/cc/NoOperationCC.js.map +1 -1
- package/build/esm/cc/NodeNamingCC.d.ts +5 -5
- package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC.js +2 -2
- package/build/esm/cc/NodeNamingCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts +4 -5
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +2 -4
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/PowerlevelCC.d.ts +3 -3
- package/build/esm/cc/PowerlevelCC.d.ts.map +1 -1
- package/build/esm/cc/PowerlevelCC.js +2 -3
- package/build/esm/cc/PowerlevelCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC._validateArgs.js +1 -1
- package/build/esm/cc/ProtectionCC._validateArgs.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts +11 -11
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +2 -3
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActivationCC._validateArgs.js +1 -1
- package/build/esm/cc/SceneActivationCC._validateArgs.js.map +1 -1
- package/build/esm/cc/SceneActivationCC.d.ts +5 -6
- package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActivationCC.js +2 -2
- package/build/esm/cc/SceneActivationCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC._validateArgs.js +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC._validateArgs.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts +5 -5
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +2 -3
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC._validateArgs.js +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC._validateArgs.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts +6 -6
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +2 -3
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.d.ts +2 -3
- package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.d.ts +3 -4
- package/build/esm/cc/Security2CC.d.ts.map +1 -1
- package/build/esm/cc/Security2CC.js +2 -4
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.d.ts +3 -4
- package/build/esm/cc/SecurityCC.d.ts.map +1 -1
- package/build/esm/cc/SecurityCC.js +1 -2
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.d.ts +7 -7
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +2 -3
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.d.ts +4 -4
- package/build/esm/cc/SupervisionCC.d.ts.map +1 -1
- package/build/esm/cc/SupervisionCC.js +2 -3
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.d.ts +6 -6
- package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +2 -3
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.d.ts +3 -3
- package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js +2 -2
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.d.ts +6 -6
- package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +2 -3
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts +3 -4
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.js +2 -2
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.d.ts +3 -3
- package/build/esm/cc/ThermostatSetbackCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js +2 -3
- package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts +6 -6
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +2 -3
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TimeCC.d.ts +3 -4
- package/build/esm/cc/TimeCC.d.ts.map +1 -1
- package/build/esm/cc/TimeCC.js +1 -2
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/TimeParametersCC.d.ts +3 -4
- package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
- package/build/esm/cc/TimeParametersCC.js +1 -1
- package/build/esm/cc/TimeParametersCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.d.ts +3 -3
- package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +2 -3
- package/build/esm/cc/TransportServiceCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts +19 -19
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +2 -3
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts +17 -17
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +2 -3
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.d.ts +6 -6
- package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
- package/build/esm/cc/WakeUpCC.js +2 -3
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts +3 -4
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +1 -2
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.d.ts +8 -8
- package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +2 -3
- package/build/esm/cc/ZWavePlusCC.js.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.d.ts +2 -2
- package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/esm/cc/_CCValues.generated.d.ts +124 -0
- package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
- package/build/esm/cc/_CCValues.generated.js +75 -4
- package/build/esm/cc/_CCValues.generated.js.map +1 -1
- package/build/esm/cc/index.d.ts +2 -0
- package/build/esm/cc/index.d.ts.map +1 -1
- package/build/esm/cc/index.js +1 -0
- package/build/esm/cc/index.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts +3 -3
- package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/lib/API.d.ts +5 -3
- package/build/esm/lib/API.d.ts.map +1 -1
- package/build/esm/lib/API.js.map +1 -1
- package/build/esm/lib/CommandClass.d.ts +5 -6
- package/build/esm/lib/CommandClass.d.ts.map +1 -1
- package/build/esm/lib/CommandClass.js +2 -2
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/CommandClassDecorators.d.ts +2 -2
- package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
- package/build/esm/lib/CommandClassDecorators.js +1 -1
- package/build/esm/lib/CommandClassDecorators.js.map +1 -1
- package/build/esm/lib/Security2/Extension.d.ts +2 -2
- package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
- package/build/esm/lib/Security2/Extension.js +2 -2
- package/build/esm/lib/Security2/Extension.js.map +1 -1
- package/build/esm/lib/SetValueResult.d.ts +1 -1
- package/build/esm/lib/SetValueResult.d.ts.map +1 -1
- package/build/esm/lib/Values.d.ts +3 -3
- package/build/esm/lib/Values.d.ts.map +1 -1
- package/build/esm/lib/Values.js +1 -1
- package/build/esm/lib/Values.js.map +1 -1
- package/build/esm/lib/_Types.d.ts +6 -2
- package/build/esm/lib/_Types.d.ts.map +1 -1
- package/build/esm/lib/_Types.js +6 -1
- package/build/esm/lib/_Types.js.map +1 -1
- package/build/esm/lib/serializers.d.ts +1 -1
- package/build/esm/lib/serializers.d.ts.map +1 -1
- package/build/esm/lib/serializers.js +1 -1
- package/build/esm/lib/serializers.js.map +1 -1
- package/build/esm/lib/traits.d.ts +2 -2
- package/build/esm/lib/traits.d.ts.map +1 -1
- package/build/esm/lib/utils.d.ts +2 -2
- package/build/esm/lib/utils.d.ts.map +1 -1
- package/build/esm/lib/utils.js +2 -2
- package/build/esm/lib/utils.js.map +1 -1
- package/package.json +6 -6
|
@@ -38,8 +38,8 @@ __export(BinarySwitchCC_exports, {
|
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(BinarySwitchCC_exports);
|
|
40
40
|
var __validateArgs = __toESM(require("./BinarySwitchCC._validateArgs.js"), 1);
|
|
41
|
-
var
|
|
42
|
-
var
|
|
41
|
+
var import_core = require("@zwave-js/core");
|
|
42
|
+
var import_shared = require("@zwave-js/shared");
|
|
43
43
|
var import_API = require("../lib/API.js");
|
|
44
44
|
var import_CommandClass = require("../lib/CommandClass.js");
|
|
45
45
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|
|
@@ -88,7 +88,7 @@ var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializ
|
|
|
88
88
|
};
|
|
89
89
|
const { validateArgs_BinarySwitchCCAPI_set } = __validateArgs;
|
|
90
90
|
let BinarySwitchCCAPI = (() => {
|
|
91
|
-
let _classDecorators = [(0, import_CommandClassDecorators.API)(
|
|
91
|
+
let _classDecorators = [(0, import_CommandClassDecorators.API)(import_core.CommandClasses["Binary Switch"])];
|
|
92
92
|
let _classDescriptor;
|
|
93
93
|
let _classExtraInitializers = [];
|
|
94
94
|
let _classThis;
|
|
@@ -159,7 +159,7 @@ let BinarySwitchCCAPI = (() => {
|
|
|
159
159
|
if (typeof value !== "boolean") {
|
|
160
160
|
(0, import_API.throwWrongValueType)(this.ccId, property, "boolean", typeof value);
|
|
161
161
|
}
|
|
162
|
-
const duration =
|
|
162
|
+
const duration = import_core.Duration.from(options?.transitionDuration);
|
|
163
163
|
return this.set(value, duration);
|
|
164
164
|
};
|
|
165
165
|
}
|
|
@@ -180,7 +180,7 @@ let BinarySwitchCCAPI = (() => {
|
|
|
180
180
|
verifyChanges: /* @__PURE__ */ __name(() => {
|
|
181
181
|
if (this.isSinglecast()) {
|
|
182
182
|
this.schedulePoll(currentValueValueId, value, {
|
|
183
|
-
duration:
|
|
183
|
+
duration: import_core.Duration.from(options?.transitionDuration),
|
|
184
184
|
// on/off "transitions" are usually fast
|
|
185
185
|
transition: "fast"
|
|
186
186
|
});
|
|
@@ -206,7 +206,7 @@ let BinarySwitchCCAPI = (() => {
|
|
|
206
206
|
return BinarySwitchCCAPI2 = _classThis;
|
|
207
207
|
})();
|
|
208
208
|
let BinarySwitchCC = (() => {
|
|
209
|
-
let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(
|
|
209
|
+
let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_core.CommandClasses["Binary Switch"]), (0, import_CommandClassDecorators.implementedVersion)(2), (0, import_CommandClassDecorators.ccValues)(import_CCValues_generated.BinarySwitchCCValues)];
|
|
210
210
|
let _classDescriptor;
|
|
211
211
|
let _classExtraInitializers = [];
|
|
212
212
|
let _classThis;
|
|
@@ -238,8 +238,8 @@ let BinarySwitchCC = (() => {
|
|
|
238
238
|
async refreshValues(ctx) {
|
|
239
239
|
const node = this.getNode(ctx);
|
|
240
240
|
const endpoint = this.getEndpoint(ctx);
|
|
241
|
-
const api = import_API.CCAPI.create(
|
|
242
|
-
priority:
|
|
241
|
+
const api = import_API.CCAPI.create(import_core.CommandClasses["Binary Switch"], ctx, endpoint).withOptions({
|
|
242
|
+
priority: import_core.MessagePriority.NodeQuery
|
|
243
243
|
});
|
|
244
244
|
ctx.logNode(node.id, {
|
|
245
245
|
endpoint: this.endpointIndex,
|
|
@@ -292,14 +292,14 @@ let BinarySwitchCCSet = (() => {
|
|
|
292
292
|
constructor(options) {
|
|
293
293
|
super(options);
|
|
294
294
|
this.targetValue = options.targetValue;
|
|
295
|
-
this.duration =
|
|
295
|
+
this.duration = import_core.Duration.from(options.duration);
|
|
296
296
|
}
|
|
297
297
|
static from(raw, ctx) {
|
|
298
|
-
(0,
|
|
298
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
299
299
|
const targetValue = !!raw.payload[0];
|
|
300
300
|
let duration;
|
|
301
301
|
if (raw.payload.length >= 2) {
|
|
302
|
-
duration =
|
|
302
|
+
duration = import_core.Duration.parseSet(raw.payload[1]);
|
|
303
303
|
}
|
|
304
304
|
return new this({
|
|
305
305
|
nodeId: ctx.sourceNodeId,
|
|
@@ -310,9 +310,9 @@ let BinarySwitchCCSet = (() => {
|
|
|
310
310
|
targetValue;
|
|
311
311
|
duration;
|
|
312
312
|
serialize(ctx) {
|
|
313
|
-
this.payload =
|
|
313
|
+
this.payload = import_shared.Bytes.from([
|
|
314
314
|
this.targetValue ? 255 : 0,
|
|
315
|
-
(this.duration ??
|
|
315
|
+
(this.duration ?? import_core.Duration.default()).serializeSet()
|
|
316
316
|
]);
|
|
317
317
|
const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
|
|
318
318
|
if (ccVersion < 2 && ctx.getDeviceConfig?.(this.nodeId)?.compat?.encodeCCsUsingTargetVersion) {
|
|
@@ -359,16 +359,16 @@ let BinarySwitchCCReport = (() => {
|
|
|
359
359
|
super(options);
|
|
360
360
|
this.currentValue = options.currentValue;
|
|
361
361
|
this.targetValue = options.targetValue;
|
|
362
|
-
this.duration =
|
|
362
|
+
this.duration = import_core.Duration.from(options.duration);
|
|
363
363
|
}
|
|
364
364
|
static from(raw, ctx) {
|
|
365
|
-
(0,
|
|
366
|
-
const currentValue = (0,
|
|
365
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
366
|
+
const currentValue = (0, import_core.parseMaybeBoolean)(raw.payload[0]);
|
|
367
367
|
let targetValue;
|
|
368
368
|
let duration;
|
|
369
369
|
if (raw.payload.length >= 3) {
|
|
370
|
-
targetValue = (0,
|
|
371
|
-
duration =
|
|
370
|
+
targetValue = (0, import_core.parseMaybeBoolean)(raw.payload[1]);
|
|
371
|
+
duration = import_core.Duration.parseReport(raw.payload[2]);
|
|
372
372
|
}
|
|
373
373
|
return new this({
|
|
374
374
|
nodeId: ctx.sourceNodeId,
|
|
@@ -381,15 +381,15 @@ let BinarySwitchCCReport = (() => {
|
|
|
381
381
|
targetValue;
|
|
382
382
|
duration;
|
|
383
383
|
serialize(ctx) {
|
|
384
|
-
this.payload =
|
|
385
|
-
(0,
|
|
384
|
+
this.payload = import_shared.Bytes.from([
|
|
385
|
+
(0, import_core.encodeMaybeBoolean)(this.currentValue ?? import_core.UNKNOWN_STATE)
|
|
386
386
|
]);
|
|
387
387
|
if (this.targetValue !== void 0) {
|
|
388
|
-
this.payload =
|
|
388
|
+
this.payload = import_shared.Bytes.concat([
|
|
389
389
|
this.payload,
|
|
390
|
-
|
|
391
|
-
(0,
|
|
392
|
-
(this.duration ??
|
|
390
|
+
import_shared.Bytes.from([
|
|
391
|
+
(0, import_core.encodeMaybeBoolean)(this.targetValue),
|
|
392
|
+
(this.duration ?? import_core.Duration.default()).serializeReport()
|
|
393
393
|
])
|
|
394
394
|
]);
|
|
395
395
|
}
|
|
@@ -397,10 +397,10 @@ let BinarySwitchCCReport = (() => {
|
|
|
397
397
|
}
|
|
398
398
|
toLogEntry(ctx) {
|
|
399
399
|
const message = {
|
|
400
|
-
"current value": (0,
|
|
400
|
+
"current value": (0, import_core.maybeUnknownToString)(this.currentValue)
|
|
401
401
|
};
|
|
402
402
|
if (this.targetValue !== void 0) {
|
|
403
|
-
message["target value"] = (0,
|
|
403
|
+
message["target value"] = (0, import_core.maybeUnknownToString)(this.targetValue);
|
|
404
404
|
}
|
|
405
405
|
if (this.duration != void 0) {
|
|
406
406
|
message.duration = this.duration.toString();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/BinarySwitchCC.ts"],
|
|
4
|
-
"sourcesContent": ["import { type CCEncodingContext, type CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\tDuration,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MaybeUnknown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\tUNKNOWN_STATE,\n\tValueMetadata,\n\ttype WithAddress,\n\tencodeMaybeBoolean,\n\tmaybeUnknownToString,\n\tparseMaybeBoolean,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\tSET_VALUE_HOOKS,\n\ttype SetValueImplementation,\n\ttype SetValueImplementationHooksFactory,\n\tthrowUnsupportedProperty,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype RefreshValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { BinarySwitchCommand } from \"../lib/_Types.js\";\n\nexport const BinarySwitchCCValues = V.defineCCValues(\n\tCommandClasses[\"Binary Switch\"],\n\t{\n\t\t...V.staticProperty(\n\t\t\t\"currentValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Current value\",\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"targetValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Boolean,\n\t\t\t\tlabel: \"Target value\",\n\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"duration\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyDuration,\n\t\t\t\tlabel: \"Remaining duration\",\n\t\t\t} as const,\n\t\t\t{ minVersion: 2 } as const,\n\t\t),\n\t},\n);\n\n@API(CommandClasses[\"Binary Switch\"])\nexport class BinarySwitchCCAPI extends CCAPI {\n\tpublic supportsCommand(cmd: BinarySwitchCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase BinarySwitchCommand.Get:\n\t\t\t\treturn this.isSinglecast();\n\t\t\tcase BinarySwitchCommand.Set:\n\t\t\t\treturn true;\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async get() {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySwitchCommand,\n\t\t\tBinarySwitchCommand.Get,\n\t\t);\n\n\t\tconst cc = new BinarySwitchCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<BinarySwitchCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\t// interpret unknown values as false\n\t\t\t\tcurrentValue: response.currentValue || false,\n\t\t\t\ttargetValue: response.targetValue,\n\t\t\t\tduration: response.duration,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Sets the switch to the given value\n\t * @param targetValue The target value to set\n\t * @param duration The duration after which the target value should be reached. Can be a Duration instance or a user-friendly duration string like `\"1m17s\"`. Only supported in V2 and above.\n\t */\n\t@validateArgs()\n\tpublic async set(\n\t\ttargetValue: boolean,\n\t\tduration?: Duration | string,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySwitchCommand,\n\t\t\tBinarySwitchCommand.Set,\n\t\t);\n\n\t\tconst cc = new BinarySwitchCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tprotected override get [SET_VALUE](): SetValueImplementation {\n\t\treturn async function(\n\t\t\tthis: BinarySwitchCCAPI,\n\t\t\t{ property },\n\t\t\tvalue,\n\t\t\toptions,\n\t\t) {\n\t\t\tif (property !== \"targetValue\") {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t\tif (typeof value !== \"boolean\") {\n\t\t\t\tthrowWrongValueType(\n\t\t\t\t\tthis.ccId,\n\t\t\t\t\tproperty,\n\t\t\t\t\t\"boolean\",\n\t\t\t\t\ttypeof value,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\treturn this.set(value, duration);\n\t\t};\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory = (\n\t\t{ property },\n\t\tvalue,\n\t\toptions,\n\t) => {\n\t\tif (property === \"targetValue\") {\n\t\t\tconst currentValueValueId = BinarySwitchCCValues.currentValue\n\t\t\t\t.endpoint(this.endpoint.index);\n\n\t\t\treturn {\n\t\t\t\toptimisticallyUpdateRelatedValues: (\n\t\t\t\t\t_supervisedAndSuccessful,\n\t\t\t\t) => {\n\t\t\t\t\t// After setting targetValue, optimistically update currentValue\n\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\tthis.tryGetValueDB()?.setValue(\n\t\t\t\t\t\t\tcurrentValueValueId,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (this.isMulticast()) {\n\t\t\t\t\t\t// Figure out which nodes were affected by this command\n\t\t\t\t\t\tconst affectedNodes = this.endpoint.node.physicalNodes\n\t\t\t\t\t\t\t.filter((node) =>\n\t\t\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t\t\t\t?.supportsCC(this.ccId)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t// and optimistically update the currentValue\n\t\t\t\t\t\tfor (const node of affectedNodes) {\n\t\t\t\t\t\t\tthis.host\n\t\t\t\t\t\t\t\t.tryGetValueDB(node.id)\n\t\t\t\t\t\t\t\t?.setValue(currentValueValueId, value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tverifyChanges: () => {\n\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\t// We query currentValue instead of targetValue to make sure that unsolicited updates cancel the scheduled poll\n\t\t\t\t\t\tthis.schedulePoll(currentValueValueId, value, {\n\t\t\t\t\t\t\tduration: Duration.from(\n\t\t\t\t\t\t\t\toptions?.transitionDuration,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t// on/off \"transitions\" are usually fast\n\t\t\t\t\t\t\ttransition: \"fast\",\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// For multicasts, do not schedule a refresh - this could cause a LOT of traffic\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t};\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: BinarySwitchCCAPI, { property }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"currentValue\":\n\t\t\t\tcase \"targetValue\":\n\t\t\t\tcase \"duration\":\n\t\t\t\t\treturn (await this.get())?.[property];\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n}\n\n@commandClass(CommandClasses[\"Binary Switch\"])\n@implementedVersion(2)\n@ccValues(BinarySwitchCCValues)\nexport class BinarySwitchCC extends CommandClass {\n\tdeclare ccCommand: BinarySwitchCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Binary Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\t// Query the current state\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying Binary Switch state...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\n\t\tconst resp = await api.get();\n\t\tif (resp) {\n\t\t\tlet logMessage = `received Binary Switch state:\ncurrent value: ${resp.currentValue}`;\n\t\t\tif (resp.targetValue != undefined) {\n\t\t\t\tlogMessage += `\ntarget value: ${resp.targetValue}\nremaining duration: ${resp.duration?.toString() ?? \"undefined\"}`;\n\t\t\t}\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: logMessage,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic setMappedBasicValue(\n\t\tctx: GetValueDB,\n\t\tvalue: number,\n\t): boolean {\n\t\tthis.setValue(ctx, BinarySwitchCCValues.currentValue, value > 0);\n\t\treturn true;\n\t}\n}\n\n// @publicAPI\nexport interface BinarySwitchCCSetOptions {\n\ttargetValue: boolean;\n\tduration?: Duration | string;\n}\n\n@CCCommand(BinarySwitchCommand.Set)\n@useSupervision()\nexport class BinarySwitchCCSet extends BinarySwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySwitchCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): BinarySwitchCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst targetValue = !!raw.payload[0];\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 2) {\n\t\t\tduration = Duration.parseSet(raw.payload[1]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic targetValue: boolean;\n\tpublic duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.targetValue ? 0xff : 0x00,\n\t\t\t(this.duration ?? Duration.default()).serializeSet(),\n\t\t]);\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 2 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1, only send the target value\n\t\t\tthis.payload = this.payload.subarray(0, 1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"target value\": this.targetValue,\n\t\t};\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface BinarySwitchCCReportOptions {\n\tcurrentValue?: MaybeUnknown<boolean>;\n\ttargetValue?: MaybeUnknown<boolean>;\n\tduration?: Duration | string;\n}\n\n@CCCommand(BinarySwitchCommand.Report)\n@ccValueProperty(\"currentValue\", BinarySwitchCCValues.currentValue)\n@ccValueProperty(\"targetValue\", BinarySwitchCCValues.targetValue)\n@ccValueProperty(\"duration\", BinarySwitchCCValues.duration)\nexport class BinarySwitchCCReport extends BinarySwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySwitchCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.currentValue = options.currentValue;\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BinarySwitchCCReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst currentValue: MaybeUnknown<boolean> | undefined =\n\t\t\tparseMaybeBoolean(\n\t\t\t\traw.payload[0],\n\t\t\t);\n\t\tlet targetValue: MaybeUnknown<boolean> | undefined;\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\ttargetValue = parseMaybeBoolean(raw.payload[1]);\n\t\t\tduration = Duration.parseReport(raw.payload[2]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcurrentValue,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic readonly currentValue: MaybeUnknown<boolean> | undefined;\n\n\tpublic readonly targetValue: MaybeUnknown<boolean> | undefined;\n\n\tpublic readonly duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tencodeMaybeBoolean(this.currentValue ?? UNKNOWN_STATE),\n\t\t]);\n\t\tif (this.targetValue !== undefined) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tBytes.from([\n\t\t\t\t\tencodeMaybeBoolean(this.targetValue),\n\t\t\t\t\t(this.duration ?? Duration.default()).serializeReport(),\n\t\t\t\t]),\n\t\t\t]);\n\t\t}\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"current value\": maybeUnknownToString(this.currentValue),\n\t\t};\n\t\tif (this.targetValue !== undefined) {\n\t\t\tmessage[\"target value\"] = maybeUnknownToString(this.targetValue);\n\t\t}\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(BinarySwitchCommand.Get)\n@expectedCCResponse(BinarySwitchCCReport)\nexport class BinarySwitchCCGet extends BinarySwitchCC {}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAiBO;AACP,
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\tDuration,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MaybeUnknown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\tUNKNOWN_STATE,\n\tValueMetadata,\n\ttype WithAddress,\n\tencodeMaybeBoolean,\n\tmaybeUnknownToString,\n\tparseMaybeBoolean,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\tSET_VALUE_HOOKS,\n\ttype SetValueImplementation,\n\ttype SetValueImplementationHooksFactory,\n\tthrowUnsupportedProperty,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype RefreshValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { BinarySwitchCommand } from \"../lib/_Types.js\";\n\nexport const BinarySwitchCCValues = V.defineCCValues(\n\tCommandClasses[\"Binary Switch\"],\n\t{\n\t\t...V.staticProperty(\n\t\t\t\"currentValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Current value\",\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"targetValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Boolean,\n\t\t\t\tlabel: \"Target value\",\n\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"duration\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyDuration,\n\t\t\t\tlabel: \"Remaining duration\",\n\t\t\t} as const,\n\t\t\t{ minVersion: 2 } as const,\n\t\t),\n\t},\n);\n\n@API(CommandClasses[\"Binary Switch\"])\nexport class BinarySwitchCCAPI extends CCAPI {\n\tpublic supportsCommand(cmd: BinarySwitchCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase BinarySwitchCommand.Get:\n\t\t\t\treturn this.isSinglecast();\n\t\t\tcase BinarySwitchCommand.Set:\n\t\t\t\treturn true;\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async get() {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySwitchCommand,\n\t\t\tBinarySwitchCommand.Get,\n\t\t);\n\n\t\tconst cc = new BinarySwitchCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<BinarySwitchCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\t// interpret unknown values as false\n\t\t\t\tcurrentValue: response.currentValue || false,\n\t\t\t\ttargetValue: response.targetValue,\n\t\t\t\tduration: response.duration,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Sets the switch to the given value\n\t * @param targetValue The target value to set\n\t * @param duration The duration after which the target value should be reached. Can be a Duration instance or a user-friendly duration string like `\"1m17s\"`. Only supported in V2 and above.\n\t */\n\t@validateArgs()\n\tpublic async set(\n\t\ttargetValue: boolean,\n\t\tduration?: Duration | string,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySwitchCommand,\n\t\t\tBinarySwitchCommand.Set,\n\t\t);\n\n\t\tconst cc = new BinarySwitchCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tprotected override get [SET_VALUE](): SetValueImplementation {\n\t\treturn async function(\n\t\t\tthis: BinarySwitchCCAPI,\n\t\t\t{ property },\n\t\t\tvalue,\n\t\t\toptions,\n\t\t) {\n\t\t\tif (property !== \"targetValue\") {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t\tif (typeof value !== \"boolean\") {\n\t\t\t\tthrowWrongValueType(\n\t\t\t\t\tthis.ccId,\n\t\t\t\t\tproperty,\n\t\t\t\t\t\"boolean\",\n\t\t\t\t\ttypeof value,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\treturn this.set(value, duration);\n\t\t};\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory = (\n\t\t{ property },\n\t\tvalue,\n\t\toptions,\n\t) => {\n\t\tif (property === \"targetValue\") {\n\t\t\tconst currentValueValueId = BinarySwitchCCValues.currentValue\n\t\t\t\t.endpoint(this.endpoint.index);\n\n\t\t\treturn {\n\t\t\t\toptimisticallyUpdateRelatedValues: (\n\t\t\t\t\t_supervisedAndSuccessful,\n\t\t\t\t) => {\n\t\t\t\t\t// After setting targetValue, optimistically update currentValue\n\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\tthis.tryGetValueDB()?.setValue(\n\t\t\t\t\t\t\tcurrentValueValueId,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (this.isMulticast()) {\n\t\t\t\t\t\t// Figure out which nodes were affected by this command\n\t\t\t\t\t\tconst affectedNodes = this.endpoint.node.physicalNodes\n\t\t\t\t\t\t\t.filter((node) =>\n\t\t\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t\t\t\t?.supportsCC(this.ccId)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t// and optimistically update the currentValue\n\t\t\t\t\t\tfor (const node of affectedNodes) {\n\t\t\t\t\t\t\tthis.host\n\t\t\t\t\t\t\t\t.tryGetValueDB(node.id)\n\t\t\t\t\t\t\t\t?.setValue(currentValueValueId, value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tverifyChanges: () => {\n\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\t// We query currentValue instead of targetValue to make sure that unsolicited updates cancel the scheduled poll\n\t\t\t\t\t\tthis.schedulePoll(currentValueValueId, value, {\n\t\t\t\t\t\t\tduration: Duration.from(\n\t\t\t\t\t\t\t\toptions?.transitionDuration,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t// on/off \"transitions\" are usually fast\n\t\t\t\t\t\t\ttransition: \"fast\",\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// For multicasts, do not schedule a refresh - this could cause a LOT of traffic\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t};\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: BinarySwitchCCAPI, { property }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"currentValue\":\n\t\t\t\tcase \"targetValue\":\n\t\t\t\tcase \"duration\":\n\t\t\t\t\treturn (await this.get())?.[property];\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n}\n\n@commandClass(CommandClasses[\"Binary Switch\"])\n@implementedVersion(2)\n@ccValues(BinarySwitchCCValues)\nexport class BinarySwitchCC extends CommandClass {\n\tdeclare ccCommand: BinarySwitchCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Binary Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\t// Query the current state\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying Binary Switch state...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\n\t\tconst resp = await api.get();\n\t\tif (resp) {\n\t\t\tlet logMessage = `received Binary Switch state:\ncurrent value: ${resp.currentValue}`;\n\t\t\tif (resp.targetValue != undefined) {\n\t\t\t\tlogMessage += `\ntarget value: ${resp.targetValue}\nremaining duration: ${resp.duration?.toString() ?? \"undefined\"}`;\n\t\t\t}\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: logMessage,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic setMappedBasicValue(\n\t\tctx: GetValueDB,\n\t\tvalue: number,\n\t): boolean {\n\t\tthis.setValue(ctx, BinarySwitchCCValues.currentValue, value > 0);\n\t\treturn true;\n\t}\n}\n\n// @publicAPI\nexport interface BinarySwitchCCSetOptions {\n\ttargetValue: boolean;\n\tduration?: Duration | string;\n}\n\n@CCCommand(BinarySwitchCommand.Set)\n@useSupervision()\nexport class BinarySwitchCCSet extends BinarySwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySwitchCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): BinarySwitchCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst targetValue = !!raw.payload[0];\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 2) {\n\t\t\tduration = Duration.parseSet(raw.payload[1]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic targetValue: boolean;\n\tpublic duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.targetValue ? 0xff : 0x00,\n\t\t\t(this.duration ?? Duration.default()).serializeSet(),\n\t\t]);\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 2 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1, only send the target value\n\t\t\tthis.payload = this.payload.subarray(0, 1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"target value\": this.targetValue,\n\t\t};\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface BinarySwitchCCReportOptions {\n\tcurrentValue?: MaybeUnknown<boolean>;\n\ttargetValue?: MaybeUnknown<boolean>;\n\tduration?: Duration | string;\n}\n\n@CCCommand(BinarySwitchCommand.Report)\n@ccValueProperty(\"currentValue\", BinarySwitchCCValues.currentValue)\n@ccValueProperty(\"targetValue\", BinarySwitchCCValues.targetValue)\n@ccValueProperty(\"duration\", BinarySwitchCCValues.duration)\nexport class BinarySwitchCCReport extends BinarySwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySwitchCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.currentValue = options.currentValue;\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BinarySwitchCCReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst currentValue: MaybeUnknown<boolean> | undefined =\n\t\t\tparseMaybeBoolean(\n\t\t\t\traw.payload[0],\n\t\t\t);\n\t\tlet targetValue: MaybeUnknown<boolean> | undefined;\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\ttargetValue = parseMaybeBoolean(raw.payload[1]);\n\t\t\tduration = Duration.parseReport(raw.payload[2]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcurrentValue,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic readonly currentValue: MaybeUnknown<boolean> | undefined;\n\n\tpublic readonly targetValue: MaybeUnknown<boolean> | undefined;\n\n\tpublic readonly duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tencodeMaybeBoolean(this.currentValue ?? UNKNOWN_STATE),\n\t\t]);\n\t\tif (this.targetValue !== undefined) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tBytes.from([\n\t\t\t\t\tencodeMaybeBoolean(this.targetValue),\n\t\t\t\t\t(this.duration ?? Duration.default()).serializeReport(),\n\t\t\t\t]),\n\t\t\t]);\n\t\t}\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"current value\": maybeUnknownToString(this.currentValue),\n\t\t};\n\t\tif (this.targetValue !== undefined) {\n\t\t\tmessage[\"target value\"] = maybeUnknownToString(this.targetValue);\n\t\t}\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(BinarySwitchCommand.Get)\n@expectedCCResponse(BinarySwitchCCReport)\nexport class BinarySwitchCCGet extends BinarySwitchCC {}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAiBO;AACP,oBAAsB;AAEtB,iBAUO;AACP,0BAMO;AACP,oCASO;AACP,oBAAkB;AAClB,mBAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgCvB,qBAAiB,MAAA;8BAD7B,mCAAI,2BAAe,eAAe,CAAC,CAAC;;;;oBACE;;;yCAAA,YAAK;WAAA;;;;;;;;AA0C3C,mBAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAgB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AA1CjB,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;IACL,gBAAgB,KAAwB;AAC9C,cAAQ,KAAK;QACZ,KAAK,iCAAoB;AACxB,iBAAO,KAAK,aAAY;QACzB,KAAK,iCAAoB;AACxB,iBAAO;MACT;AACA,aAAO,MAAM,gBAAgB,GAAG;IACjC;;IAGO,MAAM,MAAG;AACf,WAAK,sBACJ,kCACA,iCAAoB,GAAG;AAGxB,YAAM,KAAK,IAAI,kBAAkB;QAChC,QAAQ,KAAK,SAAS;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A,aAAO,IAAI,KAAK;QACf,QAAQ,IAAI;QACZ;QACA;QACA;OACA;IACF;IAEgB;IAEA;IAEA;IAET,UAAU,KAAsB;AACtC,WAAK,UAAU,oBAAM,KAAK;YACzB,gCAAmB,KAAK,gBAAgB,yBAAa;OACrD;AACD,UAAI,KAAK,gBAAgB,QAAW;AACnC,aAAK,UAAU,oBAAM,OAAO;UAC3B,KAAK;UACL,oBAAM,KAAK;gBACV,gCAAmB,KAAK,WAAW;aAClC,KAAK,YAAY,qBAAS,QAAO,GAAI,gBAAe;WACrD;SACD;MACF;AACA,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,YAAM,UAAyB;QAC9B,qBAAiB,kCAAqB,KAAK,YAAY;;AAExD,UAAI,KAAK,gBAAgB,QAAW;AACnC,gBAAQ,cAAc,QAAI,kCAAqB,KAAK,WAAW;MAChE;AACA,UAAI,KAAK,YAAY,QAAW;AAC/B,gBAAQ,WAAW,KAAK,SAAS,SAAQ;MAC1C;AACA,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB;;IAEF;;;;IAKY,qBAAiB,MAAA;8BAF7B,yCAAU,iCAAoB,GAAG,OACjC,kDAAmB,oBAAoB,CAAC;;;;oBACF;yCAAA,YAAc;WAAA;;;;;;;;AAArD,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;;;;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type WithAddress } from "@zwave-js/core
|
|
1
|
+
import { type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type WithAddress } from "@zwave-js/core";
|
|
2
2
|
import { CCAPI } from "../lib/API.js";
|
|
3
3
|
import { type CCRaw, CommandClass } from "../lib/CommandClass.js";
|
|
4
|
-
import {
|
|
5
|
-
import { Bytes } from "@zwave-js/shared
|
|
4
|
+
import type { CCEncodingContext, CCParsingContext } from "@zwave-js/cc";
|
|
5
|
+
import { Bytes } from "@zwave-js/shared";
|
|
6
6
|
import { CRC16Command } from "../lib/_Types.js";
|
|
7
7
|
export declare class CRC16CCAPI extends CCAPI {
|
|
8
8
|
supportsCommand(_cmd: CRC16Command): MaybeNotKnown<boolean>;
|
package/build/cjs/cc/CRC16CC.js
CHANGED
|
@@ -24,11 +24,11 @@ __export(CRC16CC_exports, {
|
|
|
24
24
|
CRC16CCCommandEncapsulation: () => CRC16CCCommandEncapsulation
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(CRC16CC_exports);
|
|
27
|
-
var
|
|
27
|
+
var import_core = require("@zwave-js/core");
|
|
28
28
|
var import_API = require("../lib/API.js");
|
|
29
29
|
var import_CommandClass = require("../lib/CommandClass.js");
|
|
30
30
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|
|
31
|
-
var
|
|
31
|
+
var import_shared = require("@zwave-js/shared");
|
|
32
32
|
var import_Types = require("../lib/_Types.js");
|
|
33
33
|
var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
34
34
|
function accept(f) {
|
|
@@ -70,12 +70,12 @@ var __runInitializers = function(thisArg, initializers, value) {
|
|
|
70
70
|
}
|
|
71
71
|
return useValue ? value : void 0;
|
|
72
72
|
};
|
|
73
|
-
const headerBuffer =
|
|
74
|
-
|
|
73
|
+
const headerBuffer = import_shared.Bytes.from([
|
|
74
|
+
import_core.CommandClasses["CRC-16 Encapsulation"],
|
|
75
75
|
import_Types.CRC16Command.CommandEncapsulation
|
|
76
76
|
]);
|
|
77
77
|
let CRC16CCAPI = (() => {
|
|
78
|
-
let _classDecorators = [(0, import_CommandClassDecorators.API)(
|
|
78
|
+
let _classDecorators = [(0, import_CommandClassDecorators.API)(import_core.CommandClasses["CRC-16 Encapsulation"])];
|
|
79
79
|
let _classDescriptor;
|
|
80
80
|
let _classExtraInitializers = [];
|
|
81
81
|
let _classThis;
|
|
@@ -110,7 +110,7 @@ let CRC16CCAPI = (() => {
|
|
|
110
110
|
return CRC16CCAPI2 = _classThis;
|
|
111
111
|
})();
|
|
112
112
|
let CRC16CC = (() => {
|
|
113
|
-
let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(
|
|
113
|
+
let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_core.CommandClasses["CRC-16 Encapsulation"]), (0, import_CommandClassDecorators.implementedVersion)(1)];
|
|
114
114
|
let _classDescriptor;
|
|
115
115
|
let _classExtraInitializers = [];
|
|
116
116
|
let _classThis;
|
|
@@ -131,7 +131,7 @@ let CRC16CC = (() => {
|
|
|
131
131
|
}
|
|
132
132
|
/** Tests if a command should be supervised and thus requires encapsulation */
|
|
133
133
|
static requiresEncapsulation(cc) {
|
|
134
|
-
return !!(cc.encapsulationFlags &
|
|
134
|
+
return !!(cc.encapsulationFlags & import_core.EncapsulationFlags.CRC16) && !(cc instanceof CRC16CCCommandEncapsulation);
|
|
135
135
|
}
|
|
136
136
|
/** Encapsulates a command in a CRC-16 CC */
|
|
137
137
|
static encapsulate(cc) {
|
|
@@ -139,7 +139,7 @@ let CRC16CC = (() => {
|
|
|
139
139
|
nodeId: cc.nodeId,
|
|
140
140
|
encapsulated: cc
|
|
141
141
|
});
|
|
142
|
-
ret.encapsulationFlags = cc.encapsulationFlags & ~
|
|
142
|
+
ret.encapsulationFlags = cc.encapsulationFlags & ~import_core.EncapsulationFlags.CRC16;
|
|
143
143
|
return ret;
|
|
144
144
|
}
|
|
145
145
|
};
|
|
@@ -177,12 +177,12 @@ let CRC16CCCommandEncapsulation = (() => {
|
|
|
177
177
|
this.encapsulated.encapsulatingCC = this;
|
|
178
178
|
}
|
|
179
179
|
static async from(raw, ctx) {
|
|
180
|
-
(0,
|
|
180
|
+
(0, import_core.validatePayload)(raw.payload.length >= 3);
|
|
181
181
|
const ccBuffer = raw.payload.subarray(0, -2);
|
|
182
|
-
let expectedCRC = (0,
|
|
183
|
-
expectedCRC = (0,
|
|
182
|
+
let expectedCRC = (0, import_core.CRC16_CCITT)(headerBuffer);
|
|
183
|
+
expectedCRC = (0, import_core.CRC16_CCITT)(ccBuffer, expectedCRC);
|
|
184
184
|
const actualCRC = raw.payload.readUInt16BE(raw.payload.length - 2);
|
|
185
|
-
(0,
|
|
185
|
+
(0, import_core.validatePayload)(expectedCRC === actualCRC);
|
|
186
186
|
const encapsulated = await import_CommandClass.CommandClass.parse(ccBuffer, ctx);
|
|
187
187
|
return new this({
|
|
188
188
|
nodeId: ctx.sourceNodeId,
|
|
@@ -192,9 +192,9 @@ let CRC16CCCommandEncapsulation = (() => {
|
|
|
192
192
|
encapsulated;
|
|
193
193
|
async serialize(ctx) {
|
|
194
194
|
const commandBuffer = await this.encapsulated.serialize(ctx);
|
|
195
|
-
this.payload =
|
|
196
|
-
let crc = (0,
|
|
197
|
-
crc = (0,
|
|
195
|
+
this.payload = import_shared.Bytes.concat([commandBuffer, new import_shared.Bytes(2)]);
|
|
196
|
+
let crc = (0, import_core.CRC16_CCITT)(headerBuffer);
|
|
197
|
+
crc = (0, import_core.CRC16_CCITT)(commandBuffer, crc);
|
|
198
198
|
this.payload.writeUInt16BE(crc, this.payload.length - 2);
|
|
199
199
|
return super.serialize(ctx);
|
|
200
200
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/CRC16CC.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\tCRC16_CCITT,\n\tCommandClasses,\n\tEncapsulationFlags,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\ttype WithAddress,\n\tvalidatePayload,\n} from \"@zwave-js/core
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBASO;AACP,iBAAsB;AACtB,0BAAyC;AACzC,oCAMO;AAGP,
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import {\n\tCRC16_CCITT,\n\tCommandClasses,\n\tEncapsulationFlags,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\ttype WithAddress,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { CCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass } from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n} from \"../lib/CommandClassDecorators.js\";\n\nimport type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport { Bytes } from \"@zwave-js/shared\";\nimport { CRC16Command } from \"../lib/_Types.js\";\n\nconst headerBuffer = Bytes.from([\n\tCommandClasses[\"CRC-16 Encapsulation\"],\n\tCRC16Command.CommandEncapsulation,\n]);\n\n// @noSetValueAPI\n// @noInterview This CC only has a single encapsulation command\n\n// Encapsulation CCs are used internally and too frequently that we\n// want to pay the cost of validating each call\n/* eslint-disable @zwave-js/ccapi-validate-args */\n\n@API(CommandClasses[\"CRC-16 Encapsulation\"])\nexport class CRC16CCAPI extends CCAPI {\n\tpublic supportsCommand(_cmd: CRC16Command): MaybeNotKnown<boolean> {\n\t\t// switch (cmd) {\n\t\t// \tcase CRC16Command.CommandEncapsulation:\n\t\treturn true; // This is mandatory\n\t\t// }\n\t\t// return super.supportsCommand(cmd);\n\t}\n\n\tpublic async sendEncapsulated(encapsulatedCC: CommandClass): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tCRC16Command,\n\t\t\tCRC16Command.CommandEncapsulation,\n\t\t);\n\n\t\tconst cc = new CRC16CCCommandEncapsulation({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tencapsulated: encapsulatedCC,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\n@commandClass(CommandClasses[\"CRC-16 Encapsulation\"])\n@implementedVersion(1)\nexport class CRC16CC extends CommandClass {\n\tdeclare ccCommand: CRC16Command;\n\n\t/** Tests if a command should be supervised and thus requires encapsulation */\n\tpublic static requiresEncapsulation(cc: CommandClass): boolean {\n\t\treturn (\n\t\t\t!!(cc.encapsulationFlags & EncapsulationFlags.CRC16)\n\t\t\t&& !(cc instanceof CRC16CCCommandEncapsulation)\n\t\t);\n\t}\n\n\t/** Encapsulates a command in a CRC-16 CC */\n\tpublic static encapsulate(\n\t\tcc: CommandClass,\n\t): CRC16CCCommandEncapsulation {\n\t\tconst ret = new CRC16CCCommandEncapsulation({\n\t\t\tnodeId: cc.nodeId,\n\t\t\tencapsulated: cc,\n\t\t});\n\n\t\t// Copy the encapsulation flags from the encapsulated command\n\t\t// but omit CRC-16, since we're doing that right now\n\t\tret.encapsulationFlags = cc.encapsulationFlags\n\t\t\t& ~EncapsulationFlags.CRC16;\n\n\t\treturn ret;\n\t}\n}\n\n// @publicAPI\nexport interface CRC16CCCommandEncapsulationOptions {\n\tencapsulated: CommandClass;\n}\n\nfunction getCCResponseForCommandEncapsulation(\n\tsent: CRC16CCCommandEncapsulation,\n) {\n\tif (sent.encapsulated?.expectsCCResponse()) {\n\t\treturn CRC16CCCommandEncapsulation;\n\t}\n}\n\n@CCCommand(CRC16Command.CommandEncapsulation)\n@expectedCCResponse(\n\tgetCCResponseForCommandEncapsulation,\n\t() => \"checkEncapsulated\",\n)\nexport class CRC16CCCommandEncapsulation extends CRC16CC {\n\tpublic constructor(\n\t\toptions: WithAddress<CRC16CCCommandEncapsulationOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.encapsulated = options.encapsulated;\n\t\tthis.encapsulated.encapsulatingCC = this as any;\n\t}\n\n\tpublic static async from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): Promise<CRC16CCCommandEncapsulation> {\n\t\tvalidatePayload(raw.payload.length >= 3);\n\n\t\tconst ccBuffer = raw.payload.subarray(0, -2);\n\n\t\t// Verify the CRC\n\t\tlet expectedCRC = CRC16_CCITT(headerBuffer);\n\t\texpectedCRC = CRC16_CCITT(ccBuffer, expectedCRC);\n\t\tconst actualCRC = raw.payload.readUInt16BE(\n\t\t\traw.payload.length - 2,\n\t\t);\n\t\tvalidatePayload(expectedCRC === actualCRC);\n\n\t\tconst encapsulated = await CommandClass.parse(ccBuffer, ctx);\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tencapsulated,\n\t\t});\n\t}\n\n\tpublic encapsulated: CommandClass;\n\n\tpublic async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst commandBuffer = await this.encapsulated.serialize(ctx);\n\t\t// Reserve 2 bytes for the CRC\n\t\tthis.payload = Bytes.concat([commandBuffer, new Bytes(2)]);\n\n\t\t// Compute and save the CRC16 in the payload\n\t\t// The CC header is included in the CRC computation\n\t\tlet crc = CRC16_CCITT(headerBuffer);\n\t\tcrc = CRC16_CCITT(commandBuffer, crc);\n\t\tthis.payload.writeUInt16BE(crc, this.payload.length - 2);\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tprotected computeEncapsulationOverhead(): number {\n\t\t// CRC16 adds two bytes CRC to the default overhead\n\t\treturn super.computeEncapsulationOverhead() + 2;\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\t// Hide the default payload line\n\t\t\tmessage: undefined,\n\t\t};\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBASO;AACP,iBAAsB;AACtB,0BAAyC;AACzC,oCAMO;AAGP,oBAAsB;AACtB,mBAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAM,eAAe,oBAAM,KAAK;EAC/B,2BAAe,sBAAsB;EACrC,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|
-
import {
|
|
2
|
-
import { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type SupervisionResult, type WithAddress } from "@zwave-js/core
|
|
3
|
-
import { Bytes } from "@zwave-js/shared
|
|
1
|
+
import type { CCEncodingContext, CCParsingContext } from "@zwave-js/cc";
|
|
2
|
+
import { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type SupervisionResult, type WithAddress } from "@zwave-js/core";
|
|
3
|
+
import { Bytes } from "@zwave-js/shared";
|
|
4
4
|
import { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation } from "../lib/API.js";
|
|
5
5
|
import { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext } from "../lib/CommandClass.js";
|
|
6
6
|
import { CentralSceneCommand, CentralSceneKeys } from "../lib/_Types.js";
|
|
@@ -15,7 +15,7 @@ export declare const CentralSceneCCValues: Readonly<{
|
|
|
15
15
|
readonly endpoint: number;
|
|
16
16
|
readonly property: "sceneCount";
|
|
17
17
|
};
|
|
18
|
-
is: (valueId: import("@zwave-js/core
|
|
18
|
+
is: (valueId: import("@zwave-js/core").ValueID) => boolean;
|
|
19
19
|
readonly meta: Readonly<{
|
|
20
20
|
readonly type: "any";
|
|
21
21
|
readonly readable: true;
|
|
@@ -40,7 +40,7 @@ export declare const CentralSceneCCValues: Readonly<{
|
|
|
40
40
|
readonly endpoint: number;
|
|
41
41
|
readonly property: "supportsSlowRefresh";
|
|
42
42
|
};
|
|
43
|
-
is: (valueId: import("@zwave-js/core
|
|
43
|
+
is: (valueId: import("@zwave-js/core").ValueID) => boolean;
|
|
44
44
|
readonly meta: Readonly<{
|
|
45
45
|
readonly type: "any";
|
|
46
46
|
readonly readable: true;
|
|
@@ -65,7 +65,7 @@ export declare const CentralSceneCCValues: Readonly<{
|
|
|
65
65
|
readonly endpoint: number;
|
|
66
66
|
readonly property: "supportedKeyAttributes";
|
|
67
67
|
};
|
|
68
|
-
is: (valueId: import("@zwave-js/core
|
|
68
|
+
is: (valueId: import("@zwave-js/core").ValueID) => boolean;
|
|
69
69
|
readonly meta: Readonly<{
|
|
70
70
|
readonly type: "any";
|
|
71
71
|
readonly readable: true;
|
|
@@ -90,7 +90,7 @@ export declare const CentralSceneCCValues: Readonly<{
|
|
|
90
90
|
readonly endpoint: number;
|
|
91
91
|
readonly property: "slowRefresh";
|
|
92
92
|
};
|
|
93
|
-
is: (valueId: import("@zwave-js/core
|
|
93
|
+
is: (valueId: import("@zwave-js/core").ValueID) => boolean;
|
|
94
94
|
readonly meta: {
|
|
95
95
|
readonly label: "Send held down notifications at a slow rate";
|
|
96
96
|
readonly description: "When this is true, KeyHeldDown notifications are sent every 55s. When this is false, the notifications are sent every 200ms.";
|
|
@@ -128,7 +128,7 @@ export declare const CentralSceneCCValues: Readonly<{
|
|
|
128
128
|
readonly readable: true;
|
|
129
129
|
};
|
|
130
130
|
}) & {
|
|
131
|
-
is: (valueId: import("@zwave-js/core
|
|
131
|
+
is: (valueId: import("@zwave-js/core").ValueID) => boolean;
|
|
132
132
|
options: {
|
|
133
133
|
readonly internal: false;
|
|
134
134
|
readonly minVersion: 1;
|
|
@@ -41,9 +41,8 @@ __export(CentralSceneCC_exports, {
|
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(CentralSceneCC_exports);
|
|
43
43
|
var __validateArgs = __toESM(require("./CentralSceneCC._validateArgs.js"), 1);
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var import_safe3 = require("@zwave-js/shared/safe");
|
|
44
|
+
var import_core = require("@zwave-js/core");
|
|
45
|
+
var import_shared = require("@zwave-js/shared");
|
|
47
46
|
var import_API = require("../lib/API.js");
|
|
48
47
|
var import_CommandClass = require("../lib/CommandClass.js");
|
|
49
48
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|
|
@@ -93,7 +92,7 @@ var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializ
|
|
|
93
92
|
};
|
|
94
93
|
const { validateArgs_CentralSceneCCAPI_setConfiguration } = __validateArgs;
|
|
95
94
|
let CentralSceneCCAPI = (() => {
|
|
96
|
-
let _classDecorators = [(0, import_CommandClassDecorators.API)(
|
|
95
|
+
let _classDecorators = [(0, import_CommandClassDecorators.API)(import_core.CommandClasses["Central Scene"])];
|
|
97
96
|
let _classDescriptor;
|
|
98
97
|
let _classExtraInitializers = [];
|
|
99
98
|
let _classThis;
|
|
@@ -136,7 +135,7 @@ let CentralSceneCCAPI = (() => {
|
|
|
136
135
|
});
|
|
137
136
|
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
138
137
|
if (response) {
|
|
139
|
-
return (0,
|
|
138
|
+
return (0, import_shared.pick)(response, [
|
|
140
139
|
"sceneCount",
|
|
141
140
|
"supportsSlowRefresh",
|
|
142
141
|
"supportedKeyAttributes"
|
|
@@ -152,7 +151,7 @@ let CentralSceneCCAPI = (() => {
|
|
|
152
151
|
});
|
|
153
152
|
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
154
153
|
if (response) {
|
|
155
|
-
return (0,
|
|
154
|
+
return (0, import_shared.pick)(response, ["slowRefresh"]);
|
|
156
155
|
}
|
|
157
156
|
}
|
|
158
157
|
async setConfiguration(slowRefresh) {
|
|
@@ -191,7 +190,7 @@ let CentralSceneCCAPI = (() => {
|
|
|
191
190
|
return CentralSceneCCAPI2 = _classThis;
|
|
192
191
|
})();
|
|
193
192
|
let CentralSceneCC = (() => {
|
|
194
|
-
let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(
|
|
193
|
+
let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_core.CommandClasses["Central Scene"]), (0, import_CommandClassDecorators.implementedVersion)(3), (0, import_CommandClassDecorators.ccValues)(import_CCValues_generated.CentralSceneCCValues)];
|
|
195
194
|
let _classDescriptor;
|
|
196
195
|
let _classExtraInitializers = [];
|
|
197
196
|
let _classThis;
|
|
@@ -213,9 +212,9 @@ let CentralSceneCC = (() => {
|
|
|
213
212
|
determineRequiredCCInterviews() {
|
|
214
213
|
return [
|
|
215
214
|
...super.determineRequiredCCInterviews(),
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
import_core.CommandClasses.Association,
|
|
216
|
+
import_core.CommandClasses["Multi Channel Association"],
|
|
217
|
+
import_core.CommandClasses["Association Group Information"]
|
|
219
218
|
];
|
|
220
219
|
}
|
|
221
220
|
skipEndpointInterview() {
|
|
@@ -224,8 +223,8 @@ let CentralSceneCC = (() => {
|
|
|
224
223
|
async interview(ctx) {
|
|
225
224
|
const node = this.getNode(ctx);
|
|
226
225
|
const endpoint = this.getEndpoint(ctx);
|
|
227
|
-
const api = import_API.CCAPI.create(
|
|
228
|
-
priority:
|
|
226
|
+
const api = import_API.CCAPI.create(import_core.CommandClasses["Central Scene"], ctx, endpoint).withOptions({
|
|
227
|
+
priority: import_core.MessagePriority.NodeQuery
|
|
229
228
|
});
|
|
230
229
|
ctx.logNode(node.id, {
|
|
231
230
|
endpoint: this.endpointIndex,
|
|
@@ -237,7 +236,7 @@ let CentralSceneCC = (() => {
|
|
|
237
236
|
} catch {
|
|
238
237
|
ctx.logNode(node.id, {
|
|
239
238
|
endpoint: endpoint.index,
|
|
240
|
-
message: `Configuring associations to receive ${(0,
|
|
239
|
+
message: `Configuring associations to receive ${(0, import_core.getCCName)(this.ccId)} commands failed!`,
|
|
241
240
|
level: "warn"
|
|
242
241
|
});
|
|
243
242
|
}
|
|
@@ -305,7 +304,7 @@ let CentralSceneCCNotification = (() => {
|
|
|
305
304
|
this.slowRefresh = options.slowRefresh;
|
|
306
305
|
}
|
|
307
306
|
static from(raw, ctx) {
|
|
308
|
-
(0,
|
|
307
|
+
(0, import_core.validatePayload)(raw.payload.length >= 3);
|
|
309
308
|
const sequenceNumber = raw.payload[0];
|
|
310
309
|
const keyAttribute = raw.payload[1] & 7;
|
|
311
310
|
const sceneNumber = raw.payload[2];
|
|
@@ -335,7 +334,7 @@ let CentralSceneCCNotification = (() => {
|
|
|
335
334
|
toLogEntry(ctx) {
|
|
336
335
|
const message = {
|
|
337
336
|
"sequence number": this.sequenceNumber,
|
|
338
|
-
"key attribute": (0,
|
|
337
|
+
"key attribute": (0, import_shared.getEnumMemberName)(import_Types.CentralSceneKeys, this.keyAttribute),
|
|
339
338
|
"scene number": this.sceneNumber
|
|
340
339
|
};
|
|
341
340
|
if (this.slowRefresh != void 0) {
|
|
@@ -378,17 +377,17 @@ let CentralSceneCCSupportedReport = (() => {
|
|
|
378
377
|
}
|
|
379
378
|
}
|
|
380
379
|
static from(raw, ctx) {
|
|
381
|
-
(0,
|
|
380
|
+
(0, import_core.validatePayload)(raw.payload.length >= 2);
|
|
382
381
|
const sceneCount = raw.payload[0];
|
|
383
382
|
const supportsSlowRefresh = !!(raw.payload[1] & 128);
|
|
384
383
|
const bitMaskBytes = (raw.payload[1] & 6) >>> 1;
|
|
385
384
|
const identicalKeyAttributes = !!(raw.payload[1] & 1);
|
|
386
385
|
const numEntries = identicalKeyAttributes ? 1 : sceneCount;
|
|
387
|
-
(0,
|
|
386
|
+
(0, import_core.validatePayload)(raw.payload.length >= 2 + bitMaskBytes * numEntries);
|
|
388
387
|
const supportedKeyAttributes = {};
|
|
389
388
|
for (let i = 0; i < numEntries; i++) {
|
|
390
389
|
const mask = raw.payload.subarray(2 + i * bitMaskBytes, 2 + (i + 1) * bitMaskBytes);
|
|
391
|
-
supportedKeyAttributes[i + 1] = (0,
|
|
390
|
+
supportedKeyAttributes[i + 1] = (0, import_core.parseBitMask)(mask, import_Types.CentralSceneKeys.KeyPressed);
|
|
392
391
|
}
|
|
393
392
|
if (identicalKeyAttributes) {
|
|
394
393
|
for (let i = 2; i <= sceneCount; i++) {
|
|
@@ -409,7 +408,7 @@ let CentralSceneCCSupportedReport = (() => {
|
|
|
409
408
|
const sceneValue = import_CCValues_generated.CentralSceneCCValues.scene(i);
|
|
410
409
|
this.setMetadata(ctx, sceneValue, {
|
|
411
410
|
...sceneValue.meta,
|
|
412
|
-
states: (0,
|
|
411
|
+
states: (0, import_core.enumValuesToMetadataStates)(import_Types.CentralSceneKeys, this._supportedKeyAttributes.get(i))
|
|
413
412
|
});
|
|
414
413
|
}
|
|
415
414
|
return true;
|
|
@@ -424,11 +423,11 @@ let CentralSceneCCSupportedReport = (() => {
|
|
|
424
423
|
toLogEntry(ctx) {
|
|
425
424
|
const message = {
|
|
426
425
|
"scene count": this.sceneCount,
|
|
427
|
-
"supports slow refresh": (0,
|
|
426
|
+
"supports slow refresh": (0, import_core.maybeUnknownToString)(this.supportsSlowRefresh)
|
|
428
427
|
};
|
|
429
428
|
for (const [scene, keys] of this.supportedKeyAttributes) {
|
|
430
429
|
message[`supported attributes (scene #${scene})`] = keys.map((k) => `
|
|
431
|
-
\xB7 ${(0,
|
|
430
|
+
\xB7 ${(0, import_shared.getEnumMemberName)(import_Types.CentralSceneKeys, k)}`).join("");
|
|
432
431
|
}
|
|
433
432
|
return {
|
|
434
433
|
...super.toLogEntry(ctx),
|
|
@@ -486,7 +485,7 @@ let CentralSceneCCConfigurationReport = (() => {
|
|
|
486
485
|
this.slowRefresh = options.slowRefresh;
|
|
487
486
|
}
|
|
488
487
|
static from(raw, ctx) {
|
|
489
|
-
(0,
|
|
488
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
490
489
|
const slowRefresh = !!(raw.payload[0] & 128);
|
|
491
490
|
return new this({
|
|
492
491
|
nodeId: ctx.sourceNodeId,
|
|
@@ -551,11 +550,11 @@ let CentralSceneCCConfigurationSet = (() => {
|
|
|
551
550
|
this.slowRefresh = options.slowRefresh;
|
|
552
551
|
}
|
|
553
552
|
static from(_raw, _ctx) {
|
|
554
|
-
throw new
|
|
553
|
+
throw new import_core.ZWaveError(`${this.name}: deserialization not implemented`, import_core.ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
555
554
|
}
|
|
556
555
|
slowRefresh;
|
|
557
556
|
serialize(ctx) {
|
|
558
|
-
this.payload =
|
|
557
|
+
this.payload = import_shared.Bytes.from([this.slowRefresh ? 128 : 0]);
|
|
559
558
|
return super.serialize(ctx);
|
|
560
559
|
}
|
|
561
560
|
toLogEntry(ctx) {
|