@zwave-js/cc 14.0.0-beta.4 → 14.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/cc/AlarmSensorCC.js +381 -266
- package/build/cjs/cc/AlarmSensorCC.js.map +3 -3
- package/build/cjs/cc/AssociationCC.js +669 -503
- package/build/cjs/cc/AssociationCC.js.map +3 -3
- package/build/cjs/cc/AssociationGroupInfoCC.js +633 -492
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +3 -3
- package/build/cjs/cc/BarrierOperatorCC.js +595 -429
- package/build/cjs/cc/BarrierOperatorCC.js.map +3 -3
- package/build/cjs/cc/BasicCC.js +354 -260
- package/build/cjs/cc/BasicCC.js.map +3 -3
- package/build/cjs/cc/BatteryCC.js +427 -345
- package/build/cjs/cc/BatteryCC.js.map +3 -3
- package/build/cjs/cc/BinarySensorCC.js +391 -276
- package/build/cjs/cc/BinarySensorCC.js.map +3 -3
- package/build/cjs/cc/BinarySwitchCC.js +347 -253
- package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
- package/build/cjs/cc/CRC16CC.js +160 -85
- package/build/cjs/cc/CRC16CC.js.map +3 -3
- package/build/cjs/cc/CentralSceneCC.js +459 -324
- package/build/cjs/cc/CentralSceneCC.js.map +3 -3
- package/build/cjs/cc/ClimateControlScheduleCC.js +459 -293
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +3 -3
- package/build/cjs/cc/ClockCC.js +254 -150
- package/build/cjs/cc/ClockCC.js.map +3 -3
- package/build/cjs/cc/ColorSwitchCC.js +758 -610
- package/build/cjs/cc/ColorSwitchCC.js.map +3 -3
- package/build/cjs/cc/ConfigurationCC.js +1700 -1453
- package/build/cjs/cc/ConfigurationCC.js.map +3 -3
- package/build/cjs/cc/DeviceResetLocallyCC.js +125 -49
- package/build/cjs/cc/DeviceResetLocallyCC.js.map +3 -3
- package/build/cjs/cc/DoorLockCC.js +904 -777
- package/build/cjs/cc/DoorLockCC.js.map +3 -3
- package/build/cjs/cc/DoorLockLoggingCC.js +321 -206
- package/build/cjs/cc/DoorLockLoggingCC.js.map +3 -3
- package/build/cjs/cc/EnergyProductionCC.js +249 -160
- package/build/cjs/cc/EnergyProductionCC.js.map +3 -3
- package/build/cjs/cc/EntryControlCC.js +619 -458
- package/build/cjs/cc/EntryControlCC.js.map +3 -3
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +898 -698
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +3 -3
- package/build/cjs/cc/HailCC.js +57 -11
- package/build/cjs/cc/HailCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlModeCC.js +359 -233
- package/build/cjs/cc/HumidityControlModeCC.js.map +3 -3
- package/build/cjs/cc/HumidityControlOperatingStateCC.js +189 -103
- package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +3 -3
- package/build/cjs/cc/HumidityControlSetpointCC.js +682 -495
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +3 -3
- package/build/cjs/cc/InclusionControllerCC.js +205 -114
- package/build/cjs/cc/InclusionControllerCC.js.map +3 -3
- package/build/cjs/cc/IndicatorCC.js +897 -736
- package/build/cjs/cc/IndicatorCC.js.map +3 -3
- package/build/cjs/cc/IrrigationCC.js +1651 -1405
- package/build/cjs/cc/IrrigationCC.js.map +3 -3
- package/build/cjs/cc/LanguageCC.js +268 -171
- package/build/cjs/cc/LanguageCC.js.map +3 -3
- package/build/cjs/cc/LockCC.js +254 -154
- package/build/cjs/cc/LockCC.js.map +3 -3
- package/build/cjs/cc/ManufacturerProprietaryCC.js +189 -129
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.js +319 -213
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +3 -3
- package/build/cjs/cc/MeterCC.js +827 -707
- package/build/cjs/cc/MeterCC.js.map +3 -3
- package/build/cjs/cc/MultiChannelAssociationCC.js +612 -478
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +3 -3
- package/build/cjs/cc/MultiChannelCC.js +1037 -819
- package/build/cjs/cc/MultiChannelCC.js.map +3 -3
- package/build/cjs/cc/MultiCommandCC.js +172 -97
- package/build/cjs/cc/MultiCommandCC.js.map +3 -3
- package/build/cjs/cc/MultilevelSensorCC.js +589 -449
- package/build/cjs/cc/MultilevelSensorCC.js.map +3 -3
- package/build/cjs/cc/MultilevelSwitchCC.js +587 -439
- package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
- package/build/cjs/cc/NoOperationCC.js +89 -27
- package/build/cjs/cc/NoOperationCC.js.map +2 -2
- package/build/cjs/cc/NodeNamingCC.js +417 -277
- package/build/cjs/cc/NodeNamingCC.js.map +3 -3
- package/build/cjs/cc/NotificationCC.js +972 -818
- package/build/cjs/cc/NotificationCC.js.map +3 -3
- package/build/cjs/cc/PowerlevelCC.js +450 -303
- package/build/cjs/cc/PowerlevelCC.js.map +3 -3
- package/build/cjs/cc/ProtectionCC.js +686 -494
- package/build/cjs/cc/ProtectionCC.js.map +3 -3
- package/build/cjs/cc/SceneActivationCC.js +165 -97
- package/build/cjs/cc/SceneActivationCC.js.map +3 -3
- package/build/cjs/cc/SceneActuatorConfigurationCC.js +346 -243
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +3 -3
- package/build/cjs/cc/SceneControllerConfigurationCC.js +401 -298
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +3 -3
- package/build/cjs/cc/ScheduleEntryLockCC.js +1552 -1272
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +3 -3
- package/build/cjs/cc/Security2CC.js +1483 -1219
- package/build/cjs/cc/Security2CC.js.map +3 -3
- package/build/cjs/cc/SecurityCC.js +839 -619
- package/build/cjs/cc/SecurityCC.js.map +3 -3
- package/build/cjs/cc/SoundSwitchCC.js +707 -515
- package/build/cjs/cc/SoundSwitchCC.js.map +3 -3
- package/build/cjs/cc/SupervisionCC.js +327 -237
- package/build/cjs/cc/SupervisionCC.js.map +3 -3
- package/build/cjs/cc/ThermostatFanModeCC.js +386 -263
- package/build/cjs/cc/ThermostatFanModeCC.js.map +3 -3
- package/build/cjs/cc/ThermostatFanStateCC.js +192 -106
- package/build/cjs/cc/ThermostatFanStateCC.js.map +3 -3
- package/build/cjs/cc/ThermostatModeCC.js +425 -302
- package/build/cjs/cc/ThermostatModeCC.js.map +3 -3
- package/build/cjs/cc/ThermostatOperatingStateCC.js +188 -102
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +3 -3
- package/build/cjs/cc/ThermostatSetbackCC.js +277 -173
- package/build/cjs/cc/ThermostatSetbackCC.js.map +3 -3
- package/build/cjs/cc/ThermostatSetpointCC.js +645 -491
- package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
- package/build/cjs/cc/TimeCC.js +515 -353
- package/build/cjs/cc/TimeCC.js.map +3 -3
- package/build/cjs/cc/TimeParametersCC.js +302 -202
- package/build/cjs/cc/TimeParametersCC.js.map +3 -3
- package/build/cjs/cc/TransportServiceCC.js +433 -315
- package/build/cjs/cc/TransportServiceCC.js.map +3 -3
- package/build/cjs/cc/UserCodeCC.js +1385 -1102
- package/build/cjs/cc/UserCodeCC.js.map +3 -3
- package/build/cjs/cc/VersionCC.js +696 -562
- package/build/cjs/cc/VersionCC.js.map +3 -3
- package/build/cjs/cc/WakeUpCC.js +499 -346
- package/build/cjs/cc/WakeUpCC.js.map +3 -3
- package/build/cjs/cc/WindowCoveringCC.js +626 -478
- package/build/cjs/cc/WindowCoveringCC.js.map +3 -3
- package/build/cjs/cc/ZWaveLongRangeCC.js +57 -10
- package/build/cjs/cc/ZWaveLongRangeCC.js.map +2 -2
- package/build/cjs/cc/ZWavePlusCC.js +233 -159
- package/build/cjs/cc/ZWavePlusCC.js.map +3 -3
- package/build/cjs/cc/ZWaveProtocolCC.js +1515 -948
- package/build/cjs/cc/ZWaveProtocolCC.js.map +3 -3
- package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +4 -4
- package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +1 -1
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +395 -274
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +3 -3
- package/build/cjs/lib/CommandClassDecorators.d.ts +11 -15
- package/build/cjs/lib/CommandClassDecorators.js +19 -20
- package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
- package/build/cjs/lib/Security2/Extension.d.ts +1 -1
- package/build/cjs/lib/Security2/Extension.js +217 -126
- package/build/cjs/lib/Security2/Extension.js.map +3 -3
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +389 -291
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/AssociationCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC.js +678 -537
- package/build/esm/cc/AssociationCC.js.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +659 -539
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +634 -493
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.d.ts.map +1 -1
- package/build/esm/cc/BasicCC.js +380 -302
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +449 -384
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySensorCC.js +395 -297
- package/build/esm/cc/BinarySensorCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +353 -274
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CRC16CC.js +162 -98
- package/build/esm/cc/CRC16CC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +465 -351
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +454 -313
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.js +248 -159
- package/build/esm/cc/ClockCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +802 -677
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +1899 -1687
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.js +124 -59
- package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC.js +951 -849
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.js +316 -218
- package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/esm/cc/EnergyProductionCC.js +240 -164
- package/build/esm/cc/EnergyProductionCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +629 -493
- package/build/esm/cc/EntryControlCC.js.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js +938 -769
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/esm/cc/HailCC.js +51 -12
- package/build/esm/cc/HailCC.js.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.js +357 -250
- package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.js +182 -109
- package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +706 -546
- package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/esm/cc/InclusionControllerCC.js +197 -119
- package/build/esm/cc/InclusionControllerCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.js +973 -835
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +1697 -1496
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC.js +266 -184
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/LockCC.d.ts.map +1 -1
- package/build/esm/cc/LockCC.js +247 -162
- package/build/esm/cc/LockCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js +192 -141
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +312 -223
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +896 -795
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.js +631 -518
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +1106 -921
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultiCommandCC.js +166 -102
- package/build/esm/cc/MultiCommandCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +616 -497
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +621 -496
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NoOperationCC.js +82 -29
- package/build/esm/cc/NoOperationCC.js.map +1 -1
- package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC.js +413 -294
- package/build/esm/cc/NodeNamingCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +1097 -966
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/PowerlevelCC.js +437 -311
- package/build/esm/cc/PowerlevelCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +704 -543
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActivationCC.js +157 -100
- package/build/esm/cc/SceneActivationCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +357 -269
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +434 -346
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js +1596 -1357
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.js +1633 -1406
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.js +876 -687
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +689 -526
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.js +349 -272
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +388 -284
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js +184 -111
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +435 -331
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.js +180 -107
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js +274 -185
- package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +674 -543
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TimeCC.js +499 -360
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
- package/build/esm/cc/TimeParametersCC.js +296 -211
- package/build/esm/cc/TimeParametersCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +464 -363
- package/build/esm/cc/TransportServiceCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +1443 -1205
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +744 -635
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
- package/build/esm/cc/WakeUpCC.js +494 -364
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +655 -530
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWaveLongRangeCC.js +51 -11
- package/build/esm/cc/ZWaveLongRangeCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +223 -162
- package/build/esm/cc/ZWavePlusCC.js.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js +1443 -953
- package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +4 -4
- package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +390 -286
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/lib/CommandClassDecorators.d.ts +11 -15
- package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
- package/build/esm/lib/CommandClassDecorators.js +24 -24
- package/build/esm/lib/CommandClassDecorators.js.map +1 -1
- package/build/esm/lib/Security2/Extension.d.ts +1 -1
- package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
- package/build/esm/lib/Security2/Extension.js +207 -123
- package/build/esm/lib/Security2/Extension.js.map +1 -1
- package/package.json +6 -6
|
@@ -41,13 +41,45 @@ var import_CommandClass = require("../lib/CommandClass.js");
|
|
|
41
41
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|
|
42
42
|
var import_Values = require("../lib/Values.js");
|
|
43
43
|
var import_Types = require("../lib/_Types.js");
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
45
|
+
function accept(f) {
|
|
46
|
+
if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
|
|
47
|
+
return f;
|
|
48
|
+
}
|
|
49
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
50
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
51
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
52
|
+
var _, done = false;
|
|
53
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
54
|
+
var context = {};
|
|
55
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
56
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
57
|
+
context.addInitializer = function(f) {
|
|
58
|
+
if (done) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
59
|
+
extraInitializers.push(accept(f || null));
|
|
60
|
+
};
|
|
61
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
62
|
+
if (kind === "accessor") {
|
|
63
|
+
if (result === void 0) continue;
|
|
64
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
65
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
66
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
67
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
68
|
+
} else if (_ = accept(result)) {
|
|
69
|
+
if (kind === "field") initializers.unshift(_);
|
|
70
|
+
else descriptor[key] = _;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
74
|
+
done = true;
|
|
75
|
+
};
|
|
76
|
+
var __runInitializers = function(thisArg, initializers, value) {
|
|
77
|
+
var useValue = arguments.length > 2;
|
|
78
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
79
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
80
|
+
}
|
|
81
|
+
return useValue ? value : void 0;
|
|
49
82
|
};
|
|
50
|
-
var ColorSwitchCCSupportedReport_1, ColorSwitchCCReport_1, ColorSwitchCCGet_1, ColorSwitchCCSet_1, ColorSwitchCCStartLevelChange_1, ColorSwitchCCStopLevelChange_1;
|
|
51
83
|
function __assertType(argName, typeName, boundHasError) {
|
|
52
84
|
const { ZWaveError: ZWaveError2, ZWaveErrorCodes: ZWaveErrorCodes2 } = require("@zwave-js/core");
|
|
53
85
|
if (boundHasError()) {
|
|
@@ -456,651 +488,767 @@ const ColorSwitchCCValues = Object.freeze({
|
|
|
456
488
|
})
|
|
457
489
|
})
|
|
458
490
|
});
|
|
459
|
-
let ColorSwitchCCAPI =
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
return true;
|
|
469
|
-
}
|
|
470
|
-
return super.supportsCommand(cmd);
|
|
471
|
-
}
|
|
472
|
-
async getSupported() {
|
|
473
|
-
this.assertSupportsCommand(import_Types.ColorSwitchCommand, import_Types.ColorSwitchCommand.SupportedGet);
|
|
474
|
-
const cc = new ColorSwitchCCSupportedGet({
|
|
475
|
-
nodeId: this.endpoint.nodeId,
|
|
476
|
-
endpointIndex: this.endpoint.index
|
|
477
|
-
});
|
|
478
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
479
|
-
return response?.supportedColorComponents;
|
|
480
|
-
}
|
|
481
|
-
async get(component) {
|
|
482
|
-
__assertType("component", "ColorComponent", __assertType__ColorComponent.bind(void 0, component));
|
|
483
|
-
this.assertSupportsCommand(import_Types.ColorSwitchCommand, import_Types.ColorSwitchCommand.Get);
|
|
484
|
-
const cc = new ColorSwitchCCGet({
|
|
485
|
-
nodeId: this.endpoint.nodeId,
|
|
486
|
-
endpointIndex: this.endpoint.index,
|
|
487
|
-
colorComponent: component
|
|
488
|
-
});
|
|
489
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
490
|
-
if (response) {
|
|
491
|
-
return (0, import_safe3.pick)(response, ["currentValue", "targetValue", "duration"]);
|
|
491
|
+
let ColorSwitchCCAPI = (() => {
|
|
492
|
+
let _classDecorators = [(0, import_CommandClassDecorators.API)(import_core.CommandClasses["Color Switch"])];
|
|
493
|
+
let _classDescriptor;
|
|
494
|
+
let _classExtraInitializers = [];
|
|
495
|
+
let _classThis;
|
|
496
|
+
let _classSuper = import_API.CCAPI;
|
|
497
|
+
var ColorSwitchCCAPI2 = class extends _classSuper {
|
|
498
|
+
static {
|
|
499
|
+
_classThis = this;
|
|
492
500
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
501
|
+
static {
|
|
502
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
503
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
504
|
+
ColorSwitchCCAPI2 = _classThis = _classDescriptor.value;
|
|
505
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
506
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
507
|
+
}
|
|
508
|
+
supportsCommand(cmd) {
|
|
509
|
+
switch (cmd) {
|
|
510
|
+
case import_Types.ColorSwitchCommand.SupportedGet:
|
|
511
|
+
case import_Types.ColorSwitchCommand.Get:
|
|
512
|
+
return this.isSinglecast();
|
|
513
|
+
case import_Types.ColorSwitchCommand.Set:
|
|
514
|
+
case import_Types.ColorSwitchCommand.StartLevelChange:
|
|
515
|
+
case import_Types.ColorSwitchCommand.StopLevelChange:
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
518
|
+
return super.supportsCommand(cmd);
|
|
519
|
+
}
|
|
520
|
+
async getSupported() {
|
|
521
|
+
this.assertSupportsCommand(import_Types.ColorSwitchCommand, import_Types.ColorSwitchCommand.SupportedGet);
|
|
522
|
+
const cc = new ColorSwitchCCSupportedGet({
|
|
523
|
+
nodeId: this.endpoint.nodeId,
|
|
524
|
+
endpointIndex: this.endpoint.index
|
|
525
|
+
});
|
|
526
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
527
|
+
return response?.supportedColorComponents;
|
|
528
|
+
}
|
|
529
|
+
async get(component) {
|
|
530
|
+
__assertType("component", "ColorComponent", __assertType__ColorComponent.bind(void 0, component));
|
|
531
|
+
this.assertSupportsCommand(import_Types.ColorSwitchCommand, import_Types.ColorSwitchCommand.Get);
|
|
532
|
+
const cc = new ColorSwitchCCGet({
|
|
533
|
+
nodeId: this.endpoint.nodeId,
|
|
534
|
+
endpointIndex: this.endpoint.index,
|
|
535
|
+
colorComponent: component
|
|
536
|
+
});
|
|
537
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
538
|
+
if (response) {
|
|
539
|
+
return (0, import_safe3.pick)(response, ["currentValue", "targetValue", "duration"]);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
async set(options) {
|
|
543
|
+
__assertType("options", "ColorSwitchCCSetOptions", __assertType__ColorSwitchCCSetOptions.bind(void 0, options));
|
|
544
|
+
this.assertSupportsCommand(import_Types.ColorSwitchCommand, import_Types.ColorSwitchCommand.Set);
|
|
545
|
+
const cc = new ColorSwitchCCSet({
|
|
546
|
+
nodeId: this.endpoint.nodeId,
|
|
547
|
+
endpointIndex: this.endpoint.index,
|
|
548
|
+
...options
|
|
549
|
+
});
|
|
550
|
+
const result = await this.host.sendCommand(cc, this.commandOptions);
|
|
551
|
+
if ((0, import_core.isUnsupervisedOrSucceeded)(result)) {
|
|
552
|
+
if (this.isSinglecast()) {
|
|
553
|
+
this.updateCurrentColor(this.getValueDB(), cc.colorTable);
|
|
554
|
+
} else if (this.isMulticast()) {
|
|
555
|
+
const affectedNodes = this.endpoint.node.physicalNodes.filter((node) => node.getEndpoint(this.endpoint.index)?.supportsCC(this.ccId));
|
|
556
|
+
for (const node of affectedNodes) {
|
|
557
|
+
const valueDB = this.host.tryGetValueDB(node.id);
|
|
558
|
+
if (valueDB) {
|
|
559
|
+
this.updateCurrentColor(valueDB, cc.colorTable);
|
|
560
|
+
}
|
|
512
561
|
}
|
|
513
562
|
}
|
|
514
563
|
}
|
|
564
|
+
return result;
|
|
515
565
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
566
|
+
/** Updates the current color for a given node by merging in the given changes */
|
|
567
|
+
updateCurrentColor(valueDB, colorTable) {
|
|
568
|
+
let updatedRGB = false;
|
|
569
|
+
const currentColorValueId = ColorSwitchCCValues.currentColor.endpoint(this.endpoint.index);
|
|
570
|
+
const targetColorValueId = ColorSwitchCCValues.targetColor.endpoint(this.endpoint.index);
|
|
571
|
+
const currentCompoundColor = valueDB.getValue(currentColorValueId) ?? {};
|
|
572
|
+
const targetCompoundColor = valueDB.getValue(targetColorValueId) ?? {};
|
|
573
|
+
for (const [key, value] of Object.entries(colorTable)) {
|
|
574
|
+
const component = colorTableKeyToComponent(key);
|
|
575
|
+
if (component === import_Types.ColorComponent.Red || component === import_Types.ColorComponent.Green || component === import_Types.ColorComponent.Blue) {
|
|
576
|
+
updatedRGB = true;
|
|
577
|
+
}
|
|
578
|
+
valueDB.setValue(ColorSwitchCCValues.currentColorChannel(component).endpoint(this.endpoint.index), value);
|
|
579
|
+
if (key in import_Types.ColorComponentMap) {
|
|
580
|
+
currentCompoundColor[key] = value;
|
|
581
|
+
targetCompoundColor[key] = value;
|
|
582
|
+
}
|
|
529
583
|
}
|
|
530
|
-
valueDB.setValue(
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
584
|
+
valueDB.setValue(currentColorValueId, currentCompoundColor);
|
|
585
|
+
valueDB.setValue(targetColorValueId, targetCompoundColor);
|
|
586
|
+
const supportsHex = valueDB.getValue(ColorSwitchCCValues.supportsHexColor.endpoint(this.endpoint.index));
|
|
587
|
+
if (supportsHex && updatedRGB) {
|
|
588
|
+
const hexValueId = ColorSwitchCCValues.hexColor.endpoint(this.endpoint.index);
|
|
589
|
+
const [r, g, b] = [
|
|
590
|
+
import_Types.ColorComponent.Red,
|
|
591
|
+
import_Types.ColorComponent.Green,
|
|
592
|
+
import_Types.ColorComponent.Blue
|
|
593
|
+
].map((c) => valueDB.getValue(ColorSwitchCCValues.currentColorChannel(c).endpoint(this.endpoint.index)) ?? 0);
|
|
594
|
+
const hexValue = r << 16 | g << 8 | b;
|
|
595
|
+
valueDB.setValue(hexValueId, hexValue.toString(16).padStart(6, "0"));
|
|
534
596
|
}
|
|
535
597
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
].map((c) => valueDB.getValue(ColorSwitchCCValues.currentColorChannel(c).endpoint(this.endpoint.index)) ?? 0);
|
|
546
|
-
const hexValue = r << 16 | g << 8 | b;
|
|
547
|
-
valueDB.setValue(hexValueId, hexValue.toString(16).padStart(6, "0"));
|
|
598
|
+
async startLevelChange(options) {
|
|
599
|
+
__assertType("options", "ColorSwitchCCStartLevelChangeOptions", __assertType__ColorSwitchCCStartLevelChangeOptions.bind(void 0, options));
|
|
600
|
+
this.assertSupportsCommand(import_Types.ColorSwitchCommand, import_Types.ColorSwitchCommand.StartLevelChange);
|
|
601
|
+
const cc = new ColorSwitchCCStartLevelChange({
|
|
602
|
+
nodeId: this.endpoint.nodeId,
|
|
603
|
+
endpointIndex: this.endpoint.index,
|
|
604
|
+
...options
|
|
605
|
+
});
|
|
606
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
548
607
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
if (property === "targetColor") {
|
|
573
|
-
const duration = import_core.Duration.from(options?.transitionDuration);
|
|
574
|
-
if (propertyKey != void 0) {
|
|
575
|
-
if (typeof propertyKey !== "number") {
|
|
576
|
-
(0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
|
|
577
|
-
} else if (typeof value !== "number") {
|
|
578
|
-
(0, import_API.throwWrongValueType)(this.ccId, property, "number", typeof value);
|
|
579
|
-
}
|
|
580
|
-
const result = await this.set({
|
|
581
|
-
[propertyKey]: value,
|
|
582
|
-
duration
|
|
583
|
-
});
|
|
584
|
-
if (this.isSinglecast() && !(0, import_core.supervisedCommandSucceeded)(result)) {
|
|
585
|
-
this.schedulePoll({ property, propertyKey }, value, {
|
|
586
|
-
duration,
|
|
587
|
-
transition: "fast"
|
|
608
|
+
async stopLevelChange(colorComponent) {
|
|
609
|
+
__assertType("colorComponent", "ColorComponent", __assertType__ColorComponent.bind(void 0, colorComponent));
|
|
610
|
+
this.assertSupportsCommand(import_Types.ColorSwitchCommand, import_Types.ColorSwitchCommand.StopLevelChange);
|
|
611
|
+
const cc = new ColorSwitchCCStopLevelChange({
|
|
612
|
+
nodeId: this.endpoint.nodeId,
|
|
613
|
+
endpointIndex: this.endpoint.index,
|
|
614
|
+
colorComponent
|
|
615
|
+
});
|
|
616
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
617
|
+
}
|
|
618
|
+
get [import_API.SET_VALUE]() {
|
|
619
|
+
return async function({ property, propertyKey }, value, options) {
|
|
620
|
+
if (property === "targetColor") {
|
|
621
|
+
const duration = import_core.Duration.from(options?.transitionDuration);
|
|
622
|
+
if (propertyKey != void 0) {
|
|
623
|
+
if (typeof propertyKey !== "number") {
|
|
624
|
+
(0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
|
|
625
|
+
} else if (typeof value !== "number") {
|
|
626
|
+
(0, import_API.throwWrongValueType)(this.ccId, property, "number", typeof value);
|
|
627
|
+
}
|
|
628
|
+
const result = await this.set({
|
|
629
|
+
[propertyKey]: value,
|
|
630
|
+
duration
|
|
588
631
|
});
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
}
|
|
595
|
-
for (const [key, val] of Object.entries(value)) {
|
|
596
|
-
if (typeof val !== "number") {
|
|
597
|
-
(0, import_API.throwWrongValueType)(this.ccId, `${property}.${key}`, "number", typeof val);
|
|
632
|
+
if (this.isSinglecast() && !(0, import_core.supervisedCommandSucceeded)(result)) {
|
|
633
|
+
this.schedulePoll({ property, propertyKey }, value, {
|
|
634
|
+
duration,
|
|
635
|
+
transition: "fast"
|
|
636
|
+
});
|
|
598
637
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
value = (0, import_safe3.pick)(value, supportedColors.map((c) => colorComponentToTableKey(c)).filter((c) => !!c));
|
|
638
|
+
return result;
|
|
639
|
+
} else {
|
|
640
|
+
if (!(0, import_typeguards.isObject)(value) || !Object.keys(value).every((key) => key in import_Types.ColorComponentMap)) {
|
|
641
|
+
throw new import_core.ZWaveError(`${import_core.CommandClasses[this.ccId]}: "${property}" must be set to an object which specifies each color channel`, import_core.ZWaveErrorCodes.Argument_Invalid);
|
|
604
642
|
}
|
|
643
|
+
for (const [key, val] of Object.entries(value)) {
|
|
644
|
+
if (typeof val !== "number") {
|
|
645
|
+
(0, import_API.throwWrongValueType)(this.ccId, `${property}.${key}`, "number", typeof val);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
if (this.isSinglecast()) {
|
|
649
|
+
const supportedColors = this.tryGetValueDB()?.getValue(ColorSwitchCCValues.supportedColorComponents.endpoint(this.endpoint.index));
|
|
650
|
+
if (supportedColors) {
|
|
651
|
+
value = (0, import_safe3.pick)(value, supportedColors.map((c) => colorComponentToTableKey(c)).filter((c) => !!c));
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
if (Object.keys(value).length === 0)
|
|
655
|
+
return;
|
|
656
|
+
return this.set({ ...value, duration });
|
|
657
|
+
}
|
|
658
|
+
} else if (property === "hexColor") {
|
|
659
|
+
if (typeof value !== "string") {
|
|
660
|
+
(0, import_API.throwWrongValueType)(this.ccId, property, "string", typeof value);
|
|
605
661
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
662
|
+
const duration = import_core.Duration.from(options?.transitionDuration);
|
|
663
|
+
return this.set({ hexColor: value, duration });
|
|
664
|
+
} else {
|
|
665
|
+
(0, import_API.throwUnsupportedProperty)(this.ccId, property);
|
|
609
666
|
}
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
isSetValueOptimistic(_valueId) {
|
|
670
|
+
return false;
|
|
671
|
+
}
|
|
672
|
+
get [import_API.POLL_VALUE]() {
|
|
673
|
+
return async function({ property, propertyKey }) {
|
|
674
|
+
if (propertyKey == void 0) {
|
|
675
|
+
(0, import_API.throwMissingPropertyKey)(this.ccId, property);
|
|
676
|
+
} else if (typeof propertyKey !== "number") {
|
|
677
|
+
(0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
|
|
613
678
|
}
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
};
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
priority: import_core.MessagePriority.NodeQuery
|
|
653
|
-
});
|
|
654
|
-
ctx.logNode(node.id, {
|
|
655
|
-
endpoint: this.endpointIndex,
|
|
656
|
-
message: `Interviewing ${this.ccName}...`,
|
|
657
|
-
direction: "none"
|
|
658
|
-
});
|
|
659
|
-
ctx.logNode(node.id, {
|
|
660
|
-
endpoint: this.endpointIndex,
|
|
661
|
-
message: "querying supported colors...",
|
|
662
|
-
direction: "outbound"
|
|
663
|
-
});
|
|
664
|
-
const supportedColors = await api.getSupported();
|
|
665
|
-
if (!supportedColors) {
|
|
679
|
+
switch (property) {
|
|
680
|
+
case "currentColor":
|
|
681
|
+
return (await this.get(propertyKey))?.currentValue;
|
|
682
|
+
case "targetColor":
|
|
683
|
+
return (await this.get(propertyKey))?.targetValue;
|
|
684
|
+
case "duration":
|
|
685
|
+
return (await this.get(propertyKey))?.duration;
|
|
686
|
+
default:
|
|
687
|
+
(0, import_API.throwUnsupportedProperty)(this.ccId, property);
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
return ColorSwitchCCAPI2 = _classThis;
|
|
693
|
+
})();
|
|
694
|
+
let ColorSwitchCC = (() => {
|
|
695
|
+
let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_core.CommandClasses["Color Switch"]), (0, import_CommandClassDecorators.implementedVersion)(3), (0, import_CommandClassDecorators.ccValues)(ColorSwitchCCValues)];
|
|
696
|
+
let _classDescriptor;
|
|
697
|
+
let _classExtraInitializers = [];
|
|
698
|
+
let _classThis;
|
|
699
|
+
let _classSuper = import_CommandClass.CommandClass;
|
|
700
|
+
var ColorSwitchCC2 = class extends _classSuper {
|
|
701
|
+
static {
|
|
702
|
+
_classThis = this;
|
|
703
|
+
}
|
|
704
|
+
static {
|
|
705
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
706
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
707
|
+
ColorSwitchCC2 = _classThis = _classDescriptor.value;
|
|
708
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
709
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
710
|
+
}
|
|
711
|
+
async interview(ctx) {
|
|
712
|
+
const node = this.getNode(ctx);
|
|
713
|
+
const endpoint = this.getEndpoint(ctx);
|
|
714
|
+
const api = import_API.CCAPI.create(import_core.CommandClasses["Color Switch"], ctx, endpoint).withOptions({
|
|
715
|
+
priority: import_core.MessagePriority.NodeQuery
|
|
716
|
+
});
|
|
666
717
|
ctx.logNode(node.id, {
|
|
667
718
|
endpoint: this.endpointIndex,
|
|
668
|
-
message:
|
|
669
|
-
|
|
719
|
+
message: `Interviewing ${this.ccName}...`,
|
|
720
|
+
direction: "none"
|
|
670
721
|
});
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
ctx.logNode(node.id, {
|
|
674
|
-
endpoint: this.endpointIndex,
|
|
675
|
-
message: `received supported colors:${supportedColors.map((c) => `
|
|
676
|
-
\xB7 ${(0, import_safe3.getEnumMemberName)(import_Types.ColorComponent, c)}`).join("")}`,
|
|
677
|
-
direction: "outbound"
|
|
678
|
-
});
|
|
679
|
-
for (const color of supportedColors) {
|
|
680
|
-
const currentColorChannelValue = ColorSwitchCCValues.currentColorChannel(color);
|
|
681
|
-
this.setMetadata(ctx, currentColorChannelValue);
|
|
682
|
-
const targetColorChannelValue = ColorSwitchCCValues.targetColorChannel(color);
|
|
683
|
-
this.setMetadata(ctx, targetColorChannelValue);
|
|
684
|
-
}
|
|
685
|
-
const currentColorValue = ColorSwitchCCValues.currentColor;
|
|
686
|
-
this.setMetadata(ctx, currentColorValue);
|
|
687
|
-
const targetColorValue = ColorSwitchCCValues.targetColor;
|
|
688
|
-
this.setMetadata(ctx, targetColorValue);
|
|
689
|
-
const supportsHex = [
|
|
690
|
-
import_Types.ColorComponent.Red,
|
|
691
|
-
import_Types.ColorComponent.Green,
|
|
692
|
-
import_Types.ColorComponent.Blue
|
|
693
|
-
].every((c) => supportedColors.includes(c));
|
|
694
|
-
this.setValue(ctx, ColorSwitchCCValues.supportsHexColor, supportsHex);
|
|
695
|
-
if (supportsHex) {
|
|
696
|
-
const hexColorValue = ColorSwitchCCValues.hexColor;
|
|
697
|
-
this.setMetadata(ctx, hexColorValue);
|
|
698
|
-
}
|
|
699
|
-
await this.refreshValues(ctx);
|
|
700
|
-
this.setInterviewComplete(ctx, true);
|
|
701
|
-
}
|
|
702
|
-
async refreshValues(ctx) {
|
|
703
|
-
const node = this.getNode(ctx);
|
|
704
|
-
const endpoint = this.getEndpoint(ctx);
|
|
705
|
-
const api = import_API.CCAPI.create(import_core.CommandClasses["Color Switch"], ctx, endpoint).withOptions({
|
|
706
|
-
priority: import_core.MessagePriority.NodeQuery
|
|
707
|
-
});
|
|
708
|
-
const supportedColors = this.getValue(ctx, ColorSwitchCCValues.supportedColorComponents) ?? [];
|
|
709
|
-
for (const color of supportedColors) {
|
|
710
|
-
if (!(0, import_safe3.isEnumMember)(import_Types.ColorComponent, color))
|
|
711
|
-
continue;
|
|
712
|
-
const colorName = (0, import_safe3.getEnumMemberName)(import_Types.ColorComponent, color);
|
|
713
722
|
ctx.logNode(node.id, {
|
|
714
723
|
endpoint: this.endpointIndex,
|
|
715
|
-
message:
|
|
724
|
+
message: "querying supported colors...",
|
|
725
|
+
direction: "outbound"
|
|
726
|
+
});
|
|
727
|
+
const supportedColors = await api.getSupported();
|
|
728
|
+
if (!supportedColors) {
|
|
729
|
+
ctx.logNode(node.id, {
|
|
730
|
+
endpoint: this.endpointIndex,
|
|
731
|
+
message: "Querying supported colors timed out, skipping interview...",
|
|
732
|
+
level: "warn"
|
|
733
|
+
});
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
ctx.logNode(node.id, {
|
|
737
|
+
endpoint: this.endpointIndex,
|
|
738
|
+
message: `received supported colors:${supportedColors.map((c) => `
|
|
739
|
+
\xB7 ${(0, import_safe3.getEnumMemberName)(import_Types.ColorComponent, c)}`).join("")}`,
|
|
716
740
|
direction: "outbound"
|
|
717
741
|
});
|
|
718
|
-
|
|
742
|
+
for (const color of supportedColors) {
|
|
743
|
+
const currentColorChannelValue = ColorSwitchCCValues.currentColorChannel(color);
|
|
744
|
+
this.setMetadata(ctx, currentColorChannelValue);
|
|
745
|
+
const targetColorChannelValue = ColorSwitchCCValues.targetColorChannel(color);
|
|
746
|
+
this.setMetadata(ctx, targetColorChannelValue);
|
|
747
|
+
}
|
|
748
|
+
const currentColorValue = ColorSwitchCCValues.currentColor;
|
|
749
|
+
this.setMetadata(ctx, currentColorValue);
|
|
750
|
+
const targetColorValue = ColorSwitchCCValues.targetColor;
|
|
751
|
+
this.setMetadata(ctx, targetColorValue);
|
|
752
|
+
const supportsHex = [
|
|
753
|
+
import_Types.ColorComponent.Red,
|
|
754
|
+
import_Types.ColorComponent.Green,
|
|
755
|
+
import_Types.ColorComponent.Blue
|
|
756
|
+
].every((c) => supportedColors.includes(c));
|
|
757
|
+
this.setValue(ctx, ColorSwitchCCValues.supportsHexColor, supportsHex);
|
|
758
|
+
if (supportsHex) {
|
|
759
|
+
const hexColorValue = ColorSwitchCCValues.hexColor;
|
|
760
|
+
this.setMetadata(ctx, hexColorValue);
|
|
761
|
+
}
|
|
762
|
+
await this.refreshValues(ctx);
|
|
763
|
+
this.setInterviewComplete(ctx, true);
|
|
764
|
+
}
|
|
765
|
+
async refreshValues(ctx) {
|
|
766
|
+
const node = this.getNode(ctx);
|
|
767
|
+
const endpoint = this.getEndpoint(ctx);
|
|
768
|
+
const api = import_API.CCAPI.create(import_core.CommandClasses["Color Switch"], ctx, endpoint).withOptions({
|
|
769
|
+
priority: import_core.MessagePriority.NodeQuery
|
|
770
|
+
});
|
|
771
|
+
const supportedColors = this.getValue(ctx, ColorSwitchCCValues.supportedColorComponents) ?? [];
|
|
772
|
+
for (const color of supportedColors) {
|
|
773
|
+
if (!(0, import_safe3.isEnumMember)(import_Types.ColorComponent, color))
|
|
774
|
+
continue;
|
|
775
|
+
const colorName = (0, import_safe3.getEnumMemberName)(import_Types.ColorComponent, color);
|
|
776
|
+
ctx.logNode(node.id, {
|
|
777
|
+
endpoint: this.endpointIndex,
|
|
778
|
+
message: `querying current color state (${colorName})`,
|
|
779
|
+
direction: "outbound"
|
|
780
|
+
});
|
|
781
|
+
await api.get(color);
|
|
782
|
+
}
|
|
719
783
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
784
|
+
translatePropertyKey(ctx, property, propertyKey) {
|
|
785
|
+
if ((property === "currentColor" || property === "targetColor") && typeof propertyKey === "number") {
|
|
786
|
+
const translated = import_Types.ColorComponent[propertyKey];
|
|
787
|
+
if (translated)
|
|
788
|
+
return translated;
|
|
789
|
+
}
|
|
790
|
+
return super.translatePropertyKey(ctx, property, propertyKey);
|
|
726
791
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
};
|
|
730
|
-
|
|
731
|
-
(0, import_CommandClassDecorators.
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
let
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
792
|
+
};
|
|
793
|
+
return ColorSwitchCC2 = _classThis;
|
|
794
|
+
})();
|
|
795
|
+
let ColorSwitchCCSupportedReport = (() => {
|
|
796
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ColorSwitchCommand.SupportedReport), (0, import_CommandClassDecorators.ccValueProperty)("supportedColorComponents", ColorSwitchCCValues.supportedColorComponents)];
|
|
797
|
+
let _classDescriptor;
|
|
798
|
+
let _classExtraInitializers = [];
|
|
799
|
+
let _classThis;
|
|
800
|
+
let _classSuper = ColorSwitchCC;
|
|
801
|
+
var ColorSwitchCCSupportedReport2 = class extends _classSuper {
|
|
802
|
+
static {
|
|
803
|
+
_classThis = this;
|
|
804
|
+
}
|
|
805
|
+
static {
|
|
806
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
807
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
808
|
+
ColorSwitchCCSupportedReport2 = _classThis = _classDescriptor.value;
|
|
809
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
810
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
811
|
+
}
|
|
812
|
+
constructor(options) {
|
|
813
|
+
super(options);
|
|
814
|
+
this.supportedColorComponents = options.supportedColorComponents;
|
|
815
|
+
}
|
|
816
|
+
static from(raw, ctx) {
|
|
817
|
+
(0, import_core.validatePayload)(raw.payload.length >= 2);
|
|
818
|
+
const supportedColorComponents = (0, import_core.parseBitMask)(raw.payload.subarray(0, 2), import_Types.ColorComponent["Warm White"]);
|
|
819
|
+
return new this({
|
|
820
|
+
nodeId: ctx.sourceNodeId,
|
|
821
|
+
supportedColorComponents
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
supportedColorComponents;
|
|
825
|
+
serialize(ctx) {
|
|
826
|
+
this.payload = (0, import_safe.encodeBitMask)(
|
|
827
|
+
this.supportedColorComponents,
|
|
828
|
+
15,
|
|
829
|
+
// fixed 2 bytes
|
|
830
|
+
import_Types.ColorComponent["Warm White"]
|
|
831
|
+
);
|
|
832
|
+
return super.serialize(ctx);
|
|
833
|
+
}
|
|
834
|
+
toLogEntry(ctx) {
|
|
835
|
+
return {
|
|
836
|
+
...super.toLogEntry(ctx),
|
|
837
|
+
message: {
|
|
838
|
+
"supported color components": this.supportedColorComponents.map((c) => `
|
|
763
839
|
\xB7 ${(0, import_safe3.getEnumMemberName)(import_Types.ColorComponent, c)}`).join("")
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
};
|
|
844
|
+
return ColorSwitchCCSupportedReport2 = _classThis;
|
|
845
|
+
})();
|
|
846
|
+
let ColorSwitchCCSupportedGet = (() => {
|
|
847
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ColorSwitchCommand.SupportedGet), (0, import_CommandClassDecorators.expectedCCResponse)(ColorSwitchCCSupportedReport)];
|
|
848
|
+
let _classDescriptor;
|
|
849
|
+
let _classExtraInitializers = [];
|
|
850
|
+
let _classThis;
|
|
851
|
+
let _classSuper = ColorSwitchCC;
|
|
852
|
+
var ColorSwitchCCSupportedGet2 = class extends _classSuper {
|
|
853
|
+
static {
|
|
854
|
+
_classThis = this;
|
|
855
|
+
}
|
|
856
|
+
static {
|
|
857
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
858
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
859
|
+
ColorSwitchCCSupportedGet2 = _classThis = _classDescriptor.value;
|
|
860
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
861
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
862
|
+
}
|
|
863
|
+
};
|
|
864
|
+
return ColorSwitchCCSupportedGet2 = _classThis;
|
|
865
|
+
})();
|
|
866
|
+
let ColorSwitchCCReport = (() => {
|
|
867
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ColorSwitchCommand.Report), (0, import_CommandClassDecorators.ccValueProperty)("currentValue", ColorSwitchCCValues.currentColorChannel, (self) => [self.colorComponent]), (0, import_CommandClassDecorators.ccValueProperty)("targetValue", ColorSwitchCCValues.targetColorChannel, (self) => [self.colorComponent]), (0, import_CommandClassDecorators.ccValueProperty)("duration", ColorSwitchCCValues.duration)];
|
|
868
|
+
let _classDescriptor;
|
|
869
|
+
let _classExtraInitializers = [];
|
|
870
|
+
let _classThis;
|
|
871
|
+
let _classSuper = ColorSwitchCC;
|
|
872
|
+
var ColorSwitchCCReport2 = class extends _classSuper {
|
|
873
|
+
static {
|
|
874
|
+
_classThis = this;
|
|
875
|
+
}
|
|
876
|
+
static {
|
|
877
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
878
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
879
|
+
ColorSwitchCCReport2 = _classThis = _classDescriptor.value;
|
|
880
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
881
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
882
|
+
}
|
|
883
|
+
constructor(options) {
|
|
884
|
+
super(options);
|
|
885
|
+
this.colorComponent = options.colorComponent;
|
|
886
|
+
this.currentValue = options.currentValue;
|
|
887
|
+
this.targetValue = options.targetValue;
|
|
888
|
+
this.duration = import_core.Duration.from(options.duration);
|
|
889
|
+
}
|
|
890
|
+
static from(raw, ctx) {
|
|
891
|
+
(0, import_core.validatePayload)(raw.payload.length >= 2);
|
|
892
|
+
const colorComponent = raw.payload[0];
|
|
893
|
+
const currentValue = raw.payload[1];
|
|
894
|
+
let targetValue;
|
|
895
|
+
let duration;
|
|
896
|
+
if (raw.payload.length >= 4) {
|
|
897
|
+
targetValue = raw.payload[2];
|
|
898
|
+
duration = import_core.Duration.parseReport(raw.payload[3]);
|
|
764
899
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
return new ColorSwitchCCReport_1({
|
|
799
|
-
nodeId: ctx.sourceNodeId,
|
|
800
|
-
colorComponent,
|
|
801
|
-
currentValue,
|
|
802
|
-
targetValue,
|
|
803
|
-
duration
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
persistValues(ctx) {
|
|
807
|
-
if (!super.persistValues(ctx))
|
|
808
|
-
return false;
|
|
809
|
-
const colorTableKey = colorComponentToTableKey(this.colorComponent);
|
|
810
|
-
if (colorTableKey) {
|
|
811
|
-
const compoundCurrentColorValue = ColorSwitchCCValues.currentColor;
|
|
812
|
-
const compoundCurrentColor = this.getValue(ctx, compoundCurrentColorValue) ?? {};
|
|
813
|
-
compoundCurrentColor[colorTableKey] = this.currentValue;
|
|
814
|
-
this.setValue(ctx, compoundCurrentColorValue, compoundCurrentColor);
|
|
815
|
-
if (this.targetValue != void 0) {
|
|
816
|
-
const compoundTargetColorValue = ColorSwitchCCValues.targetColor;
|
|
817
|
-
const compoundTargetColor = this.getValue(ctx, compoundTargetColorValue) ?? {};
|
|
818
|
-
compoundTargetColor[colorTableKey] = this.targetValue;
|
|
819
|
-
this.setValue(ctx, compoundTargetColorValue, compoundTargetColor);
|
|
900
|
+
return new this({
|
|
901
|
+
nodeId: ctx.sourceNodeId,
|
|
902
|
+
colorComponent,
|
|
903
|
+
currentValue,
|
|
904
|
+
targetValue,
|
|
905
|
+
duration
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
persistValues(ctx) {
|
|
909
|
+
if (!super.persistValues(ctx))
|
|
910
|
+
return false;
|
|
911
|
+
const colorTableKey = colorComponentToTableKey(this.colorComponent);
|
|
912
|
+
if (colorTableKey) {
|
|
913
|
+
const compoundCurrentColorValue = ColorSwitchCCValues.currentColor;
|
|
914
|
+
const compoundCurrentColor = this.getValue(ctx, compoundCurrentColorValue) ?? {};
|
|
915
|
+
compoundCurrentColor[colorTableKey] = this.currentValue;
|
|
916
|
+
this.setValue(ctx, compoundCurrentColorValue, compoundCurrentColor);
|
|
917
|
+
if (this.targetValue != void 0) {
|
|
918
|
+
const compoundTargetColorValue = ColorSwitchCCValues.targetColor;
|
|
919
|
+
const compoundTargetColor = this.getValue(ctx, compoundTargetColorValue) ?? {};
|
|
920
|
+
compoundTargetColor[colorTableKey] = this.targetValue;
|
|
921
|
+
this.setValue(ctx, compoundTargetColorValue, compoundTargetColor);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
const supportsHex = !!this.getValue(ctx, ColorSwitchCCValues.supportsHexColor);
|
|
925
|
+
if (supportsHex && (this.colorComponent === import_Types.ColorComponent.Red || this.colorComponent === import_Types.ColorComponent.Green || this.colorComponent === import_Types.ColorComponent.Blue)) {
|
|
926
|
+
const hexColorValue = ColorSwitchCCValues.hexColor;
|
|
927
|
+
const hexValue = this.getValue(ctx, hexColorValue) ?? "000000";
|
|
928
|
+
const byteOffset = import_Types.ColorComponent.Blue - this.colorComponent;
|
|
929
|
+
const byteMask = 255 << byteOffset * 8;
|
|
930
|
+
let hexValueNumeric = parseInt(hexValue, 16);
|
|
931
|
+
hexValueNumeric = hexValueNumeric & ~byteMask | this.currentValue << byteOffset * 8;
|
|
932
|
+
this.setValue(ctx, hexColorValue, hexValueNumeric.toString(16).padStart(6, "0"));
|
|
820
933
|
}
|
|
934
|
+
return true;
|
|
821
935
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
this.setValue(ctx, hexColorValue, hexValueNumeric.toString(16).padStart(6, "0"));
|
|
831
|
-
}
|
|
832
|
-
return true;
|
|
833
|
-
}
|
|
834
|
-
colorComponent;
|
|
835
|
-
currentValue;
|
|
836
|
-
targetValue;
|
|
837
|
-
duration;
|
|
838
|
-
serialize(ctx) {
|
|
839
|
-
this.payload = import_safe2.Bytes.from([
|
|
840
|
-
this.colorComponent,
|
|
841
|
-
this.currentValue
|
|
842
|
-
]);
|
|
843
|
-
if (this.targetValue != void 0 && this.duration != void 0) {
|
|
844
|
-
this.payload = import_safe2.Bytes.concat([
|
|
845
|
-
this.payload,
|
|
846
|
-
import_safe2.Bytes.from([
|
|
847
|
-
this.targetValue ?? 254,
|
|
848
|
-
(this.duration ?? import_core.Duration.default()).serializeReport()
|
|
849
|
-
])
|
|
936
|
+
colorComponent;
|
|
937
|
+
currentValue;
|
|
938
|
+
targetValue;
|
|
939
|
+
duration;
|
|
940
|
+
serialize(ctx) {
|
|
941
|
+
this.payload = import_safe2.Bytes.from([
|
|
942
|
+
this.colorComponent,
|
|
943
|
+
this.currentValue
|
|
850
944
|
]);
|
|
945
|
+
if (this.targetValue != void 0 && this.duration != void 0) {
|
|
946
|
+
this.payload = import_safe2.Bytes.concat([
|
|
947
|
+
this.payload,
|
|
948
|
+
import_safe2.Bytes.from([
|
|
949
|
+
this.targetValue ?? 254,
|
|
950
|
+
(this.duration ?? import_core.Duration.default()).serializeReport()
|
|
951
|
+
])
|
|
952
|
+
]);
|
|
953
|
+
}
|
|
954
|
+
return super.serialize(ctx);
|
|
851
955
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
956
|
+
toLogEntry(ctx) {
|
|
957
|
+
const message = {
|
|
958
|
+
"color component": (0, import_safe3.getEnumMemberName)(import_Types.ColorComponent, this.colorComponent),
|
|
959
|
+
"current value": this.currentValue
|
|
960
|
+
};
|
|
961
|
+
if (this.targetValue != void 0) {
|
|
962
|
+
message["target value"] = this.targetValue;
|
|
963
|
+
}
|
|
964
|
+
if (this.duration != void 0) {
|
|
965
|
+
message.duration = this.duration.toString();
|
|
966
|
+
}
|
|
967
|
+
return {
|
|
968
|
+
...super.toLogEntry(ctx),
|
|
969
|
+
message
|
|
970
|
+
};
|
|
864
971
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
};
|
|
871
|
-
__decorate([
|
|
872
|
-
(0, import_CommandClassDecorators.ccValue)(ColorSwitchCCValues.currentColorChannel, (self) => [self.colorComponent])
|
|
873
|
-
], ColorSwitchCCReport.prototype, "currentValue", void 0);
|
|
874
|
-
__decorate([
|
|
875
|
-
(0, import_CommandClassDecorators.ccValue)(ColorSwitchCCValues.targetColorChannel, (self) => [self.colorComponent])
|
|
876
|
-
], ColorSwitchCCReport.prototype, "targetValue", void 0);
|
|
877
|
-
__decorate([
|
|
878
|
-
(0, import_CommandClassDecorators.ccValue)(ColorSwitchCCValues.duration)
|
|
879
|
-
], ColorSwitchCCReport.prototype, "duration", void 0);
|
|
880
|
-
ColorSwitchCCReport = ColorSwitchCCReport_1 = __decorate([
|
|
881
|
-
(0, import_CommandClassDecorators.CCCommand)(import_Types.ColorSwitchCommand.Report)
|
|
882
|
-
], ColorSwitchCCReport);
|
|
972
|
+
};
|
|
973
|
+
return ColorSwitchCCReport2 = _classThis;
|
|
974
|
+
})();
|
|
883
975
|
function testResponseForColorSwitchGet(sent, received) {
|
|
884
976
|
return sent.colorComponent === received.colorComponent;
|
|
885
977
|
}
|
|
886
|
-
let ColorSwitchCCGet =
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
nodeId: ctx.sourceNodeId,
|
|
896
|
-
colorComponent
|
|
897
|
-
});
|
|
898
|
-
}
|
|
899
|
-
_colorComponent;
|
|
900
|
-
get colorComponent() {
|
|
901
|
-
return this._colorComponent;
|
|
902
|
-
}
|
|
903
|
-
set colorComponent(value) {
|
|
904
|
-
if (!import_Types.ColorComponent[value]) {
|
|
905
|
-
throw new import_core.ZWaveError("colorComponent must be a valid color component index.", import_core.ZWaveErrorCodes.Argument_Invalid);
|
|
978
|
+
let ColorSwitchCCGet = (() => {
|
|
979
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ColorSwitchCommand.Get), (0, import_CommandClassDecorators.expectedCCResponse)(ColorSwitchCCReport, testResponseForColorSwitchGet)];
|
|
980
|
+
let _classDescriptor;
|
|
981
|
+
let _classExtraInitializers = [];
|
|
982
|
+
let _classThis;
|
|
983
|
+
let _classSuper = ColorSwitchCC;
|
|
984
|
+
var ColorSwitchCCGet2 = class extends _classSuper {
|
|
985
|
+
static {
|
|
986
|
+
_classThis = this;
|
|
906
987
|
}
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
988
|
+
static {
|
|
989
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
990
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
991
|
+
ColorSwitchCCGet2 = _classThis = _classDescriptor.value;
|
|
992
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
993
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
994
|
+
}
|
|
995
|
+
constructor(options) {
|
|
996
|
+
super(options);
|
|
997
|
+
this._colorComponent = options.colorComponent;
|
|
998
|
+
}
|
|
999
|
+
static from(raw, ctx) {
|
|
1000
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
1001
|
+
const colorComponent = raw.payload[0];
|
|
1002
|
+
return new this({
|
|
1003
|
+
nodeId: ctx.sourceNodeId,
|
|
1004
|
+
colorComponent
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
_colorComponent;
|
|
1008
|
+
get colorComponent() {
|
|
1009
|
+
return this._colorComponent;
|
|
1010
|
+
}
|
|
1011
|
+
set colorComponent(value) {
|
|
1012
|
+
if (!import_Types.ColorComponent[value]) {
|
|
1013
|
+
throw new import_core.ZWaveError("colorComponent must be a valid color component index.", import_core.ZWaveErrorCodes.Argument_Invalid);
|
|
918
1014
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1015
|
+
this._colorComponent = value;
|
|
1016
|
+
}
|
|
1017
|
+
serialize(ctx) {
|
|
1018
|
+
this.payload = import_safe2.Bytes.from([this._colorComponent]);
|
|
1019
|
+
return super.serialize(ctx);
|
|
1020
|
+
}
|
|
1021
|
+
toLogEntry(ctx) {
|
|
1022
|
+
return {
|
|
1023
|
+
...super.toLogEntry(ctx),
|
|
1024
|
+
message: {
|
|
1025
|
+
"color component": (0, import_safe3.getEnumMemberName)(import_Types.ColorComponent, this.colorComponent)
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
return ColorSwitchCCGet2 = _classThis;
|
|
1031
|
+
})();
|
|
1032
|
+
let ColorSwitchCCSet = (() => {
|
|
1033
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ColorSwitchCommand.Set), (0, import_CommandClassDecorators.useSupervision)()];
|
|
1034
|
+
let _classDescriptor;
|
|
1035
|
+
let _classExtraInitializers = [];
|
|
1036
|
+
let _classThis;
|
|
1037
|
+
let _classSuper = ColorSwitchCC;
|
|
1038
|
+
var ColorSwitchCCSet2 = class extends _classSuper {
|
|
1039
|
+
static {
|
|
1040
|
+
_classThis = this;
|
|
1041
|
+
}
|
|
1042
|
+
static {
|
|
1043
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1044
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1045
|
+
ColorSwitchCCSet2 = _classThis = _classDescriptor.value;
|
|
1046
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1047
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1048
|
+
}
|
|
1049
|
+
constructor(options) {
|
|
1050
|
+
super(options);
|
|
1051
|
+
if ("hexColor" in options) {
|
|
1052
|
+
const match = hexColorRegex.exec(options.hexColor);
|
|
1053
|
+
if (!match) {
|
|
1054
|
+
throw new import_core.ZWaveError(`${options.hexColor} is not a valid HEX color string`, import_core.ZWaveErrorCodes.Argument_Invalid);
|
|
1055
|
+
}
|
|
1056
|
+
this.colorTable = {
|
|
1057
|
+
red: parseInt(match.groups.red, 16),
|
|
1058
|
+
green: parseInt(match.groups.green, 16),
|
|
1059
|
+
blue: parseInt(match.groups.blue, 16)
|
|
1060
|
+
};
|
|
1061
|
+
} else {
|
|
1062
|
+
this.colorTable = (0, import_safe3.pick)(options, colorTableKeys);
|
|
1063
|
+
}
|
|
1064
|
+
this.duration = import_core.Duration.from(options.duration);
|
|
1065
|
+
}
|
|
1066
|
+
static from(raw, ctx) {
|
|
1067
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
1068
|
+
const populatedColorCount = raw.payload[0] & 31;
|
|
1069
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1 + populatedColorCount * 2);
|
|
1070
|
+
const colorTable = {};
|
|
1071
|
+
let offset = 1;
|
|
1072
|
+
for (let color = 0; color < populatedColorCount; color++) {
|
|
1073
|
+
const component = raw.payload[offset];
|
|
1074
|
+
const value = raw.payload[offset + 1];
|
|
1075
|
+
const key = colorComponentToTableKey(component);
|
|
1076
|
+
if (key)
|
|
1077
|
+
this.colorTable[key] = value;
|
|
1078
|
+
offset += 2;
|
|
933
1079
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
1080
|
+
let duration;
|
|
1081
|
+
if (raw.payload.length > offset) {
|
|
1082
|
+
duration = import_core.Duration.parseSet(raw.payload[offset]);
|
|
1083
|
+
}
|
|
1084
|
+
return new this({
|
|
1085
|
+
nodeId: ctx.sourceNodeId,
|
|
1086
|
+
...colorTable,
|
|
1087
|
+
duration
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
colorTable;
|
|
1091
|
+
duration;
|
|
1092
|
+
serialize(ctx) {
|
|
1093
|
+
const populatedColorCount = Object.keys(this.colorTable).length;
|
|
1094
|
+
this.payload = new import_safe2.Bytes(1 + populatedColorCount * 2 + 1);
|
|
1095
|
+
this.payload[0] = populatedColorCount & 31;
|
|
1096
|
+
let i = 1;
|
|
1097
|
+
for (const [key, value] of Object.entries(this.colorTable)) {
|
|
1098
|
+
const component = colorTableKeyToComponent(key);
|
|
1099
|
+
this.payload[i] = component;
|
|
1100
|
+
this.payload[i + 1] = (0, import_math.clamp)(value, 0, 255);
|
|
1101
|
+
i += 2;
|
|
1102
|
+
}
|
|
1103
|
+
this.payload[i] = (this.duration ?? import_core.Duration.default()).serializeSet();
|
|
1104
|
+
const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
|
|
1105
|
+
if (ccVersion < 2 && ctx.getDeviceConfig?.(this.nodeId)?.compat?.encodeCCsUsingTargetVersion) {
|
|
1106
|
+
this.payload = this.payload.subarray(0, -1);
|
|
1107
|
+
}
|
|
1108
|
+
return super.serialize(ctx);
|
|
1109
|
+
}
|
|
1110
|
+
toLogEntry(ctx) {
|
|
1111
|
+
const message = {};
|
|
1112
|
+
for (const [key, value] of Object.entries(this.colorTable)) {
|
|
1113
|
+
const realKey = key in import_Types.ColorComponentMap ? import_Types.ColorComponent[import_Types.ColorComponentMap[key]] : import_Types.ColorComponent[key];
|
|
1114
|
+
message[realKey] = value;
|
|
1115
|
+
}
|
|
1116
|
+
if (this.duration != void 0) {
|
|
1117
|
+
message.duration = this.duration.toString();
|
|
1118
|
+
}
|
|
1119
|
+
return {
|
|
1120
|
+
...super.toLogEntry(ctx),
|
|
1121
|
+
message
|
|
938
1122
|
};
|
|
939
|
-
} else {
|
|
940
|
-
this.colorTable = (0, import_safe3.pick)(options, colorTableKeys);
|
|
941
1123
|
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
if (key)
|
|
955
|
-
this.colorTable[key] = value;
|
|
956
|
-
offset += 2;
|
|
957
|
-
}
|
|
958
|
-
let duration;
|
|
959
|
-
if (raw.payload.length > offset) {
|
|
960
|
-
duration = import_core.Duration.parseSet(raw.payload[offset]);
|
|
961
|
-
}
|
|
962
|
-
return new ColorSwitchCCSet_1({
|
|
963
|
-
nodeId: ctx.sourceNodeId,
|
|
964
|
-
...colorTable,
|
|
965
|
-
duration
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
|
-
colorTable;
|
|
969
|
-
duration;
|
|
970
|
-
serialize(ctx) {
|
|
971
|
-
const populatedColorCount = Object.keys(this.colorTable).length;
|
|
972
|
-
this.payload = new import_safe2.Bytes(1 + populatedColorCount * 2 + 1);
|
|
973
|
-
this.payload[0] = populatedColorCount & 31;
|
|
974
|
-
let i = 1;
|
|
975
|
-
for (const [key, value] of Object.entries(this.colorTable)) {
|
|
976
|
-
const component = colorTableKeyToComponent(key);
|
|
977
|
-
this.payload[i] = component;
|
|
978
|
-
this.payload[i + 1] = (0, import_math.clamp)(value, 0, 255);
|
|
979
|
-
i += 2;
|
|
980
|
-
}
|
|
981
|
-
this.payload[i] = (this.duration ?? import_core.Duration.default()).serializeSet();
|
|
982
|
-
const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
|
|
983
|
-
if (ccVersion < 2 && ctx.getDeviceConfig?.(this.nodeId)?.compat?.encodeCCsUsingTargetVersion) {
|
|
984
|
-
this.payload = this.payload.subarray(0, -1);
|
|
985
|
-
}
|
|
986
|
-
return super.serialize(ctx);
|
|
987
|
-
}
|
|
988
|
-
toLogEntry(ctx) {
|
|
989
|
-
const message = {};
|
|
990
|
-
for (const [key, value] of Object.entries(this.colorTable)) {
|
|
991
|
-
const realKey = key in import_Types.ColorComponentMap ? import_Types.ColorComponent[import_Types.ColorComponentMap[key]] : import_Types.ColorComponent[key];
|
|
992
|
-
message[realKey] = value;
|
|
993
|
-
}
|
|
994
|
-
if (this.duration != void 0) {
|
|
995
|
-
message.duration = this.duration.toString();
|
|
996
|
-
}
|
|
997
|
-
return {
|
|
998
|
-
...super.toLogEntry(ctx),
|
|
999
|
-
message
|
|
1000
|
-
};
|
|
1001
|
-
}
|
|
1002
|
-
};
|
|
1003
|
-
ColorSwitchCCSet = ColorSwitchCCSet_1 = __decorate([
|
|
1004
|
-
(0, import_CommandClassDecorators.CCCommand)(import_Types.ColorSwitchCommand.Set),
|
|
1005
|
-
(0, import_CommandClassDecorators.useSupervision)()
|
|
1006
|
-
], ColorSwitchCCSet);
|
|
1007
|
-
let ColorSwitchCCStartLevelChange = ColorSwitchCCStartLevelChange_1 = class ColorSwitchCCStartLevelChange2 extends ColorSwitchCC {
|
|
1008
|
-
constructor(options) {
|
|
1009
|
-
super(options);
|
|
1010
|
-
this.duration = import_core.Duration.from(options.duration);
|
|
1011
|
-
this.ignoreStartLevel = options.ignoreStartLevel;
|
|
1012
|
-
this.startLevel = options.startLevel ?? 0;
|
|
1013
|
-
this.direction = options.direction;
|
|
1014
|
-
this.colorComponent = options.colorComponent;
|
|
1015
|
-
}
|
|
1016
|
-
static from(raw, ctx) {
|
|
1017
|
-
(0, import_core.validatePayload)(raw.payload.length >= 3);
|
|
1018
|
-
const ignoreStartLevel = !!((raw.payload[0] & 32) >>> 5);
|
|
1019
|
-
const direction = (raw.payload[0] & 64) >>> 6 ? "down" : "up";
|
|
1020
|
-
const colorComponent = raw.payload[1];
|
|
1021
|
-
const startLevel = raw.payload[2];
|
|
1022
|
-
let duration;
|
|
1023
|
-
if (raw.payload.length >= 4) {
|
|
1024
|
-
duration = import_core.Duration.parseSet(raw.payload[3]);
|
|
1025
|
-
}
|
|
1026
|
-
return new ColorSwitchCCStartLevelChange_1({
|
|
1027
|
-
nodeId: ctx.sourceNodeId,
|
|
1028
|
-
ignoreStartLevel,
|
|
1029
|
-
direction,
|
|
1030
|
-
colorComponent,
|
|
1031
|
-
startLevel,
|
|
1032
|
-
duration
|
|
1033
|
-
});
|
|
1034
|
-
}
|
|
1035
|
-
duration;
|
|
1036
|
-
startLevel;
|
|
1037
|
-
ignoreStartLevel;
|
|
1038
|
-
direction;
|
|
1039
|
-
colorComponent;
|
|
1040
|
-
serialize(ctx) {
|
|
1041
|
-
const controlByte = import_Types.LevelChangeDirection[this.direction] << 6 | (this.ignoreStartLevel ? 32 : 0);
|
|
1042
|
-
this.payload = import_safe2.Bytes.from([
|
|
1043
|
-
controlByte,
|
|
1044
|
-
this.colorComponent,
|
|
1045
|
-
this.startLevel,
|
|
1046
|
-
(this.duration ?? import_core.Duration.default()).serializeSet()
|
|
1047
|
-
]);
|
|
1048
|
-
const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
|
|
1049
|
-
if (ccVersion < 3 && ctx.getDeviceConfig?.(this.nodeId)?.compat?.encodeCCsUsingTargetVersion) {
|
|
1050
|
-
this.payload = this.payload.subarray(0, -1);
|
|
1051
|
-
}
|
|
1052
|
-
return super.serialize(ctx);
|
|
1053
|
-
}
|
|
1054
|
-
toLogEntry(ctx) {
|
|
1055
|
-
const message = {
|
|
1056
|
-
"color component": (0, import_safe3.getEnumMemberName)(import_Types.ColorComponent, this.colorComponent),
|
|
1057
|
-
"start level": `${this.startLevel}${this.ignoreStartLevel ? " (ignored)" : ""}`,
|
|
1058
|
-
direction: this.direction
|
|
1059
|
-
};
|
|
1060
|
-
if (this.duration != void 0) {
|
|
1061
|
-
message.duration = this.duration.toString();
|
|
1124
|
+
};
|
|
1125
|
+
return ColorSwitchCCSet2 = _classThis;
|
|
1126
|
+
})();
|
|
1127
|
+
let ColorSwitchCCStartLevelChange = (() => {
|
|
1128
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ColorSwitchCommand.StartLevelChange), (0, import_CommandClassDecorators.useSupervision)()];
|
|
1129
|
+
let _classDescriptor;
|
|
1130
|
+
let _classExtraInitializers = [];
|
|
1131
|
+
let _classThis;
|
|
1132
|
+
let _classSuper = ColorSwitchCC;
|
|
1133
|
+
var ColorSwitchCCStartLevelChange2 = class extends _classSuper {
|
|
1134
|
+
static {
|
|
1135
|
+
_classThis = this;
|
|
1062
1136
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
serialize(ctx) {
|
|
1088
|
-
this.payload = import_safe2.Bytes.from([this.colorComponent]);
|
|
1089
|
-
return super.serialize(ctx);
|
|
1090
|
-
}
|
|
1091
|
-
toLogEntry(ctx) {
|
|
1092
|
-
return {
|
|
1093
|
-
...super.toLogEntry(ctx),
|
|
1094
|
-
message: {
|
|
1095
|
-
"color component": (0, import_safe3.getEnumMemberName)(import_Types.ColorComponent, this.colorComponent)
|
|
1137
|
+
static {
|
|
1138
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1139
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1140
|
+
ColorSwitchCCStartLevelChange2 = _classThis = _classDescriptor.value;
|
|
1141
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1142
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1143
|
+
}
|
|
1144
|
+
constructor(options) {
|
|
1145
|
+
super(options);
|
|
1146
|
+
this.duration = import_core.Duration.from(options.duration);
|
|
1147
|
+
this.ignoreStartLevel = options.ignoreStartLevel;
|
|
1148
|
+
this.startLevel = options.startLevel ?? 0;
|
|
1149
|
+
this.direction = options.direction;
|
|
1150
|
+
this.colorComponent = options.colorComponent;
|
|
1151
|
+
}
|
|
1152
|
+
static from(raw, ctx) {
|
|
1153
|
+
(0, import_core.validatePayload)(raw.payload.length >= 3);
|
|
1154
|
+
const ignoreStartLevel = !!((raw.payload[0] & 32) >>> 5);
|
|
1155
|
+
const direction = (raw.payload[0] & 64) >>> 6 ? "down" : "up";
|
|
1156
|
+
const colorComponent = raw.payload[1];
|
|
1157
|
+
const startLevel = raw.payload[2];
|
|
1158
|
+
let duration;
|
|
1159
|
+
if (raw.payload.length >= 4) {
|
|
1160
|
+
duration = import_core.Duration.parseSet(raw.payload[3]);
|
|
1096
1161
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1162
|
+
return new this({
|
|
1163
|
+
nodeId: ctx.sourceNodeId,
|
|
1164
|
+
ignoreStartLevel,
|
|
1165
|
+
direction,
|
|
1166
|
+
colorComponent,
|
|
1167
|
+
startLevel,
|
|
1168
|
+
duration
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
duration;
|
|
1172
|
+
startLevel;
|
|
1173
|
+
ignoreStartLevel;
|
|
1174
|
+
direction;
|
|
1175
|
+
colorComponent;
|
|
1176
|
+
serialize(ctx) {
|
|
1177
|
+
const controlByte = import_Types.LevelChangeDirection[this.direction] << 6 | (this.ignoreStartLevel ? 32 : 0);
|
|
1178
|
+
this.payload = import_safe2.Bytes.from([
|
|
1179
|
+
controlByte,
|
|
1180
|
+
this.colorComponent,
|
|
1181
|
+
this.startLevel,
|
|
1182
|
+
(this.duration ?? import_core.Duration.default()).serializeSet()
|
|
1183
|
+
]);
|
|
1184
|
+
const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
|
|
1185
|
+
if (ccVersion < 3 && ctx.getDeviceConfig?.(this.nodeId)?.compat?.encodeCCsUsingTargetVersion) {
|
|
1186
|
+
this.payload = this.payload.subarray(0, -1);
|
|
1187
|
+
}
|
|
1188
|
+
return super.serialize(ctx);
|
|
1189
|
+
}
|
|
1190
|
+
toLogEntry(ctx) {
|
|
1191
|
+
const message = {
|
|
1192
|
+
"color component": (0, import_safe3.getEnumMemberName)(import_Types.ColorComponent, this.colorComponent),
|
|
1193
|
+
"start level": `${this.startLevel}${this.ignoreStartLevel ? " (ignored)" : ""}`,
|
|
1194
|
+
direction: this.direction
|
|
1195
|
+
};
|
|
1196
|
+
if (this.duration != void 0) {
|
|
1197
|
+
message.duration = this.duration.toString();
|
|
1198
|
+
}
|
|
1199
|
+
return {
|
|
1200
|
+
...super.toLogEntry(ctx),
|
|
1201
|
+
message
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1205
|
+
return ColorSwitchCCStartLevelChange2 = _classThis;
|
|
1206
|
+
})();
|
|
1207
|
+
let ColorSwitchCCStopLevelChange = (() => {
|
|
1208
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ColorSwitchCommand.StopLevelChange), (0, import_CommandClassDecorators.useSupervision)()];
|
|
1209
|
+
let _classDescriptor;
|
|
1210
|
+
let _classExtraInitializers = [];
|
|
1211
|
+
let _classThis;
|
|
1212
|
+
let _classSuper = ColorSwitchCC;
|
|
1213
|
+
var ColorSwitchCCStopLevelChange2 = class extends _classSuper {
|
|
1214
|
+
static {
|
|
1215
|
+
_classThis = this;
|
|
1216
|
+
}
|
|
1217
|
+
static {
|
|
1218
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1219
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1220
|
+
ColorSwitchCCStopLevelChange2 = _classThis = _classDescriptor.value;
|
|
1221
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1222
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1223
|
+
}
|
|
1224
|
+
constructor(options) {
|
|
1225
|
+
super(options);
|
|
1226
|
+
this.colorComponent = options.colorComponent;
|
|
1227
|
+
}
|
|
1228
|
+
static from(raw, ctx) {
|
|
1229
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
1230
|
+
const colorComponent = raw.payload[0];
|
|
1231
|
+
return new this({
|
|
1232
|
+
nodeId: ctx.sourceNodeId,
|
|
1233
|
+
colorComponent
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
colorComponent;
|
|
1237
|
+
serialize(ctx) {
|
|
1238
|
+
this.payload = import_safe2.Bytes.from([this.colorComponent]);
|
|
1239
|
+
return super.serialize(ctx);
|
|
1240
|
+
}
|
|
1241
|
+
toLogEntry(ctx) {
|
|
1242
|
+
return {
|
|
1243
|
+
...super.toLogEntry(ctx),
|
|
1244
|
+
message: {
|
|
1245
|
+
"color component": (0, import_safe3.getEnumMemberName)(import_Types.ColorComponent, this.colorComponent)
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
};
|
|
1250
|
+
return ColorSwitchCCStopLevelChange2 = _classThis;
|
|
1251
|
+
})();
|
|
1104
1252
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1105
1253
|
0 && (module.exports = {
|
|
1106
1254
|
ColorSwitchCC,
|