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