@zwave-js/cc 15.27.1 → 15.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
- package/build/cjs/cc/AssociationCC.js +6 -5
- package/build/cjs/cc/AssociationCC.js.map +2 -2
- package/build/cjs/cc/AssociationGroupInfoCC.js +5 -5
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
- package/build/cjs/cc/BasicCC.d.ts +4 -1
- package/build/cjs/cc/BasicCC.js +18 -0
- package/build/cjs/cc/BasicCC.js.map +3 -3
- package/build/cjs/cc/BasicWindowCoveringCC.js.map +2 -2
- package/build/cjs/cc/BatteryCC.js +18 -4
- package/build/cjs/cc/BatteryCC.js.map +2 -2
- package/build/cjs/cc/BinarySensorCC.js +5 -1
- package/build/cjs/cc/BinarySensorCC.js.map +2 -2
- package/build/cjs/cc/BinarySwitchCC.d.ts +4 -1
- package/build/cjs/cc/BinarySwitchCC.js +18 -0
- package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
- package/build/cjs/cc/CRC16CC.d.ts +3 -2
- package/build/cjs/cc/CRC16CC.js +7 -1
- package/build/cjs/cc/CRC16CC.js.map +3 -3
- package/build/cjs/cc/CentralSceneCC.js.map +2 -2
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
- package/build/cjs/cc/ClockCC.js.map +2 -2
- package/build/cjs/cc/ColorSwitchCC.js +1 -4
- package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
- package/build/cjs/cc/ConfigurationCC.js +16 -8
- package/build/cjs/cc/ConfigurationCC.js.map +2 -2
- package/build/cjs/cc/DeviceResetLocallyCC.js.map +2 -2
- package/build/cjs/cc/DoorLockCC.js +1 -1
- package/build/cjs/cc/DoorLockCC.js.map +2 -2
- package/build/cjs/cc/EntryControlCC.js.map +2 -2
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +4 -16
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlSetpointCC.js +10 -4
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.js +5 -8
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/IrrigationCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.d.ts +1 -0
- package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.js +13 -0
- package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.d.ts +6 -4
- package/build/cjs/cc/ManufacturerSpecificCC.js +41 -8
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
- package/build/cjs/cc/MeterCC.js +18 -29
- package/build/cjs/cc/MeterCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelAssociationCC.js +11 -7
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelCC.d.ts +3 -1
- package/build/cjs/cc/MultiChannelCC.js +21 -10
- package/build/cjs/cc/MultiChannelCC.js.map +3 -3
- package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSwitchCC.d.ts +5 -1
- package/build/cjs/cc/MultilevelSwitchCC.js +30 -0
- package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
- package/build/cjs/cc/NotificationCC.js +29 -11
- package/build/cjs/cc/NotificationCC.js.map +2 -2
- package/build/cjs/cc/PowerlevelCC.js.map +1 -1
- package/build/cjs/cc/ProtectionCC.js +2 -0
- package/build/cjs/cc/ProtectionCC.js.map +2 -2
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
- package/build/cjs/cc/Security2CC.d.ts +2 -1
- package/build/cjs/cc/Security2CC.js +31 -3
- package/build/cjs/cc/Security2CC.js.map +2 -2
- package/build/cjs/cc/SecurityCC.d.ts +3 -2
- package/build/cjs/cc/SecurityCC.js +7 -6
- package/build/cjs/cc/SecurityCC.js.map +2 -2
- package/build/cjs/cc/SoundSwitchCC.js +6 -6
- package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
- package/build/cjs/cc/SupervisionCC.d.ts +2 -1
- package/build/cjs/cc/SupervisionCC.js +6 -0
- package/build/cjs/cc/SupervisionCC.js.map +3 -3
- package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatModeCC.js +1 -3
- package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetpointCC.d.ts +4 -1
- package/build/cjs/cc/ThermostatSetpointCC.js +18 -0
- package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
- package/build/cjs/cc/TimeCC.js.map +2 -2
- package/build/cjs/cc/TransportServiceCC.js.map +2 -2
- package/build/cjs/cc/UserCodeCC.js +3 -6
- package/build/cjs/cc/UserCodeCC.js.map +2 -2
- package/build/cjs/cc/UserCredentialCC.js +8 -6
- package/build/cjs/cc/UserCredentialCC.js.map +2 -2
- package/build/cjs/cc/VersionCC.js.map +2 -2
- package/build/cjs/cc/WindowCoveringCC.js +5 -1
- package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
- package/build/cjs/cc/ZWaveProtocolCC.js +3 -11
- package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
- package/build/cjs/cc/_CCValues.generated.d.ts +4 -4
- package/build/cjs/cc/_CCValues.generated.js +1 -1
- package/build/cjs/cc/_CCValues.generated.js.map +2 -2
- package/build/cjs/cc/index.d.ts +179 -179
- package/build/cjs/cc/index.js.map +1 -1
- package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +2 -2
- package/build/cjs/lib/API.d.ts +3 -2
- package/build/cjs/lib/API.js.map +2 -2
- package/build/cjs/lib/CommandClass.d.ts +23 -1
- package/build/cjs/lib/CommandClass.js +63 -15
- package/build/cjs/lib/CommandClass.js.map +3 -3
- package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
- package/build/cjs/lib/EncapsulatingCommandClass.js.map +2 -2
- package/build/cjs/lib/NotificationEventPayload.js.map +2 -2
- package/build/cjs/lib/Security2/Extension.js +1 -4
- package/build/cjs/lib/Security2/Extension.js.map +2 -2
- package/build/cjs/lib/Security2/shared.js.map +2 -2
- package/build/cjs/lib/SetValueResult.js.map +1 -1
- package/build/cjs/lib/Values.d.ts +1 -1
- package/build/cjs/lib/Values.js.map +2 -2
- package/build/cjs/lib/_CCAPI.generated.js.map +1 -1
- package/build/cjs/lib/_Types.d.ts +34 -30
- package/build/cjs/lib/_Types.js +7 -0
- package/build/cjs/lib/_Types.js.map +3 -3
- package/build/cjs/lib/serializers.js +1 -4
- package/build/cjs/lib/serializers.js.map +2 -2
- package/build/cjs/lib/utils.js.map +2 -2
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +1 -2
- 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 +8 -7
- 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 +11 -12
- 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 +10 -9
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.d.ts +4 -1
- package/build/esm/cc/BasicCC.d.ts.map +1 -1
- package/build/esm/cc/BasicCC.js +30 -7
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BasicWindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/BasicWindowCoveringCC.js +2 -5
- package/build/esm/cc/BasicWindowCoveringCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +17 -14
- 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 +12 -7
- package/build/esm/cc/BinarySensorCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.d.ts +4 -1
- package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +31 -6
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CRC16CC.d.ts +3 -2
- package/build/esm/cc/CRC16CC.d.ts.map +1 -1
- package/build/esm/cc/CRC16CC.js +10 -4
- 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 +2 -1
- 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 +6 -2
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.d.ts.map +1 -1
- package/build/esm/cc/ClockCC.js +6 -2
- 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 +17 -20
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +37 -33
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.d.ts.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.js +1 -2
- 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 +26 -30
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +10 -7
- 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 +15 -27
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +8 -9
- package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +27 -42
- 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 +8 -6
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js +1 -2
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts +1 -0
- package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC._validateArgs.js +10 -0
- package/build/esm/cc/ManufacturerSpecificCC._validateArgs.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.d.ts +6 -4
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +54 -17
- 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 +28 -38
- 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 +15 -20
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts +3 -1
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +28 -22
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +11 -11
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts +5 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +56 -16
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +66 -55
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/PowerlevelCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +13 -9
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +5 -8
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +10 -16
- 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 +13 -20
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.d.ts +2 -1
- package/build/esm/cc/Security2CC.d.ts.map +1 -1
- package/build/esm/cc/Security2CC.js +68 -32
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.d.ts +3 -2
- package/build/esm/cc/SecurityCC.d.ts.map +1 -1
- package/build/esm/cc/SecurityCC.js +16 -11
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +2 -2
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.d.ts +2 -1
- package/build/esm/cc/SupervisionCC.d.ts.map +1 -1
- package/build/esm/cc/SupervisionCC.js +13 -6
- 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 +1 -2
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +1 -3
- 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 +1 -2
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts +4 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +31 -19
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TimeCC.d.ts.map +1 -1
- package/build/esm/cc/TimeCC.js +6 -2
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +8 -8
- 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 +23 -30
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
- package/build/esm/cc/UserCredentialCC.js +49 -60
- package/build/esm/cc/UserCredentialCC.js.map +1 -1
- package/build/esm/cc/VersionCC.js +3 -3
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +10 -9
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js +5 -26
- package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/esm/cc/_CCValues.generated.d.ts +4 -4
- package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
- package/build/esm/cc/_CCValues.generated.js +638 -679
- package/build/esm/cc/_CCValues.generated.js.map +1 -1
- package/build/esm/cc/index.d.ts +179 -179
- package/build/esm/cc/index.d.ts.map +1 -1
- package/build/esm/cc/index.js +124 -124
- package/build/esm/cc/index.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
- package/build/esm/cc/manufacturerProprietary/Decorators.js.map +1 -1
- package/build/esm/lib/API.d.ts +3 -2
- package/build/esm/lib/API.d.ts.map +1 -1
- package/build/esm/lib/API.js +1 -1
- package/build/esm/lib/API.js.map +1 -1
- package/build/esm/lib/CommandClass.d.ts +23 -1
- package/build/esm/lib/CommandClass.d.ts.map +1 -1
- package/build/esm/lib/CommandClass.js +61 -20
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
- package/build/esm/lib/CommandClassDecorators.js +1 -2
- package/build/esm/lib/CommandClassDecorators.js.map +1 -1
- package/build/esm/lib/EncapsulatingCommandClass.d.ts.map +1 -1
- package/build/esm/lib/EncapsulatingCommandClass.js.map +1 -1
- package/build/esm/lib/NotificationEventPayload.d.ts.map +1 -1
- package/build/esm/lib/NotificationEventPayload.js.map +1 -1
- package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
- package/build/esm/lib/Security2/Extension.js +2 -6
- package/build/esm/lib/Security2/Extension.js.map +1 -1
- package/build/esm/lib/Security2/shared.d.ts.map +1 -1
- package/build/esm/lib/Security2/shared.js.map +1 -1
- package/build/esm/lib/SetValueResult.d.ts.map +1 -1
- package/build/esm/lib/Values.d.ts +1 -1
- package/build/esm/lib/Values.d.ts.map +1 -1
- package/build/esm/lib/Values.js.map +1 -1
- package/build/esm/lib/_CCAPI.generated.d.ts.map +1 -1
- package/build/esm/lib/_Types.d.ts +34 -30
- package/build/esm/lib/_Types.d.ts.map +1 -1
- package/build/esm/lib/_Types.js +5 -0
- package/build/esm/lib/_Types.js.map +1 -1
- package/build/esm/lib/serializers.d.ts.map +1 -1
- package/build/esm/lib/serializers.js +1 -4
- package/build/esm/lib/serializers.js.map +1 -1
- package/build/esm/lib/traits.d.ts.map +1 -1
- package/build/esm/lib/utils.d.ts.map +1 -1
- package/build/esm/lib/utils.js +25 -31
- package/build/esm/lib/utils.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src_gen/cc/CentralSceneCC.ts"],
|
|
4
|
-
"sourcesContent": ["import * as __validateArgs from \"./CentralSceneCC._validateArgs.js\";\nconst { validateArgs_CentralSceneCCAPI_setConfiguration } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, enumValuesToMetadataStates, getCCName, logDict, logList, logText, maybeUnknownToString, parseBitMask, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { CentralSceneCommand, CentralSceneKeys } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { CentralSceneCCValues } from \"./_CCValues.generated.js\";\nexport { CentralSceneCCValues };\n@API(CommandClasses[\"Central Scene\"])\nexport class CentralSceneCCAPI extends CCAPI {\n public supportsCommand(cmd: CentralSceneCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case CentralSceneCommand.SupportedGet:\n return this.isSinglecast(); // this is mandatory\n case CentralSceneCommand.ConfigurationGet:\n return this.version >= 3 && this.isSinglecast();\n case CentralSceneCommand.ConfigurationSet:\n return this.version >= 3;\n }\n return super.supportsCommand(cmd);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupported() {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.SupportedGet);\n const cc = new CentralSceneCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<CentralSceneCCSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"sceneCount\",\n \"supportsSlowRefresh\",\n \"supportedKeyAttributes\",\n ]);\n }\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getConfiguration() {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.ConfigurationGet);\n const cc = new CentralSceneCCConfigurationGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<CentralSceneCCConfigurationReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"slowRefresh\"]);\n }\n }\n @validateArgs_CentralSceneCCAPI_setConfiguration()\n public async setConfiguration(slowRefresh: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.ConfigurationSet);\n const cc = new CentralSceneCCConfigurationSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n slowRefresh,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: CentralSceneCCAPI, { property }, value) {\n if (property !== \"slowRefresh\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof value !== \"boolean\") {\n throwWrongValueType(this.ccId, property, \"boolean\", typeof value);\n }\n return this.setConfiguration(value);\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: CentralSceneCCAPI, { property }) {\n if (property === \"slowRefresh\") {\n return (await this.getConfiguration())?.[property];\n }\n throwUnsupportedProperty(this.ccId, property);\n };\n }\n}\n@commandClass(CommandClasses[\"Central Scene\"])\n@implementedVersion(3)\n@ccValues(CentralSceneCCValues)\nexport class CentralSceneCC extends CommandClass {\n declare ccCommand: CentralSceneCommand;\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n CommandClasses[\"Multi Channel Association\"],\n CommandClasses[\"Association Group Information\"],\n ];\n }\n public skipEndpointInterview(): boolean {\n // Central scene notifications are issued by the root device\n return true;\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Central Scene\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // If one Association group issues CentralScene notifications,\n // we must associate ourselves with that channel\n try {\n await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, CentralSceneCommand.Notification);\n }\n catch {\n ctx.logNode(node.id, {\n endpoint: endpoint.index,\n message: `Configuring associations to receive ${getCCName(this.ccId)} commands failed!`,\n level: \"warn\",\n });\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported scenes...\",\n direction: \"outbound\",\n });\n const ccSupported = await api.getSupported();\n if (ccSupported) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(\"received supported scenes:\", {\n nested: logDict({\n \"# of scenes\": ccSupported.sceneCount,\n \"supports slow refresh\": ccSupported.supportsSlowRefresh,\n }),\n }),\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported scenes timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n // The slow refresh capability should be enabled whenever possible\n if (api.version >= 3 && ccSupported?.supportsSlowRefresh) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Enabling slow refresh capability...\",\n direction: \"outbound\",\n });\n await api.setConfiguration(true);\n }\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n}\n// @publicAPI\nexport interface CentralSceneCCNotificationOptions {\n sequenceNumber: number;\n keyAttribute: CentralSceneKeys;\n sceneNumber: number;\n slowRefresh?: boolean;\n}\n@CCCommand(CentralSceneCommand.Notification)\nexport class CentralSceneCCNotification extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCNotificationOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sequenceNumber = options.sequenceNumber;\n this.keyAttribute = options.keyAttribute;\n this.sceneNumber = options.sceneNumber;\n this.slowRefresh = options.slowRefresh;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCNotification {\n validatePayload(raw.payload.length >= 3);\n const sequenceNumber = raw.payload[0];\n const keyAttribute: CentralSceneKeys = raw.payload[1] & 0b111;\n const sceneNumber = raw.payload[2];\n let slowRefresh: boolean | undefined;\n if (keyAttribute === CentralSceneKeys.KeyHeldDown) {\n // A receiving node MUST ignore this field if the command is not\n // carrying the Key Held Down key attribute.\n slowRefresh = !!(raw.payload[1] & 128);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n sequenceNumber,\n keyAttribute,\n sceneNumber,\n slowRefresh,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // In case the interview is not yet completed, we still create some basic metadata\n const sceneValue = CentralSceneCCValues.scene(this.sceneNumber);\n // Get device configuration to check for custom scene labels\n const sceneConfig = ctx.getDeviceConfig?.(this.nodeId as number)\n ?.scenes?.get(this.sceneNumber);\n if (sceneConfig) {\n // Ensure metadata with custom label and description\n this.ensureMetadata(ctx, sceneValue, {\n ...sceneValue.meta,\n label: sceneConfig.label,\n description: sceneConfig.description,\n });\n }\n else {\n // Use default metadata\n this.ensureMetadata(ctx, sceneValue);\n }\n // The spec behavior is pretty complicated, so we cannot just store\n // the value and call it a day. Handling of these notifications will\n // happen in the receiving node class\n return true;\n }\n public readonly sequenceNumber: number;\n public readonly keyAttribute: CentralSceneKeys;\n public readonly sceneNumber: number;\n public readonly slowRefresh: boolean | undefined;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"sequence number\": this.sequenceNumber,\n \"key attribute\": getEnumMemberName(CentralSceneKeys, this.keyAttribute),\n \"scene number\": this.sceneNumber,\n };\n if (this.slowRefresh != undefined) {\n message[\"slow refresh\"] = this.slowRefresh;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface CentralSceneCCSupportedReportOptions {\n sceneCount: number;\n supportsSlowRefresh: MaybeNotKnown<boolean>;\n supportedKeyAttributes: Record<number, readonly CentralSceneKeys[]>;\n}\n@CCCommand(CentralSceneCommand.SupportedReport)\n@ccValueProperty(\"sceneCount\", CentralSceneCCValues.sceneCount)\n@ccValueProperty(\"supportsSlowRefresh\", CentralSceneCCValues.supportsSlowRefresh)\n@ccValueProperty(\"supportedKeyAttributes\", CentralSceneCCValues.supportedKeyAttributes)\nexport class CentralSceneCCSupportedReport extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCSupportedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sceneCount = options.sceneCount;\n this.supportsSlowRefresh = options.supportsSlowRefresh;\n for (const [scene, keys] of Object.entries(options.supportedKeyAttributes)) {\n this._supportedKeyAttributes.set(parseInt(scene), keys);\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCSupportedReport {\n validatePayload(raw.payload.length >= 2);\n const sceneCount = raw.payload[0];\n const supportsSlowRefresh: MaybeNotKnown<boolean> = !!(raw.payload[1] & 128);\n const bitMaskBytes = (raw.payload[1] & 0b110) >>> 1;\n const identicalKeyAttributes = !!(raw.payload[1] & 0b1);\n const numEntries = identicalKeyAttributes ? 1 : sceneCount;\n validatePayload(raw.payload.length >= 2 + bitMaskBytes * numEntries);\n const supportedKeyAttributes: Record<number, readonly CentralSceneKeys[]> = {};\n for (let i = 0; i < numEntries; i++) {\n const mask = raw.payload.subarray(2 + i * bitMaskBytes, 2 + (i + 1) * bitMaskBytes);\n supportedKeyAttributes[i + 1] = parseBitMask(mask, CentralSceneKeys.KeyPressed);\n }\n if (identicalKeyAttributes) {\n // The key attributes are only transmitted for scene 1, copy them to the others\n for (let i = 2; i <= sceneCount; i++) {\n supportedKeyAttributes[i] = supportedKeyAttributes[1];\n }\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n sceneCount,\n supportsSlowRefresh,\n supportedKeyAttributes,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Get device configuration to check for custom scene labels\n const deviceConfig = ctx.getDeviceConfig?.(this.nodeId as number);\n // Create/extend metadata for all scenes\n for (let i = 1; i <= this.sceneCount; i++) {\n const sceneValue = CentralSceneCCValues.scene(i);\n const sceneMetadata = { ...sceneValue.meta };\n // Check if there's a custom configuration for this scene\n const sceneConfig = deviceConfig?.scenes?.get(i);\n if (sceneConfig) {\n // @ts-expect-error The label type is a literal\n sceneMetadata.label = sceneConfig.label;\n }\n if (sceneConfig?.description) {\n // @ts-expect-error The predefined metadata has no description\n sceneMetadata.description = sceneConfig.description;\n }\n this.setMetadata(ctx, sceneValue, {\n ...sceneMetadata,\n states: enumValuesToMetadataStates(CentralSceneKeys, this._supportedKeyAttributes.get(i)),\n });\n }\n return true;\n }\n public readonly sceneCount: number;\n // TODO: Only offer `slowRefresh` if this is true\n public readonly supportsSlowRefresh: MaybeNotKnown<boolean>;\n private _supportedKeyAttributes = new Map<number, readonly CentralSceneKeys[]>();\n public get supportedKeyAttributes(): ReadonlyMap<number, readonly CentralSceneKeys[]> {\n return this._supportedKeyAttributes;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"scene count\": this.sceneCount,\n \"supports slow refresh\": maybeUnknownToString(this.supportsSlowRefresh),\n };\n for (const [scene, keys] of this.supportedKeyAttributes) {\n message[`supported attributes (scene #${scene})`] = logList(keys.map((k) => getEnumMemberName(CentralSceneKeys, k)));\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(CentralSceneCommand.SupportedGet)\n@expectedCCResponse(CentralSceneCCSupportedReport)\nexport class CentralSceneCCSupportedGet extends CentralSceneCC {\n}\n// @publicAPI\nexport interface CentralSceneCCConfigurationReportOptions {\n slowRefresh: boolean;\n}\n@CCCommand(CentralSceneCommand.ConfigurationReport)\n@ccValueProperty(\"slowRefresh\", CentralSceneCCValues.slowRefresh)\nexport class CentralSceneCCConfigurationReport extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCConfigurationReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.slowRefresh = options.slowRefresh;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCConfigurationReport {\n validatePayload(raw.payload.length >= 1);\n const slowRefresh = !!(raw.payload[0] & 128);\n return new this({\n nodeId: ctx.sourceNodeId,\n slowRefresh,\n });\n }\n public readonly slowRefresh: boolean;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"slow refresh\": this.slowRefresh },\n };\n }\n}\n@CCCommand(CentralSceneCommand.ConfigurationGet)\n@expectedCCResponse(CentralSceneCCConfigurationReport)\nexport class CentralSceneCCConfigurationGet extends CentralSceneCC {\n}\n// @publicAPI\nexport interface CentralSceneCCConfigurationSetOptions {\n slowRefresh: boolean;\n}\n@CCCommand(CentralSceneCommand.ConfigurationSet)\n@useSupervision()\nexport class CentralSceneCCConfigurationSet extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCConfigurationSetOptions>) {\n super(options);\n this.slowRefresh = options.slowRefresh;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): CentralSceneCCConfigurationSet {\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new CentralSceneCCConfigurationSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public slowRefresh: boolean;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.slowRefresh ? 128 : 0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"slow refresh\": this.slowRefresh },\n };\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAiV;AACjV,oBAA+C;AAC/C,iBAAwJ;AACxJ,0BAA4F;AAC5F,oCAAiI;AAEjI,mBAAsD;AAEtD,cAAyB;AACzB,gCAAqC;AAVrC,MAAM,EAAE,gDAA+C,IAAK;IAa/C,qBAAiB,MAAA;8BAD7B,mCAAI,2BAAe,eAAe,CAAC,CAAC;;;;oB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AAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAAuD;AACtE,YAAM,OAAO;AAEb,WAAK,iBAAiB,QAAQ;AAC9B,WAAK,eAAe,QAAQ;AAC5B,WAAK,cAAc,QAAQ;AAC3B,WAAK,cAAc,QAAQ;IAC/B;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,iBAAiB,IAAI,QAAQ,CAAC;AACpC,YAAM,eAAiC,IAAI,QAAQ,CAAC,IAAI;AACxD,YAAM,cAAc,IAAI,QAAQ,CAAC;AACjC,UAAI;AACJ,UAAI,iBAAiB,8BAAiB,aAAa;AAG/C,sBAAc,CAAC,EAAE,IAAI,QAAQ,CAAC,IAAI;MACtC;AACA,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ;QACA;QACA;QACA;OACH;IACL;IACO,cAAc,KAAyB;AAC1C,UAAI,CAAC,MAAM,cAAc,GAAG;AACxB,eAAO;AAEX,YAAM,aAAa,+CAAqB,MAAM,KAAK,WAAW;AAE9D,YAAM,cAAc,
|
|
4
|
+
"sourcesContent": ["import * as __validateArgs from \"./CentralSceneCC._validateArgs.js\";\nconst { validateArgs_CentralSceneCCAPI_setConfiguration } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, enumValuesToMetadataStates, getCCName, logDict, logList, logText, maybeUnknownToString, parseBitMask, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { CentralSceneCommand, CentralSceneKeys } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { CentralSceneCCValues } from \"./_CCValues.generated.js\";\nexport { CentralSceneCCValues };\n@API(CommandClasses[\"Central Scene\"])\nexport class CentralSceneCCAPI extends CCAPI {\n public supportsCommand(cmd: CentralSceneCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case CentralSceneCommand.SupportedGet:\n return this.isSinglecast(); // this is mandatory\n case CentralSceneCommand.ConfigurationGet:\n return this.version >= 3 && this.isSinglecast();\n case CentralSceneCommand.ConfigurationSet:\n return this.version >= 3;\n }\n return super.supportsCommand(cmd);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupported() {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.SupportedGet);\n const cc = new CentralSceneCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<CentralSceneCCSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"sceneCount\",\n \"supportsSlowRefresh\",\n \"supportedKeyAttributes\",\n ]);\n }\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getConfiguration() {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.ConfigurationGet);\n const cc = new CentralSceneCCConfigurationGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<CentralSceneCCConfigurationReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"slowRefresh\"]);\n }\n }\n @validateArgs_CentralSceneCCAPI_setConfiguration()\n public async setConfiguration(slowRefresh: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.ConfigurationSet);\n const cc = new CentralSceneCCConfigurationSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n slowRefresh,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: CentralSceneCCAPI, { property }, value) {\n if (property !== \"slowRefresh\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof value !== \"boolean\") {\n throwWrongValueType(this.ccId, property, \"boolean\", typeof value);\n }\n return this.setConfiguration(value);\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: CentralSceneCCAPI, { property }) {\n if (property === \"slowRefresh\") {\n return (await this.getConfiguration())?.[property];\n }\n throwUnsupportedProperty(this.ccId, property);\n };\n }\n}\n@commandClass(CommandClasses[\"Central Scene\"])\n@implementedVersion(3)\n@ccValues(CentralSceneCCValues)\nexport class CentralSceneCC extends CommandClass {\n declare ccCommand: CentralSceneCommand;\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n CommandClasses[\"Multi Channel Association\"],\n CommandClasses[\"Association Group Information\"],\n ];\n }\n public skipEndpointInterview(): boolean {\n // Central scene notifications are issued by the root device\n return true;\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Central Scene\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // If one Association group issues CentralScene notifications,\n // we must associate ourselves with that channel\n try {\n await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, CentralSceneCommand.Notification);\n }\n catch {\n ctx.logNode(node.id, {\n endpoint: endpoint.index,\n message: `Configuring associations to receive ${getCCName(this.ccId)} commands failed!`,\n level: \"warn\",\n });\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported scenes...\",\n direction: \"outbound\",\n });\n const ccSupported = await api.getSupported();\n if (ccSupported) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(\"received supported scenes:\", {\n nested: logDict({\n \"# of scenes\": ccSupported.sceneCount,\n \"supports slow refresh\": ccSupported.supportsSlowRefresh,\n }),\n }),\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported scenes timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n // The slow refresh capability should be enabled whenever possible\n if (api.version >= 3 && ccSupported?.supportsSlowRefresh) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Enabling slow refresh capability...\",\n direction: \"outbound\",\n });\n await api.setConfiguration(true);\n }\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n}\n// @publicAPI\nexport interface CentralSceneCCNotificationOptions {\n sequenceNumber: number;\n keyAttribute: CentralSceneKeys;\n sceneNumber: number;\n slowRefresh?: boolean;\n}\n@CCCommand(CentralSceneCommand.Notification)\nexport class CentralSceneCCNotification extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCNotificationOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sequenceNumber = options.sequenceNumber;\n this.keyAttribute = options.keyAttribute;\n this.sceneNumber = options.sceneNumber;\n this.slowRefresh = options.slowRefresh;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCNotification {\n validatePayload(raw.payload.length >= 3);\n const sequenceNumber = raw.payload[0];\n const keyAttribute: CentralSceneKeys = raw.payload[1] & 0b111;\n const sceneNumber = raw.payload[2];\n let slowRefresh: boolean | undefined;\n if (keyAttribute === CentralSceneKeys.KeyHeldDown) {\n // A receiving node MUST ignore this field if the command is not\n // carrying the Key Held Down key attribute.\n slowRefresh = !!(raw.payload[1] & 128);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n sequenceNumber,\n keyAttribute,\n sceneNumber,\n slowRefresh,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // In case the interview is not yet completed, we still create some basic metadata\n const sceneValue = CentralSceneCCValues.scene(this.sceneNumber);\n // Get device configuration to check for custom scene labels\n const sceneConfig = ctx\n .getDeviceConfig?.(this.nodeId as number)\n ?.scenes?.get(this.sceneNumber);\n if (sceneConfig) {\n // Ensure metadata with custom label and description\n this.ensureMetadata(ctx, sceneValue, {\n ...sceneValue.meta,\n label: sceneConfig.label,\n description: sceneConfig.description,\n });\n }\n else {\n // Use default metadata\n this.ensureMetadata(ctx, sceneValue);\n }\n // The spec behavior is pretty complicated, so we cannot just store\n // the value and call it a day. Handling of these notifications will\n // happen in the receiving node class\n return true;\n }\n public readonly sequenceNumber: number;\n public readonly keyAttribute: CentralSceneKeys;\n public readonly sceneNumber: number;\n public readonly slowRefresh: boolean | undefined;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"sequence number\": this.sequenceNumber,\n \"key attribute\": getEnumMemberName(CentralSceneKeys, this.keyAttribute),\n \"scene number\": this.sceneNumber,\n };\n if (this.slowRefresh != undefined) {\n message[\"slow refresh\"] = this.slowRefresh;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface CentralSceneCCSupportedReportOptions {\n sceneCount: number;\n supportsSlowRefresh: MaybeNotKnown<boolean>;\n supportedKeyAttributes: Record<number, readonly CentralSceneKeys[]>;\n}\n@CCCommand(CentralSceneCommand.SupportedReport)\n@ccValueProperty(\"sceneCount\", CentralSceneCCValues.sceneCount)\n@ccValueProperty(\"supportsSlowRefresh\", CentralSceneCCValues.supportsSlowRefresh)\n@ccValueProperty(\"supportedKeyAttributes\", CentralSceneCCValues.supportedKeyAttributes)\nexport class CentralSceneCCSupportedReport extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCSupportedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sceneCount = options.sceneCount;\n this.supportsSlowRefresh = options.supportsSlowRefresh;\n for (const [scene, keys] of Object.entries(options.supportedKeyAttributes)) {\n this._supportedKeyAttributes.set(parseInt(scene), keys);\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCSupportedReport {\n validatePayload(raw.payload.length >= 2);\n const sceneCount = raw.payload[0];\n const supportsSlowRefresh: MaybeNotKnown<boolean> = !!(raw.payload[1] & 128);\n const bitMaskBytes = (raw.payload[1] & 0b110) >>> 1;\n const identicalKeyAttributes = !!(raw.payload[1] & 0b1);\n const numEntries = identicalKeyAttributes ? 1 : sceneCount;\n validatePayload(raw.payload.length >= 2 + bitMaskBytes * numEntries);\n const supportedKeyAttributes: Record<number, readonly CentralSceneKeys[]> = {};\n for (let i = 0; i < numEntries; i++) {\n const mask = raw.payload.subarray(2 + i * bitMaskBytes, 2 + (i + 1) * bitMaskBytes);\n supportedKeyAttributes[i + 1] = parseBitMask(mask, CentralSceneKeys.KeyPressed);\n }\n if (identicalKeyAttributes) {\n // The key attributes are only transmitted for scene 1, copy them to the others\n for (let i = 2; i <= sceneCount; i++) {\n supportedKeyAttributes[i] = supportedKeyAttributes[1];\n }\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n sceneCount,\n supportsSlowRefresh,\n supportedKeyAttributes,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Get device configuration to check for custom scene labels\n const deviceConfig = ctx.getDeviceConfig?.(this.nodeId as number);\n // Create/extend metadata for all scenes\n for (let i = 1; i <= this.sceneCount; i++) {\n const sceneValue = CentralSceneCCValues.scene(i);\n const sceneMetadata = { ...sceneValue.meta };\n // Check if there's a custom configuration for this scene\n const sceneConfig = deviceConfig?.scenes?.get(i);\n if (sceneConfig) {\n // @ts-expect-error The label type is a literal\n sceneMetadata.label = sceneConfig.label;\n }\n if (sceneConfig?.description) {\n // @ts-expect-error The predefined metadata has no description\n sceneMetadata.description = sceneConfig.description;\n }\n this.setMetadata(ctx, sceneValue, {\n ...sceneMetadata,\n states: enumValuesToMetadataStates(CentralSceneKeys, this._supportedKeyAttributes.get(i)),\n });\n }\n return true;\n }\n public readonly sceneCount: number;\n // TODO: Only offer `slowRefresh` if this is true\n public readonly supportsSlowRefresh: MaybeNotKnown<boolean>;\n private _supportedKeyAttributes = new Map<number, readonly CentralSceneKeys[]>();\n public get supportedKeyAttributes(): ReadonlyMap<number, readonly CentralSceneKeys[]> {\n return this._supportedKeyAttributes;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"scene count\": this.sceneCount,\n \"supports slow refresh\": maybeUnknownToString(this.supportsSlowRefresh),\n };\n for (const [scene, keys] of this.supportedKeyAttributes) {\n message[`supported attributes (scene #${scene})`] = logList(keys.map((k) => getEnumMemberName(CentralSceneKeys, k)));\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(CentralSceneCommand.SupportedGet)\n@expectedCCResponse(CentralSceneCCSupportedReport)\nexport class CentralSceneCCSupportedGet extends CentralSceneCC {\n}\n// @publicAPI\nexport interface CentralSceneCCConfigurationReportOptions {\n slowRefresh: boolean;\n}\n@CCCommand(CentralSceneCommand.ConfigurationReport)\n@ccValueProperty(\"slowRefresh\", CentralSceneCCValues.slowRefresh)\nexport class CentralSceneCCConfigurationReport extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCConfigurationReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.slowRefresh = options.slowRefresh;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCConfigurationReport {\n validatePayload(raw.payload.length >= 1);\n const slowRefresh = !!(raw.payload[0] & 128);\n return new this({\n nodeId: ctx.sourceNodeId,\n slowRefresh,\n });\n }\n public readonly slowRefresh: boolean;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"slow refresh\": this.slowRefresh },\n };\n }\n}\n@CCCommand(CentralSceneCommand.ConfigurationGet)\n@expectedCCResponse(CentralSceneCCConfigurationReport)\nexport class CentralSceneCCConfigurationGet extends CentralSceneCC {\n}\n// @publicAPI\nexport interface CentralSceneCCConfigurationSetOptions {\n slowRefresh: boolean;\n}\n@CCCommand(CentralSceneCommand.ConfigurationSet)\n@useSupervision()\nexport class CentralSceneCCConfigurationSet extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCConfigurationSetOptions>) {\n super(options);\n this.slowRefresh = options.slowRefresh;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): CentralSceneCCConfigurationSet {\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new CentralSceneCCConfigurationSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public slowRefresh: boolean;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.slowRefresh ? 128 : 0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"slow refresh\": this.slowRefresh },\n };\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAiV;AACjV,oBAA+C;AAC/C,iBAAwJ;AACxJ,0BAA4F;AAC5F,oCAAiI;AAEjI,mBAAsD;AAEtD,cAAyB;AACzB,gCAAqC;AAVrC,MAAM,EAAE,gDAA+C,IAAK;IAa/C,qBAAiB,MAAA;8BAD7B,mCAAI,2BAAe,eAAe,CAAC,CAAC;;;;oBACE;;;yCAAA,YAAK;WAAA;;;;;;;;AAyCxC,qCAAA,MAAA,MAAA,8BAAA,EAAA,MAAA,UAAA,MAAA,o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AACb,WAAK,cAAc,QAAQ;IAC/B;IACO,OAAO,KAAK,MAAa,MAAsB;AAClD,YAAM,IAAI,uBAAW,GAAG,KAAK,IAAI,qCAAqC,4BAAgB,8BAA8B;IAIxH;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,cAAc,MAAM,CAAC,CAAC;AACtD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,gBAAgB,KAAK,YAAW;;IAEnD;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src_gen/cc/ClimateControlScheduleCC.ts"],
|
|
4
|
-
"sourcesContent": ["import * as __validateArgs from \"./ClimateControlScheduleCC._validateArgs.js\";\nconst { validateArgs_ClimateControlScheduleCCAPI_set, validateArgs_ClimateControlScheduleCCAPI_get, validateArgs_ClimateControlScheduleCCAPI_setOverride } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, enumValuesToMetadataStates, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName } from \"@zwave-js/shared\";\nimport { CCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ClimateControlScheduleCommand, ScheduleOverrideType, type SetbackState, type Switchpoint, Weekday, } from \"../lib/_Types.js\";\nimport { decodeSetbackState, decodeSwitchpoint, encodeSetbackState, encodeSwitchpoint, } from \"../lib/serializers.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ClimateControlScheduleCCValues } from \"./_CCValues.generated.js\";\nexport { ClimateControlScheduleCCValues };\n@API(CommandClasses[\"Climate Control Schedule\"])\nexport class ClimateControlScheduleCCAPI extends CCAPI {\n public supportsCommand(cmd: ClimateControlScheduleCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ClimateControlScheduleCommand.Set:\n case ClimateControlScheduleCommand.OverrideSet:\n return true; // mandatory\n case ClimateControlScheduleCommand.Get:\n case ClimateControlScheduleCommand.ChangedGet:\n case ClimateControlScheduleCommand.OverrideGet:\n return this.isSinglecast();\n }\n return super.supportsCommand(cmd);\n }\n @validateArgs_ClimateControlScheduleCCAPI_set()\n public async set(weekday: Weekday, switchPoints: Switchpoint[]): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ClimateControlScheduleCommand, ClimateControlScheduleCommand.Set);\n const cc = new ClimateControlScheduleCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n weekday,\n switchPoints,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_ClimateControlScheduleCCAPI_get()\n public async get(weekday: Weekday): Promise<MaybeNotKnown<readonly Switchpoint[]>> {\n this.assertSupportsCommand(ClimateControlScheduleCommand, ClimateControlScheduleCommand.Get);\n const cc = new ClimateControlScheduleCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n weekday,\n });\n const response = await this.host.sendCommand<ClimateControlScheduleCCReport>(cc, this.commandOptions);\n return response?.schedule;\n }\n public async getChangeCounter(): Promise<MaybeNotKnown<number>> {\n this.assertSupportsCommand(ClimateControlScheduleCommand, ClimateControlScheduleCommand.ChangedGet);\n const cc = new ClimateControlScheduleCCChangedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ClimateControlScheduleCCChangedReport>(cc, this.commandOptions);\n return response?.changeCounter;\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getOverride() {\n this.assertSupportsCommand(ClimateControlScheduleCommand, ClimateControlScheduleCommand.OverrideGet);\n const cc = new ClimateControlScheduleCCOverrideGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ClimateControlScheduleCCOverrideReport>(cc, this.commandOptions);\n if (response) {\n return {\n type: response.overrideType,\n state: response.overrideState,\n };\n }\n }\n @validateArgs_ClimateControlScheduleCCAPI_setOverride()\n public async setOverride(type: ScheduleOverrideType, state: SetbackState): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ClimateControlScheduleCommand, ClimateControlScheduleCommand.OverrideSet);\n const cc = new ClimateControlScheduleCCOverrideSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n overrideType: type,\n overrideState: state,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n}\n@commandClass(CommandClasses[\"Climate Control Schedule\"])\n@implementedVersion(1)\n@ccValues(ClimateControlScheduleCCValues)\nexport class ClimateControlScheduleCC extends CommandClass {\n declare ccCommand: ClimateControlScheduleCommand;\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCSetOptions {\n weekday: Weekday;\n switchPoints: Switchpoint[];\n}\n@CCCommand(ClimateControlScheduleCommand.Set)\n@useSupervision()\nexport class ClimateControlScheduleCCSet extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCSetOptions>) {\n super(options);\n this.switchPoints = options.switchPoints;\n this.weekday = options.weekday;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ClimateControlScheduleCCSet {\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ClimateControlScheduleCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public switchPoints: Switchpoint[];\n public weekday: Weekday;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Make sure we have exactly 9 entries\n const allSwitchPoints = this.switchPoints.slice(0, 9); // maximum 9\n while (allSwitchPoints.length < 9) {\n allSwitchPoints.push({\n hour: 0,\n minute: 0,\n state: \"Unused\",\n });\n }\n this.payload = Bytes.concat([\n [this.weekday & 0b111],\n ...allSwitchPoints.map((sp) => encodeSwitchpoint(sp)),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n weekday: getEnumMemberName(Weekday, this.weekday),\n switchpoints: this.switchPoints\n .map((sp) => `\n\u00B7 ${sp.hour.toString().padStart(2, \"0\")}:${sp.minute.toString().padStart(2, \"0\")} --> ${sp.state}`)\n .join(\"\"),\n },\n };\n }\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCReportOptions {\n weekday: Weekday;\n schedule: Switchpoint[];\n}\n@CCCommand(ClimateControlScheduleCommand.Report)\n@ccValueProperty(\"schedule\", ClimateControlScheduleCCValues.schedule, (self) => [self.weekday])\nexport class ClimateControlScheduleCCReport extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.weekday = options.weekday;\n this.schedule = options.schedule;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCReport {\n validatePayload(raw.payload.length >= 28);\n const weekday: Weekday = raw.payload[0] & 0b111;\n const allSwitchpoints: Switchpoint[] = [];\n for (let i = 0; i <= 8; i++) {\n allSwitchpoints.push(decodeSwitchpoint(raw.payload.subarray(1 + 3 * i)));\n }\n const schedule: Switchpoint[] = allSwitchpoints.filter((sp) => sp.state !== \"Unused\");\n return new this({\n nodeId: ctx.sourceNodeId,\n weekday,\n schedule,\n });\n }\n public readonly weekday: Weekday;\n public readonly schedule: readonly Switchpoint[];\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n weekday: getEnumMemberName(Weekday, this.weekday),\n schedule: this.schedule\n .map((sp) => `\n\u00B7 ${sp.hour.toString().padStart(2, \"0\")}:${sp.minute.toString().padStart(2, \"0\")} --> ${sp.state}`)\n .join(\"\"),\n },\n };\n }\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCGetOptions {\n weekday: Weekday;\n}\n@CCCommand(ClimateControlScheduleCommand.Get)\n@expectedCCResponse(ClimateControlScheduleCCReport)\nexport class ClimateControlScheduleCCGet extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCGetOptions>) {\n super(options);\n this.weekday = options.weekday;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ClimateControlScheduleCCGet {\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ClimateControlScheduleCCGet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public weekday: Weekday;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.weekday & 0b111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { weekday: getEnumMemberName(Weekday, this.weekday) },\n };\n }\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCChangedReportOptions {\n changeCounter: number;\n}\n@CCCommand(ClimateControlScheduleCommand.ChangedReport)\nexport class ClimateControlScheduleCCChangedReport extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCChangedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.changeCounter = options.changeCounter;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCChangedReport {\n validatePayload(raw.payload.length >= 1);\n const changeCounter = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n changeCounter,\n });\n }\n public readonly changeCounter: number;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"change counter\": this.changeCounter },\n };\n }\n}\n@CCCommand(ClimateControlScheduleCommand.ChangedGet)\n@expectedCCResponse(ClimateControlScheduleCCChangedReport)\nexport class ClimateControlScheduleCCChangedGet extends ClimateControlScheduleCC {\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideReportOptions {\n overrideType: ScheduleOverrideType;\n overrideState: SetbackState;\n}\n@CCCommand(ClimateControlScheduleCommand.OverrideReport)\n@ccValueProperty(\"overrideType\", ClimateControlScheduleCCValues.overrideType)\n@ccValueProperty(\"overrideState\", ClimateControlScheduleCCValues.overrideState)\nexport class ClimateControlScheduleCCOverrideReport extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCOverrideReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.overrideType = options.overrideType;\n this.overrideState = options.overrideState;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCOverrideReport {\n validatePayload(raw.payload.length >= 2);\n const overrideType: ScheduleOverrideType = raw.payload[0] & 0b11;\n const overrideState: SetbackState = decodeSetbackState(raw.payload, 1)\n // If we receive an unknown setback state, return the raw value\n || raw.payload.readInt8(1);\n return new this({\n nodeId: ctx.sourceNodeId,\n overrideType,\n overrideState,\n });\n }\n public readonly overrideType: ScheduleOverrideType;\n public readonly overrideState: SetbackState;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"override type\": getEnumMemberName(ScheduleOverrideType, this.overrideType),\n \"override state\": this.overrideState,\n },\n };\n }\n}\n@CCCommand(ClimateControlScheduleCommand.OverrideGet)\n@expectedCCResponse(ClimateControlScheduleCCOverrideReport)\nexport class ClimateControlScheduleCCOverrideGet extends ClimateControlScheduleCC {\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideSetOptions {\n overrideType: ScheduleOverrideType;\n overrideState: SetbackState;\n}\n@CCCommand(ClimateControlScheduleCommand.OverrideSet)\n@useSupervision()\nexport class ClimateControlScheduleCCOverrideSet extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCOverrideSetOptions>) {\n super(options);\n this.overrideType = options.overrideType;\n this.overrideState = options.overrideState;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ClimateControlScheduleCCOverrideSet {\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ClimateControlScheduleCCOverrideSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public overrideType: ScheduleOverrideType;\n public overrideState: SetbackState;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [this.overrideType & 0b11],\n encodeSetbackState(this.overrideState),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"override type\": getEnumMemberName(ScheduleOverrideType, this.overrideType),\n \"override state\": this.overrideState,\n },\n };\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAkO;AAClO,oBAAyC;AACzC,iBAAsB;AACtB,0BAAyC;AACzC,oCAAiI;AAEjI,mBAAmH;AACnH,yBAA8F;AAE9F,gCAA+C;AAV/C,MAAM,EAAE,8CAA8C,8CAA8C,qDAAoD,IAAK;IAahJ,+BAA2B,MAAA;8BADvC,mCAAI,2BAAe,0BAA0B,CAAC,CAAC;;;;oBACC;;;;;mDAAA,YAAK;WAAA;;;;;;;;yBAajD,6CAA4C,CAAE;yBAW9C,6CAA4C,CAAE;iCAmC9C,qDAAoD,CAAE;AA7CvD,qCAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAgB,GAAA,UAAA,UAAA,G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ACgC;mDAAA,YAAwB;WAAA;;;;;;;;AAAzE,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAAwD;AACvE,YAAM,OAAO;AACb,WAAK,eAAe,QAAQ;AAC5B,WAAK,UAAU,QAAQ;IAC3B;IACO,OAAO,KAAK,MAAa,MAAsB;AAClD,YAAM,IAAI,uBAAW,GAAG,KAAK,IAAI,qCAAqC,4BAAgB,8BAA8B;IAIxH;IACO;IACA;IACA,UAAU,KAAsB;AAEnC,YAAM,kBAAkB,KAAK,aAAa,MAAM,GAAG,CAAC;AACpD,aAAO,gBAAgB,SAAS,GAAG;AAC/B,wBAAgB,KAAK;UACjB,MAAM;UACN,QAAQ;UACR,OAAO;SACV;MACL;AACA,WAAK,UAAU,oBAAM,OAAO;QACxB,CAAC,KAAK,UAAU,CAAK;QACrB,GAAG,gBAAgB,IAAI,CAAC,WAAO,sCAAkB,EAAE,CAAC;OACvD;AACD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,aAAS,iCAAkB,sBAAS,KAAK,OAAO;UAChD,cAAc,KAAK,aACd,IAAI,CAAC,OAAO;OAC7B,GAAG,KAAK,SAAQ,EAAG,SAAS,GAAG,GAAG,CAAC,IAAI,GAAG,
|
|
4
|
+
"sourcesContent": ["import * as __validateArgs from \"./ClimateControlScheduleCC._validateArgs.js\";\nconst { validateArgs_ClimateControlScheduleCCAPI_set, validateArgs_ClimateControlScheduleCCAPI_get, validateArgs_ClimateControlScheduleCCAPI_setOverride } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, enumValuesToMetadataStates, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName } from \"@zwave-js/shared\";\nimport { CCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ClimateControlScheduleCommand, ScheduleOverrideType, type SetbackState, type Switchpoint, Weekday, } from \"../lib/_Types.js\";\nimport { decodeSetbackState, decodeSwitchpoint, encodeSetbackState, encodeSwitchpoint, } from \"../lib/serializers.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ClimateControlScheduleCCValues } from \"./_CCValues.generated.js\";\nexport { ClimateControlScheduleCCValues };\n@API(CommandClasses[\"Climate Control Schedule\"])\nexport class ClimateControlScheduleCCAPI extends CCAPI {\n public supportsCommand(cmd: ClimateControlScheduleCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ClimateControlScheduleCommand.Set:\n case ClimateControlScheduleCommand.OverrideSet:\n return true; // mandatory\n case ClimateControlScheduleCommand.Get:\n case ClimateControlScheduleCommand.ChangedGet:\n case ClimateControlScheduleCommand.OverrideGet:\n return this.isSinglecast();\n }\n return super.supportsCommand(cmd);\n }\n @validateArgs_ClimateControlScheduleCCAPI_set()\n public async set(weekday: Weekday, switchPoints: Switchpoint[]): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ClimateControlScheduleCommand, ClimateControlScheduleCommand.Set);\n const cc = new ClimateControlScheduleCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n weekday,\n switchPoints,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_ClimateControlScheduleCCAPI_get()\n public async get(weekday: Weekday): Promise<MaybeNotKnown<readonly Switchpoint[]>> {\n this.assertSupportsCommand(ClimateControlScheduleCommand, ClimateControlScheduleCommand.Get);\n const cc = new ClimateControlScheduleCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n weekday,\n });\n const response = await this.host.sendCommand<ClimateControlScheduleCCReport>(cc, this.commandOptions);\n return response?.schedule;\n }\n public async getChangeCounter(): Promise<MaybeNotKnown<number>> {\n this.assertSupportsCommand(ClimateControlScheduleCommand, ClimateControlScheduleCommand.ChangedGet);\n const cc = new ClimateControlScheduleCCChangedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ClimateControlScheduleCCChangedReport>(cc, this.commandOptions);\n return response?.changeCounter;\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getOverride() {\n this.assertSupportsCommand(ClimateControlScheduleCommand, ClimateControlScheduleCommand.OverrideGet);\n const cc = new ClimateControlScheduleCCOverrideGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ClimateControlScheduleCCOverrideReport>(cc, this.commandOptions);\n if (response) {\n return {\n type: response.overrideType,\n state: response.overrideState,\n };\n }\n }\n @validateArgs_ClimateControlScheduleCCAPI_setOverride()\n public async setOverride(type: ScheduleOverrideType, state: SetbackState): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ClimateControlScheduleCommand, ClimateControlScheduleCommand.OverrideSet);\n const cc = new ClimateControlScheduleCCOverrideSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n overrideType: type,\n overrideState: state,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n}\n@commandClass(CommandClasses[\"Climate Control Schedule\"])\n@implementedVersion(1)\n@ccValues(ClimateControlScheduleCCValues)\nexport class ClimateControlScheduleCC extends CommandClass {\n declare ccCommand: ClimateControlScheduleCommand;\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCSetOptions {\n weekday: Weekday;\n switchPoints: Switchpoint[];\n}\n@CCCommand(ClimateControlScheduleCommand.Set)\n@useSupervision()\nexport class ClimateControlScheduleCCSet extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCSetOptions>) {\n super(options);\n this.switchPoints = options.switchPoints;\n this.weekday = options.weekday;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ClimateControlScheduleCCSet {\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ClimateControlScheduleCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public switchPoints: Switchpoint[];\n public weekday: Weekday;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Make sure we have exactly 9 entries\n const allSwitchPoints = this.switchPoints.slice(0, 9); // maximum 9\n while (allSwitchPoints.length < 9) {\n allSwitchPoints.push({\n hour: 0,\n minute: 0,\n state: \"Unused\",\n });\n }\n this.payload = Bytes.concat([\n [this.weekday & 0b111],\n ...allSwitchPoints.map((sp) => encodeSwitchpoint(sp)),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n weekday: getEnumMemberName(Weekday, this.weekday),\n switchpoints: this.switchPoints\n .map((sp) => `\n\u00B7 ${sp.hour.toString().padStart(2, \"0\")}:${sp.minute\n .toString()\n .padStart(2, \"0\")} --> ${sp.state}`)\n .join(\"\"),\n },\n };\n }\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCReportOptions {\n weekday: Weekday;\n schedule: Switchpoint[];\n}\n@CCCommand(ClimateControlScheduleCommand.Report)\n@ccValueProperty(\"schedule\", ClimateControlScheduleCCValues.schedule, (self) => [self.weekday])\nexport class ClimateControlScheduleCCReport extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.weekday = options.weekday;\n this.schedule = options.schedule;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCReport {\n validatePayload(raw.payload.length >= 28);\n const weekday: Weekday = raw.payload[0] & 0b111;\n const allSwitchpoints: Switchpoint[] = [];\n for (let i = 0; i <= 8; i++) {\n allSwitchpoints.push(decodeSwitchpoint(raw.payload.subarray(1 + 3 * i)));\n }\n const schedule: Switchpoint[] = allSwitchpoints.filter((sp) => sp.state !== \"Unused\");\n return new this({\n nodeId: ctx.sourceNodeId,\n weekday,\n schedule,\n });\n }\n public readonly weekday: Weekday;\n public readonly schedule: readonly Switchpoint[];\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n weekday: getEnumMemberName(Weekday, this.weekday),\n schedule: this.schedule\n .map((sp) => `\n\u00B7 ${sp.hour.toString().padStart(2, \"0\")}:${sp.minute\n .toString()\n .padStart(2, \"0\")} --> ${sp.state}`)\n .join(\"\"),\n },\n };\n }\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCGetOptions {\n weekday: Weekday;\n}\n@CCCommand(ClimateControlScheduleCommand.Get)\n@expectedCCResponse(ClimateControlScheduleCCReport)\nexport class ClimateControlScheduleCCGet extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCGetOptions>) {\n super(options);\n this.weekday = options.weekday;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ClimateControlScheduleCCGet {\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ClimateControlScheduleCCGet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public weekday: Weekday;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.weekday & 0b111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { weekday: getEnumMemberName(Weekday, this.weekday) },\n };\n }\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCChangedReportOptions {\n changeCounter: number;\n}\n@CCCommand(ClimateControlScheduleCommand.ChangedReport)\nexport class ClimateControlScheduleCCChangedReport extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCChangedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.changeCounter = options.changeCounter;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCChangedReport {\n validatePayload(raw.payload.length >= 1);\n const changeCounter = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n changeCounter,\n });\n }\n public readonly changeCounter: number;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"change counter\": this.changeCounter },\n };\n }\n}\n@CCCommand(ClimateControlScheduleCommand.ChangedGet)\n@expectedCCResponse(ClimateControlScheduleCCChangedReport)\nexport class ClimateControlScheduleCCChangedGet extends ClimateControlScheduleCC {\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideReportOptions {\n overrideType: ScheduleOverrideType;\n overrideState: SetbackState;\n}\n@CCCommand(ClimateControlScheduleCommand.OverrideReport)\n@ccValueProperty(\"overrideType\", ClimateControlScheduleCCValues.overrideType)\n@ccValueProperty(\"overrideState\", ClimateControlScheduleCCValues.overrideState)\nexport class ClimateControlScheduleCCOverrideReport extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCOverrideReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.overrideType = options.overrideType;\n this.overrideState = options.overrideState;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCOverrideReport {\n validatePayload(raw.payload.length >= 2);\n const overrideType: ScheduleOverrideType = raw.payload[0] & 0b11;\n const overrideState: SetbackState = decodeSetbackState(raw.payload, 1)\n // If we receive an unknown setback state, return the raw value\n || raw.payload.readInt8(1);\n return new this({\n nodeId: ctx.sourceNodeId,\n overrideType,\n overrideState,\n });\n }\n public readonly overrideType: ScheduleOverrideType;\n public readonly overrideState: SetbackState;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"override type\": getEnumMemberName(ScheduleOverrideType, this.overrideType),\n \"override state\": this.overrideState,\n },\n };\n }\n}\n@CCCommand(ClimateControlScheduleCommand.OverrideGet)\n@expectedCCResponse(ClimateControlScheduleCCOverrideReport)\nexport class ClimateControlScheduleCCOverrideGet extends ClimateControlScheduleCC {\n}\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideSetOptions {\n overrideType: ScheduleOverrideType;\n overrideState: SetbackState;\n}\n@CCCommand(ClimateControlScheduleCommand.OverrideSet)\n@useSupervision()\nexport class ClimateControlScheduleCCOverrideSet extends ClimateControlScheduleCC {\n public constructor(options: WithAddress<ClimateControlScheduleCCOverrideSetOptions>) {\n super(options);\n this.overrideType = options.overrideType;\n this.overrideState = options.overrideState;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ClimateControlScheduleCCOverrideSet {\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ClimateControlScheduleCCOverrideSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public overrideType: ScheduleOverrideType;\n public overrideState: SetbackState;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [this.overrideType & 0b11],\n encodeSetbackState(this.overrideState),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"override type\": getEnumMemberName(ScheduleOverrideType, this.overrideType),\n \"override state\": this.overrideState,\n },\n };\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAkO;AAClO,oBAAyC;AACzC,iBAAsB;AACtB,0BAAyC;AACzC,oCAAiI;AAEjI,mBAAmH;A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 -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src_gen/cc/ClockCC.ts"],
|
|
4
|
-
"sourcesContent": ["import * as __validateArgs from \"./ClockCC._validateArgs.js\";\nconst { validateArgs_ClockCCAPI_set } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type SupervisionResult, type WithAddress, ZWaveError, ZWaveErrorCodes, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { ClockCommand, Weekday } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\n// @noSetValueAPI - This CC has no simple value to set\n@API(CommandClasses.Clock)\nexport class ClockCCAPI extends CCAPI {\n public supportsCommand(cmd: ClockCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ClockCommand.Get:\n return this.isSinglecast();\n case ClockCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ClockCommand, ClockCommand.Get);\n const cc = new ClockCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ClockCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"weekday\", \"hour\", \"minute\"]);\n }\n }\n @validateArgs_ClockCCAPI_set()\n public async set(hour: number, minute: number, weekday?: Weekday): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ClockCommand, ClockCommand.Set);\n const cc = new ClockCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n hour,\n minute,\n weekday: weekday ?? Weekday.Unknown,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n}\n@commandClass(CommandClasses.Clock)\n@implementedVersion(1)\nexport class ClockCC extends CommandClass {\n declare ccCommand: ClockCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n await this.refreshValues(ctx, { tag: \"interview\" });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Clock, ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n ctx.logNode(node.id, {\n message: \"requesting current clock setting...\",\n direction: \"outbound\",\n });\n const response = await api.get();\n if (response) {\n const logMessage = `received current clock setting: ${response.weekday !== Weekday.Unknown\n ? Weekday[response.weekday] + \", \"\n : \"\"}${response.hour < 10 ? \"0\" : \"\"}${response.hour}:${response.minute < 10 ? \"0\" : \"\"}${response.minute}`;\n ctx.logNode(node.id, {\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport interface ClockCCSetOptions {\n weekday: Weekday;\n hour: number;\n minute: number;\n}\n@CCCommand(ClockCommand.Set)\n@useSupervision()\nexport class ClockCCSet extends ClockCC {\n public constructor(options: WithAddress<ClockCCSetOptions>) {\n super(options);\n this.weekday = options.weekday;\n this.hour = options.hour;\n this.minute = options.minute;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ClockCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ClockCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public weekday: Weekday;\n public hour: number;\n public minute: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n ((this.weekday & 0b111) << 5) | (this.hour & 0b11111),\n this.minute,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"clock setting\": `${getEnumMemberName(Weekday, this.weekday)}, ${this.hour.toString().padStart(2, \"0\")}:${this.minute.toString().padStart(2, \"0\")}`,\n },\n };\n }\n}\n// @publicAPI\nexport interface ClockCCReportOptions {\n weekday: Weekday;\n hour: number;\n minute: number;\n}\n@CCCommand(ClockCommand.Report)\nexport class ClockCCReport extends ClockCC {\n public constructor(options: WithAddress<ClockCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.weekday = options.weekday;\n this.hour = options.hour;\n this.minute = options.minute;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ClockCCReport {\n validatePayload(raw.payload.length >= 2);\n const weekday: Weekday = raw.payload[0] >>> 5;\n const hour = raw.payload[0] & 0b11111;\n const minute = raw.payload[1];\n validatePayload(weekday <= Weekday.Sunday, hour <= 23, minute <= 59);\n return new this({\n nodeId: ctx.sourceNodeId,\n weekday,\n hour,\n minute,\n });\n }\n public readonly weekday: Weekday;\n public readonly hour: number;\n public readonly minute: number;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"clock setting\": `${getEnumMemberName(Weekday, this.weekday)}, ${this.hour.toString().padStart(2, \"0\")}:${this.minute.toString().padStart(2, \"0\")}`,\n },\n };\n }\n}\n@CCCommand(ClockCommand.Get)\n@expectedCCResponse(ClockCCReport)\nexport class ClockCCGet extends ClockCC {\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAwM;AACx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US,cAAU,MAAA;8BAFtB,yCAAU,0BAAa,GAAG,OAC1B,8CAAc,CAAE;;;;oBACe;kCAAA,YAAO;WAAA;;;;;;;;AAAvC,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAAuC;AACtD,YAAM,OAAO;AACb,WAAK,UAAU,QAAQ;AACvB,WAAK,OAAO,QAAQ;AACpB,WAAK,SAAS,QAAQ;IAC1B;IACO,OAAO,KAAK,MAAa,MAAsB;AAElD,YAAM,IAAI,uBAAW,GAAG,KAAK,IAAI,qCAAqC,4BAAgB,8BAA8B;IAIxH;IACO;IACA;IACA;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK;SACpB,KAAK,UAAU,MAAU,IAAM,KAAK,OAAO;QAC7C,KAAK;OACR;AACD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,iBAAiB,OAAG,iCAAkB,sBAAS,KAAK,OAAO,CAAC,KAAK,KAAK,KAAK,SAAQ,EAAG,SAAS,GAAG,GAAG,CAAC,IAAI,KAAK,
|
|
4
|
+
"sourcesContent": ["import * as __validateArgs from \"./ClockCC._validateArgs.js\";\nconst { validateArgs_ClockCCAPI_set } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type SupervisionResult, type WithAddress, ZWaveError, ZWaveErrorCodes, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { ClockCommand, Weekday } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\n// @noSetValueAPI - This CC has no simple value to set\n@API(CommandClasses.Clock)\nexport class ClockCCAPI extends CCAPI {\n public supportsCommand(cmd: ClockCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ClockCommand.Get:\n return this.isSinglecast();\n case ClockCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ClockCommand, ClockCommand.Get);\n const cc = new ClockCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ClockCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"weekday\", \"hour\", \"minute\"]);\n }\n }\n @validateArgs_ClockCCAPI_set()\n public async set(hour: number, minute: number, weekday?: Weekday): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ClockCommand, ClockCommand.Set);\n const cc = new ClockCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n hour,\n minute,\n weekday: weekday ?? Weekday.Unknown,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n}\n@commandClass(CommandClasses.Clock)\n@implementedVersion(1)\nexport class ClockCC extends CommandClass {\n declare ccCommand: ClockCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n await this.refreshValues(ctx, { tag: \"interview\" });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Clock, ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n ctx.logNode(node.id, {\n message: \"requesting current clock setting...\",\n direction: \"outbound\",\n });\n const response = await api.get();\n if (response) {\n const logMessage = `received current clock setting: ${response.weekday !== Weekday.Unknown\n ? Weekday[response.weekday] + \", \"\n : \"\"}${response.hour < 10 ? \"0\" : \"\"}${response.hour}:${response.minute < 10 ? \"0\" : \"\"}${response.minute}`;\n ctx.logNode(node.id, {\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport interface ClockCCSetOptions {\n weekday: Weekday;\n hour: number;\n minute: number;\n}\n@CCCommand(ClockCommand.Set)\n@useSupervision()\nexport class ClockCCSet extends ClockCC {\n public constructor(options: WithAddress<ClockCCSetOptions>) {\n super(options);\n this.weekday = options.weekday;\n this.hour = options.hour;\n this.minute = options.minute;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ClockCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ClockCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public weekday: Weekday;\n public hour: number;\n public minute: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n ((this.weekday & 0b111) << 5) | (this.hour & 0b11111),\n this.minute,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"clock setting\": `${getEnumMemberName(Weekday, this.weekday)}, ${this.hour.toString().padStart(2, \"0\")}:${this.minute\n .toString()\n .padStart(2, \"0\")}`,\n },\n };\n }\n}\n// @publicAPI\nexport interface ClockCCReportOptions {\n weekday: Weekday;\n hour: number;\n minute: number;\n}\n@CCCommand(ClockCommand.Report)\nexport class ClockCCReport extends ClockCC {\n public constructor(options: WithAddress<ClockCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.weekday = options.weekday;\n this.hour = options.hour;\n this.minute = options.minute;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ClockCCReport {\n validatePayload(raw.payload.length >= 2);\n const weekday: Weekday = raw.payload[0] >>> 5;\n const hour = raw.payload[0] & 0b11111;\n const minute = raw.payload[1];\n validatePayload(weekday <= Weekday.Sunday, hour <= 23, minute <= 59);\n return new this({\n nodeId: ctx.sourceNodeId,\n weekday,\n hour,\n minute,\n });\n }\n public readonly weekday: Weekday;\n public readonly hour: number;\n public readonly minute: number;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"clock setting\": `${getEnumMemberName(Weekday, this.weekday)}, ${this.hour.toString().padStart(2, \"0\")}:${this.minute\n .toString()\n .padStart(2, \"0\")}`,\n },\n };\n }\n}\n@CCCommand(ClockCommand.Get)\n@expectedCCResponse(ClockCCReport)\nexport class ClockCCGet extends ClockCC {\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAwM;AACxM,oBAA+C;AAC/C,iBAAsB;AACtB,0BAAuH;AACvH,oCAAsG;AACtG,mBAAsC;AANtC,MAAM,EAAE,4BAA2B,IAAK;IAU3B,cAAU,MAAA;8BADtB,mCAAI,2BAAe,KAAK,CAAC;;;;oBACM;;;kCAAA,YAAK;WAAA;;;;;;;;yBAsBhC,4BAA2B,CAAE;AAC9B,qCAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAgB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAvBpB,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EA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,OAAO,CAAC,KAAK,KAAK,KAAK,SAAQ,EAAG,SAAS,GAAG,GAAG,CAAC,IAAI,KAAK,OAC1G,SAAQ,EACR,SAAS,GAAG,GAAG,CAAC;;;IAGjC;;;;IAIS,cAAU,MAAA;8BAFtB,yCAAU,0BAAa,GAAG,OAC1B,kDAAmB,aAAa,CAAC;;;;oBACF;kCAAA,YAAO;WAAA;;;;;;;;AAAvC,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -557,10 +557,7 @@ let ColorSwitchCCReport = (() => {
|
|
|
557
557
|
targetValue;
|
|
558
558
|
duration;
|
|
559
559
|
serialize(ctx) {
|
|
560
|
-
this.payload = import_shared.Bytes.from([
|
|
561
|
-
this.colorComponent,
|
|
562
|
-
this.currentValue
|
|
563
|
-
]);
|
|
560
|
+
this.payload = import_shared.Bytes.from([this.colorComponent, this.currentValue]);
|
|
564
561
|
if (this.targetValue != void 0 && this.duration != void 0) {
|
|
565
562
|
this.payload = import_shared.Bytes.concat([
|
|
566
563
|
this.payload,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src_gen/cc/ColorSwitchCC.ts"],
|
|
4
|
-
"sourcesContent": ["import * as __validateArgs from \"./ColorSwitchCC._validateArgs.js\";\nconst { validateArgs_ColorSwitchCCAPI_get, validateArgs_ColorSwitchCCAPI_set, validateArgs_ColorSwitchCCAPI_startLevelChange, validateArgs_ColorSwitchCCAPI_stopLevelChange } = __validateArgs;\nimport { CommandClasses, Duration, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, type ValueDB, type ValueID, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, isUnsupervisedOrSucceeded, logList, logText, parseBitMask, supervisedCommandSucceeded, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, isEnumMember, keysOf, pick, } from \"@zwave-js/shared\";\nimport { clamp } from \"alcalzone-shared/math\";\nimport { isObject } from \"alcalzone-shared/typeguards\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, getEffectiveCCVersion, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ColorComponent, ColorComponentMap, type ColorKey, ColorSwitchCommand, type ColorTable, LevelChangeDirection, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nconst hexColorRegex = /^#?(?<red>[0-9a-f]{2})(?<green>[0-9a-f]{2})(?<blue>[0-9a-f]{2})$/i;\nconst colorTableKeys = [\n ...keysOf(ColorComponent),\n ...keysOf(ColorComponentMap),\n];\nfunction colorTableKeyToComponent(key: string): ColorComponent {\n if (/^\\d+$/.test(key)) {\n return parseInt(key, 10);\n }\n else if (key in ColorComponentMap) {\n return (ColorComponentMap as any)[key];\n }\n else if (key in ColorComponent) {\n return (ColorComponent as any)[key];\n }\n throw new ZWaveError(`Invalid color key ${key}!`, ZWaveErrorCodes.Argument_Invalid);\n}\nfunction colorComponentToTableKey(component: ColorComponent): ColorKey | undefined {\n for (const [key, comp] of Object.entries(ColorComponentMap)) {\n if (comp === component)\n return key as any;\n }\n}\nimport { ColorSwitchCCValues } from \"./_CCValues.generated.js\";\nexport { ColorSwitchCCValues };\n@API(CommandClasses[\"Color Switch\"])\nexport class ColorSwitchCCAPI extends CCAPI {\n public supportsCommand(cmd: ColorSwitchCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ColorSwitchCommand.SupportedGet:\n case ColorSwitchCommand.Get:\n return this.isSinglecast();\n case ColorSwitchCommand.Set:\n case ColorSwitchCommand.StartLevelChange:\n case ColorSwitchCommand.StopLevelChange:\n return true; // These are mandatory\n }\n return super.supportsCommand(cmd);\n }\n public async getSupported(): Promise<MaybeNotKnown<readonly ColorComponent[]>> {\n this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.SupportedGet);\n const cc = new ColorSwitchCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ColorSwitchCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedColorComponents;\n }\n @validateArgs_ColorSwitchCCAPI_get()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get(component: ColorComponent) {\n this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Get);\n const cc = new ColorSwitchCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n colorComponent: component,\n });\n const response = await this.host.sendCommand<ColorSwitchCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"currentValue\", \"targetValue\", \"duration\"]);\n }\n }\n @validateArgs_ColorSwitchCCAPI_set()\n public async set(options: ColorSwitchCCSetOptions): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Set);\n const cc = new ColorSwitchCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n const result = await this.host.sendCommand(cc, this.commandOptions);\n if (isUnsupervisedOrSucceeded(result)) {\n // If the command did not fail, assume that it succeeded and update the values accordingly\n // TODO: The API methods should not modify the value DB directly, but to do so\n // this requires a nicer way of synchronizing hexColor with the others\n if (this.isSinglecast()) {\n // Update each color component separately and record the changes to the compound value\n this.updateCurrentColor(this.getValueDB(), cc.colorTable);\n }\n else if (this.isMulticast()) {\n // Figure out which nodes were affected by this command\n const affectedNodes = this.endpoint.node.physicalNodes.filter((node) => node\n .getEndpoint(this.endpoint.index)\n ?.supportsCC(this.ccId));\n // and optimistically update the currentColor\n for (const node of affectedNodes) {\n const valueDB = this.host.tryGetValueDB(node.id);\n if (valueDB) {\n this.updateCurrentColor(valueDB, cc.colorTable);\n }\n }\n }\n }\n return result;\n }\n /** Updates the current color for a given node by merging in the given changes */\n private updateCurrentColor(valueDB: ValueDB, colorTable: ColorTable) {\n let updatedRGB = false;\n const currentColorValueId = ColorSwitchCCValues.currentColor.endpoint(this.endpoint.index);\n const targetColorValueId = ColorSwitchCCValues.targetColor.endpoint(this.endpoint.index);\n const currentCompoundColor = valueDB.getValue<Partial<Record<ColorKey, number>>>(currentColorValueId) ?? {};\n const targetCompoundColor = valueDB.getValue<Partial<Record<ColorKey, number>>>(targetColorValueId) ?? {};\n for (const [key, value] of Object.entries(colorTable)) {\n const component = colorTableKeyToComponent(key);\n if (component === ColorComponent.Red\n || component === ColorComponent.Green\n || component === ColorComponent.Blue) {\n updatedRGB = true;\n }\n valueDB.setValue(ColorSwitchCCValues.currentColorChannel(component).endpoint(this.endpoint.index), value);\n // Update the compound value\n if (key in ColorComponentMap) {\n currentCompoundColor[key as ColorKey] = value;\n targetCompoundColor[key as ColorKey] = value;\n }\n }\n // And store the updated compound values\n valueDB.setValue(currentColorValueId, currentCompoundColor);\n valueDB.setValue(targetColorValueId, targetCompoundColor);\n // and hex color if necessary\n const supportsHex = valueDB.getValue<boolean>(ColorSwitchCCValues.supportsHexColor.endpoint(this.endpoint.index));\n if (supportsHex && updatedRGB) {\n const hexValueId = ColorSwitchCCValues.hexColor.endpoint(this.endpoint.index);\n const [r, g, b] = [\n ColorComponent.Red,\n ColorComponent.Green,\n ColorComponent.Blue,\n ].map((c) => valueDB.getValue<number>(ColorSwitchCCValues.currentColorChannel(c).endpoint(this.endpoint.index)) ?? 0);\n const hexValue = (r << 16) | (g << 8) | b;\n valueDB.setValue(hexValueId, hexValue.toString(16).padStart(6, \"0\"));\n }\n }\n @validateArgs_ColorSwitchCCAPI_startLevelChange()\n public async startLevelChange(options: ColorSwitchCCStartLevelChangeOptions): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.StartLevelChange);\n const cc = new ColorSwitchCCStartLevelChange({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_ColorSwitchCCAPI_stopLevelChange()\n public async stopLevelChange(colorComponent: ColorComponent): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.StopLevelChange);\n const cc = new ColorSwitchCCStopLevelChange({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n colorComponent,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ColorSwitchCCAPI, { property, propertyKey }, value, options) {\n if (property === \"targetColor\") {\n const duration = Duration.from(options?.transitionDuration);\n if (propertyKey != undefined) {\n // Single color component, only accepts numbers\n if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n else if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n const result = await this.set({\n [propertyKey]: value,\n duration,\n });\n if (this.isSinglecast()\n && !supervisedCommandSucceeded(result)) {\n // Verify the current value after a (short) delay, unless the command was supervised and successful\n this.schedulePoll({ property, propertyKey }, value, {\n duration,\n transition: \"fast\",\n });\n }\n return result;\n }\n else {\n // Set the compound color object\n // Ensure the value is an object with only valid keys\n if (!isObject(value)\n || !Object.keys(value).every((key) => key in ColorComponentMap)) {\n throw new ZWaveError(`${CommandClasses[this.ccId]}: \"${property}\" must be set to an object which specifies each color channel`, ZWaveErrorCodes.Argument_Invalid);\n }\n // Ensure that each property is numeric\n for (const [key, val] of Object.entries(value)) {\n if (typeof val !== \"number\") {\n throwWrongValueType(this.ccId, `${property}.${key}`, \"number\", typeof val);\n }\n }\n // GH#2527: strip unsupported color components, because some devices don't react otherwise\n if (this.isSinglecast()) {\n const supportedColors = this.tryGetValueDB()?.getValue<readonly ColorComponent[]>(ColorSwitchCCValues.supportedColorComponents\n .endpoint(this.endpoint.index));\n if (supportedColors) {\n value = pick(value, supportedColors\n .map((c) => colorComponentToTableKey(c))\n .filter((c) => !!c));\n }\n }\n // Avoid sending empty commands\n if (Object.keys(value as any).length === 0)\n return;\n return this.set({ ...(value as ColorTable), duration });\n // We're not going to poll each color component separately\n }\n }\n else if (property === \"hexColor\") {\n // No property key, this is the hex color #rrggbb\n if (typeof value !== \"string\") {\n throwWrongValueType(this.ccId, property, \"string\", typeof value);\n }\n const duration = Duration.from(options?.transitionDuration);\n return this.set({ hexColor: value, duration });\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n public isSetValueOptimistic(_valueId: ValueID): boolean {\n return false; // Color Switch CC handles updating the value DB itself\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ColorSwitchCCAPI, { property, propertyKey }) {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n switch (property) {\n case \"currentColor\":\n return (await this.get(propertyKey))?.currentValue;\n case \"targetColor\":\n return (await this.get(propertyKey))?.targetValue;\n case \"duration\":\n return (await this.get(propertyKey))?.duration;\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n}\n@commandClass(CommandClasses[\"Color Switch\"])\n@implementedVersion(3)\n@ccValues(ColorSwitchCCValues)\nexport class ColorSwitchCC extends CommandClass {\n declare ccCommand: ColorSwitchCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Color Switch\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported colors...\",\n direction: \"outbound\",\n });\n const supportedColors = await api.getSupported();\n if (!supportedColors) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported colors timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(\"received supported colors:\", {\n nested: logList(supportedColors.map((c) => getEnumMemberName(ColorComponent, c))),\n }),\n direction: \"outbound\",\n });\n // Create metadata for the separate color channels\n for (const color of supportedColors) {\n const currentColorChannelValue = ColorSwitchCCValues\n .currentColorChannel(color);\n this.setMetadata(ctx, currentColorChannelValue);\n const targetColorChannelValue = ColorSwitchCCValues\n .targetColorChannel(color);\n this.setMetadata(ctx, targetColorChannelValue);\n }\n // And the compound one\n const currentColorValue = ColorSwitchCCValues.currentColor;\n this.setMetadata(ctx, currentColorValue);\n const targetColorValue = ColorSwitchCCValues.targetColor;\n this.setMetadata(ctx, targetColorValue);\n // Create the collective HEX color values\n const supportsHex = [\n ColorComponent.Red,\n ColorComponent.Green,\n ColorComponent.Blue,\n ].every((c) => supportedColors.includes(c));\n this.setValue(ctx, ColorSwitchCCValues.supportsHexColor, supportsHex);\n if (supportsHex) {\n const hexColorValue = ColorSwitchCCValues.hexColor;\n this.setMetadata(ctx, hexColorValue);\n }\n // Query all color components\n await this.refreshValues(ctx, {\n tag: \"interview\",\n onProgress: (completed, total) => node.reportInterviewProgress(completed, total),\n });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Color Switch\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n const supportedColors: readonly ColorComponent[] = this.getValue(ctx, ColorSwitchCCValues.supportedColorComponents) ?? [];\n for (const [i, color] of supportedColors.entries()) {\n // Some devices report invalid colors, but the CC API checks\n // for valid values and throws otherwise.\n if (!isEnumMember(ColorComponent, color))\n continue;\n const colorName = getEnumMemberName(ColorComponent, color);\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current color state (${colorName})`,\n direction: \"outbound\",\n });\n await api.get(color);\n options?.onProgress?.(i + 1, supportedColors.length);\n }\n }\n public translatePropertyKey(ctx: GetValueDB, property: string | number, propertyKey: string | number): string | undefined {\n if ((property === \"currentColor\" || property === \"targetColor\")\n && typeof propertyKey === \"number\") {\n const translated = ColorComponent[propertyKey];\n if (translated)\n return translated;\n }\n return super.translatePropertyKey(ctx, property, propertyKey);\n }\n}\n// @publicAPI\nexport interface ColorSwitchCCSupportedReportOptions {\n supportedColorComponents: readonly ColorComponent[];\n}\n@CCCommand(ColorSwitchCommand.SupportedReport)\n@ccValueProperty(\"supportedColorComponents\", ColorSwitchCCValues.supportedColorComponents)\nexport class ColorSwitchCCSupportedReport extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCSupportedReportOptions>) {\n super(options);\n this.supportedColorComponents = options.supportedColorComponents;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCSupportedReport {\n // Docs say 'variable length', but the table shows 2 bytes.\n validatePayload(raw.payload.length >= 2);\n const supportedColorComponents: ColorComponent[] = parseBitMask(raw.payload.subarray(0, 2), ColorComponent[\"Warm White\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedColorComponents,\n });\n }\n public readonly supportedColorComponents: readonly ColorComponent[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = encodeBitMask(this.supportedColorComponents, 15, // fixed 2 bytes\n ColorComponent[\"Warm White\"]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported color components\": logList(this.supportedColorComponents.map((c) => getEnumMemberName(ColorComponent, c))),\n },\n };\n }\n}\n@CCCommand(ColorSwitchCommand.SupportedGet)\n@expectedCCResponse(ColorSwitchCCSupportedReport)\nexport class ColorSwitchCCSupportedGet extends ColorSwitchCC {\n}\n// @publicAPI\nexport interface ColorSwitchCCReportOptions {\n colorComponent: ColorComponent;\n currentValue: number;\n targetValue?: number;\n duration?: Duration | string;\n}\n@CCCommand(ColorSwitchCommand.Report)\n@ccValueProperty(\"currentValue\", ColorSwitchCCValues.currentColorChannel, (self) => [self.colorComponent])\n@ccValueProperty(\"targetValue\", ColorSwitchCCValues.targetColorChannel, (self) => [self.colorComponent])\n@ccValueProperty(\"duration\", ColorSwitchCCValues.duration)\nexport class ColorSwitchCCReport extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCReportOptions>) {\n super(options);\n this.colorComponent = options.colorComponent;\n this.currentValue = options.currentValue;\n this.targetValue = options.targetValue;\n this.duration = Duration.from(options.duration);\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCReport {\n validatePayload(raw.payload.length >= 2);\n const colorComponent: ColorComponent = raw.payload[0];\n validatePayload(isEnumMember(ColorComponent, colorComponent));\n const currentValue = raw.payload[1];\n let targetValue: number | undefined;\n let duration: Duration | undefined;\n if (raw.payload.length >= 4) {\n targetValue = raw.payload[2];\n duration = Duration.parseReport(raw.payload[3]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n colorComponent,\n currentValue,\n targetValue,\n duration,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n // Duration is stored globally instead of per component\n if (!super.persistValues(ctx))\n return false;\n // Update compound current value\n const colorTableKey = colorComponentToTableKey(this.colorComponent);\n if (colorTableKey) {\n const compoundCurrentColorValue = ColorSwitchCCValues.currentColor;\n const compoundCurrentColor: Partial<Record<ColorKey, number>> = this.getValue(ctx, compoundCurrentColorValue) ?? {};\n compoundCurrentColor[colorTableKey] = this.currentValue;\n this.setValue(ctx, compoundCurrentColorValue, compoundCurrentColor);\n // and target value\n if (this.targetValue != undefined) {\n const compoundTargetColorValue = ColorSwitchCCValues.targetColor;\n const compoundTargetColor: Partial<Record<ColorKey, number>> = this.getValue(ctx, compoundTargetColorValue) ?? {};\n compoundTargetColor[colorTableKey] = this.targetValue;\n this.setValue(ctx, compoundTargetColorValue, compoundTargetColor);\n }\n }\n // Update collective hex value if required\n const supportsHex = !!this.getValue(ctx, ColorSwitchCCValues.supportsHexColor);\n if (supportsHex\n && (this.colorComponent === ColorComponent.Red\n || this.colorComponent === ColorComponent.Green\n || this.colorComponent === ColorComponent.Blue)) {\n const hexColorValue = ColorSwitchCCValues.hexColor;\n const hexValue: string = this.getValue(ctx, hexColorValue)\n ?? \"000000\";\n const byteOffset = ColorComponent.Blue - this.colorComponent;\n const byteMask = 0xff << (byteOffset * 8);\n let hexValueNumeric = parseInt(hexValue, 16);\n hexValueNumeric = (hexValueNumeric & ~byteMask)\n | (this.currentValue << (byteOffset * 8));\n this.setValue(ctx, hexColorValue, hexValueNumeric.toString(16).padStart(6, \"0\"));\n }\n return true;\n }\n public readonly colorComponent: ColorComponent;\n public readonly currentValue: number;\n public readonly targetValue: number | undefined;\n public readonly duration: Duration | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.colorComponent,\n this.currentValue,\n ]);\n if (this.targetValue != undefined && this.duration != undefined) {\n this.payload = Bytes.concat([\n this.payload,\n [\n this.targetValue ?? 0xfe,\n (this.duration ?? Duration.default()).serializeReport(),\n ],\n ]);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"color component\": getEnumMemberName(ColorComponent, this.colorComponent),\n \"current value\": this.currentValue,\n };\n if (this.targetValue != undefined) {\n message[\"target value\"] = this.targetValue;\n }\n if (this.duration != undefined) {\n message.duration = this.duration.toString();\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ColorSwitchCCGetOptions {\n colorComponent: ColorComponent;\n}\nfunction testResponseForColorSwitchGet(sent: ColorSwitchCCGet, received: ColorSwitchCCReport) {\n return sent.colorComponent === received.colorComponent;\n}\n@CCCommand(ColorSwitchCommand.Get)\n@expectedCCResponse(ColorSwitchCCReport, testResponseForColorSwitchGet)\nexport class ColorSwitchCCGet extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCGetOptions>) {\n super(options);\n this._colorComponent = options.colorComponent;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCGet {\n validatePayload(raw.payload.length >= 1);\n const colorComponent: ColorComponent = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n colorComponent,\n });\n }\n private _colorComponent: ColorComponent;\n public get colorComponent(): ColorComponent {\n return this._colorComponent;\n }\n public set colorComponent(value: ColorComponent) {\n if (!ColorComponent[value]) {\n throw new ZWaveError(\"colorComponent must be a valid color component index.\", ZWaveErrorCodes.Argument_Invalid);\n }\n this._colorComponent = value;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this._colorComponent]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"color component\": getEnumMemberName(ColorComponent, this.colorComponent),\n },\n };\n }\n}\n// @publicAPI\nexport type ColorSwitchCCSetOptions = (ColorTable | {\n hexColor: string;\n}) & {\n duration?: Duration | string;\n};\n@CCCommand(ColorSwitchCommand.Set)\n@useSupervision()\nexport class ColorSwitchCCSet extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCSetOptions>) {\n super(options);\n // Populate properties from options object\n if (\"hexColor\" in options) {\n const match = hexColorRegex.exec(options.hexColor);\n if (!match) {\n throw new ZWaveError(`${options.hexColor} is not a valid HEX color string`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.colorTable = {\n red: parseInt(match.groups!.red, 16),\n green: parseInt(match.groups!.green, 16),\n blue: parseInt(match.groups!.blue, 16),\n };\n }\n else {\n this.colorTable = pick(options, colorTableKeys as any[]);\n }\n this.duration = Duration.from(options.duration);\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCSet {\n validatePayload(raw.payload.length >= 1);\n const populatedColorCount = raw.payload[0] & 0b11111;\n validatePayload(raw.payload.length >= 1 + populatedColorCount * 2);\n const colorTable: ColorTable = {};\n let offset = 1;\n for (let color = 0; color < populatedColorCount; color++) {\n const component = raw.payload[offset];\n const value = raw.payload[offset + 1];\n const key = colorComponentToTableKey(component);\n if (key) {\n // @ts-expect-error\n this.colorTable[key] = value;\n }\n offset += 2;\n }\n let duration: Duration | undefined;\n if (raw.payload.length > offset) {\n duration = Duration.parseSet(raw.payload[offset]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n ...colorTable,\n duration,\n });\n }\n public colorTable: ColorTable;\n public duration: Duration | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const populatedColorCount = Object.keys(this.colorTable).length;\n this.payload = new Bytes(1 + populatedColorCount * 2 + 1);\n this.payload[0] = populatedColorCount & 0b11111;\n let i = 1;\n for (const [key, value] of Object.entries(this.colorTable)) {\n const component = colorTableKeyToComponent(key);\n this.payload[i] = component;\n this.payload[i + 1] = clamp(value, 0, 0xff);\n i += 2;\n }\n this.payload[i] = (this.duration ?? Duration.default()).serializeSet();\n const ccVersion = getEffectiveCCVersion(ctx, this);\n if (ccVersion < 2 && ctx.getDeviceConfig?.(this.nodeId as number)?.compat?.encodeCCsUsingTargetVersion) {\n // When forcing CC version 1, omit the duration byte\n this.payload = this.payload.subarray(0, -1);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n for (const [key, value] of Object.entries(this.colorTable)) {\n const realKey: string = key in ColorComponentMap\n ? (ColorComponent as any)[(ColorComponentMap as any)[key]]\n : (ColorComponent as any)[key];\n message[realKey] = value;\n }\n if (this.duration != undefined) {\n message.duration = this.duration.toString();\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport type ColorSwitchCCStartLevelChangeOptions = {\n colorComponent: ColorComponent;\n direction: keyof typeof LevelChangeDirection;\n} & ({\n ignoreStartLevel: true;\n startLevel?: number;\n} | {\n ignoreStartLevel: false;\n startLevel: number;\n}) & {\n // Version >= 3:\n duration?: Duration | string;\n};\n@CCCommand(ColorSwitchCommand.StartLevelChange)\n@useSupervision()\nexport class ColorSwitchCCStartLevelChange extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCStartLevelChangeOptions>) {\n super(options);\n this.duration = Duration.from(options.duration);\n this.ignoreStartLevel = options.ignoreStartLevel;\n this.startLevel = options.startLevel ?? 0;\n this.direction = options.direction;\n this.colorComponent = options.colorComponent;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCStartLevelChange {\n validatePayload(raw.payload.length >= 3);\n const ignoreStartLevel = !!((raw.payload[0] & 32) >>> 5);\n const direction = ((raw.payload[0] & 64) >>> 6)\n ? \"down\"\n : \"up\";\n const colorComponent: ColorComponent = raw.payload[1];\n const startLevel = raw.payload[2];\n let duration: Duration | undefined;\n if (raw.payload.length >= 4) {\n duration = Duration.parseSet(raw.payload[3]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n ignoreStartLevel,\n direction,\n colorComponent,\n startLevel,\n duration,\n });\n }\n public duration: Duration | undefined;\n public startLevel: number;\n public ignoreStartLevel: boolean;\n public direction: keyof typeof LevelChangeDirection;\n public colorComponent: ColorComponent;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const controlByte = (LevelChangeDirection[this.direction] << 6)\n | (this.ignoreStartLevel ? 32 : 0);\n this.payload = Bytes.from([\n controlByte,\n this.colorComponent,\n this.startLevel,\n (this.duration ?? Duration.default()).serializeSet(),\n ]);\n const ccVersion = getEffectiveCCVersion(ctx, this);\n if (ccVersion < 3 && ctx.getDeviceConfig?.(this.nodeId as number)?.compat?.encodeCCsUsingTargetVersion) {\n // When forcing CC version 1 or 2, omit the duration byte\n this.payload = this.payload.subarray(0, -1);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"color component\": getEnumMemberName(ColorComponent, this.colorComponent),\n \"start level\": `${this.startLevel}${this.ignoreStartLevel ? \" (ignored)\" : \"\"}`,\n direction: this.direction,\n };\n if (this.duration != undefined) {\n message.duration = this.duration.toString();\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ColorSwitchCCStopLevelChangeOptions {\n colorComponent: ColorComponent;\n}\n@CCCommand(ColorSwitchCommand.StopLevelChange)\n@useSupervision()\nexport class ColorSwitchCCStopLevelChange extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCStopLevelChangeOptions>) {\n super(options);\n this.colorComponent = options.colorComponent;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCStopLevelChange {\n validatePayload(raw.payload.length >= 1);\n const colorComponent: ColorComponent = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n colorComponent,\n });\n }\n public readonly colorComponent: ColorComponent;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.colorComponent]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"color component\": getEnumMemberName(ColorComponent, this.colorComponent),\n },\n };\n }\n}\n"],
|
|
5
|
-
"mappings": ";;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Ae,GAAG,KAAK,UAAU,GAAG,KAAK,mBAAmB,eAAe,EAAE;QAC7E,WAAW,KAAK;;AAEpB,UAAI,KAAK,YAAY,QAAW;AAC5B,gBAAQ,WAAW,KAAK,SAAS,SAAQ;MAC7C;AACA,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB;;IAER;;;;IAQS,gCAA4B,MAAA;8BAFxC,yCAAU,gCAAmB,eAAe,OAC5C,8CAAc,CAAE;;;;oBACiC;oDAAA,YAAa;WAAA;;;;;;;;AAA/D,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAAyD;AACxE,YAAM,OAAO;AACb,WAAK,iBAAiB,QAAQ;IAClC;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,iBAAiC,IAAI,QAAQ,CAAC;AACpD,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ;OACH;IACL;IACgB;IACT,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,cAAc,CAAC;AAC/C,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,uBAAmB,iCAAkB,6BAAgB,KAAK,cAAc;;;IAGpF;;;;",
|
|
4
|
+
"sourcesContent": ["import * as __validateArgs from \"./ColorSwitchCC._validateArgs.js\";\nconst { validateArgs_ColorSwitchCCAPI_get, validateArgs_ColorSwitchCCAPI_set, validateArgs_ColorSwitchCCAPI_startLevelChange, validateArgs_ColorSwitchCCAPI_stopLevelChange } = __validateArgs;\nimport { CommandClasses, Duration, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, type ValueDB, type ValueID, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, isUnsupervisedOrSucceeded, logList, logText, parseBitMask, supervisedCommandSucceeded, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, isEnumMember, keysOf, pick, } from \"@zwave-js/shared\";\nimport { clamp } from \"alcalzone-shared/math\";\nimport { isObject } from \"alcalzone-shared/typeguards\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, getEffectiveCCVersion, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ColorComponent, ColorComponentMap, type ColorKey, ColorSwitchCommand, type ColorTable, LevelChangeDirection, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nconst hexColorRegex = /^#?(?<red>[0-9a-f]{2})(?<green>[0-9a-f]{2})(?<blue>[0-9a-f]{2})$/i;\nconst colorTableKeys = [\n ...keysOf(ColorComponent),\n ...keysOf(ColorComponentMap),\n];\nfunction colorTableKeyToComponent(key: string): ColorComponent {\n if (/^\\d+$/.test(key)) {\n return parseInt(key, 10);\n }\n else if (key in ColorComponentMap) {\n return (ColorComponentMap as any)[key];\n }\n else if (key in ColorComponent) {\n return (ColorComponent as any)[key];\n }\n throw new ZWaveError(`Invalid color key ${key}!`, ZWaveErrorCodes.Argument_Invalid);\n}\nfunction colorComponentToTableKey(component: ColorComponent): ColorKey | undefined {\n for (const [key, comp] of Object.entries(ColorComponentMap)) {\n if (comp === component)\n return key as any;\n }\n}\nimport { ColorSwitchCCValues } from \"./_CCValues.generated.js\";\nexport { ColorSwitchCCValues };\n@API(CommandClasses[\"Color Switch\"])\nexport class ColorSwitchCCAPI extends CCAPI {\n public supportsCommand(cmd: ColorSwitchCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ColorSwitchCommand.SupportedGet:\n case ColorSwitchCommand.Get:\n return this.isSinglecast();\n case ColorSwitchCommand.Set:\n case ColorSwitchCommand.StartLevelChange:\n case ColorSwitchCommand.StopLevelChange:\n return true; // These are mandatory\n }\n return super.supportsCommand(cmd);\n }\n public async getSupported(): Promise<MaybeNotKnown<readonly ColorComponent[]>> {\n this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.SupportedGet);\n const cc = new ColorSwitchCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ColorSwitchCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedColorComponents;\n }\n @validateArgs_ColorSwitchCCAPI_get()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get(component: ColorComponent) {\n this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Get);\n const cc = new ColorSwitchCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n colorComponent: component,\n });\n const response = await this.host.sendCommand<ColorSwitchCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"currentValue\", \"targetValue\", \"duration\"]);\n }\n }\n @validateArgs_ColorSwitchCCAPI_set()\n public async set(options: ColorSwitchCCSetOptions): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Set);\n const cc = new ColorSwitchCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n const result = await this.host.sendCommand(cc, this.commandOptions);\n if (isUnsupervisedOrSucceeded(result)) {\n // If the command did not fail, assume that it succeeded and update the values accordingly\n // TODO: The API methods should not modify the value DB directly, but to do so\n // this requires a nicer way of synchronizing hexColor with the others\n if (this.isSinglecast()) {\n // Update each color component separately and record the changes to the compound value\n this.updateCurrentColor(this.getValueDB(), cc.colorTable);\n }\n else if (this.isMulticast()) {\n // Figure out which nodes were affected by this command\n const affectedNodes = this.endpoint.node.physicalNodes.filter((node) => node\n .getEndpoint(this.endpoint.index)\n ?.supportsCC(this.ccId));\n // and optimistically update the currentColor\n for (const node of affectedNodes) {\n const valueDB = this.host.tryGetValueDB(node.id);\n if (valueDB) {\n this.updateCurrentColor(valueDB, cc.colorTable);\n }\n }\n }\n }\n return result;\n }\n /** Updates the current color for a given node by merging in the given changes */\n private updateCurrentColor(valueDB: ValueDB, colorTable: ColorTable) {\n let updatedRGB = false;\n const currentColorValueId = ColorSwitchCCValues.currentColor.endpoint(this.endpoint.index);\n const targetColorValueId = ColorSwitchCCValues.targetColor.endpoint(this.endpoint.index);\n const currentCompoundColor = valueDB.getValue<Partial<Record<ColorKey, number>>>(currentColorValueId) ?? {};\n const targetCompoundColor = valueDB.getValue<Partial<Record<ColorKey, number>>>(targetColorValueId) ?? {};\n for (const [key, value] of Object.entries(colorTable)) {\n const component = colorTableKeyToComponent(key);\n if (component === ColorComponent.Red\n || component === ColorComponent.Green\n || component === ColorComponent.Blue) {\n updatedRGB = true;\n }\n valueDB.setValue(ColorSwitchCCValues.currentColorChannel(component).endpoint(this.endpoint.index), value);\n // Update the compound value\n if (key in ColorComponentMap) {\n currentCompoundColor[key as ColorKey] = value;\n targetCompoundColor[key as ColorKey] = value;\n }\n }\n // And store the updated compound values\n valueDB.setValue(currentColorValueId, currentCompoundColor);\n valueDB.setValue(targetColorValueId, targetCompoundColor);\n // and hex color if necessary\n const supportsHex = valueDB.getValue<boolean>(ColorSwitchCCValues.supportsHexColor.endpoint(this.endpoint.index));\n if (supportsHex && updatedRGB) {\n const hexValueId = ColorSwitchCCValues.hexColor.endpoint(this.endpoint.index);\n const [r, g, b] = [\n ColorComponent.Red,\n ColorComponent.Green,\n ColorComponent.Blue,\n ].map((c) => valueDB.getValue<number>(ColorSwitchCCValues.currentColorChannel(c).endpoint(this.endpoint.index)) ?? 0);\n const hexValue = (r << 16) | (g << 8) | b;\n valueDB.setValue(hexValueId, hexValue.toString(16).padStart(6, \"0\"));\n }\n }\n @validateArgs_ColorSwitchCCAPI_startLevelChange()\n public async startLevelChange(options: ColorSwitchCCStartLevelChangeOptions): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.StartLevelChange);\n const cc = new ColorSwitchCCStartLevelChange({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_ColorSwitchCCAPI_stopLevelChange()\n public async stopLevelChange(colorComponent: ColorComponent): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.StopLevelChange);\n const cc = new ColorSwitchCCStopLevelChange({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n colorComponent,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ColorSwitchCCAPI, { property, propertyKey }, value, options) {\n if (property === \"targetColor\") {\n const duration = Duration.from(options?.transitionDuration);\n if (propertyKey != undefined) {\n // Single color component, only accepts numbers\n if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n else if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n const result = await this.set({\n [propertyKey]: value,\n duration,\n });\n if (this.isSinglecast()\n && !supervisedCommandSucceeded(result)) {\n // Verify the current value after a (short) delay, unless the command was supervised and successful\n this.schedulePoll({ property, propertyKey }, value, {\n duration,\n transition: \"fast\",\n });\n }\n return result;\n }\n else {\n // Set the compound color object\n // Ensure the value is an object with only valid keys\n if (!isObject(value)\n || !Object.keys(value).every((key) => key in ColorComponentMap)) {\n throw new ZWaveError(`${CommandClasses[this.ccId]}: \"${property}\" must be set to an object which specifies each color channel`, ZWaveErrorCodes.Argument_Invalid);\n }\n // Ensure that each property is numeric\n for (const [key, val] of Object.entries(value)) {\n if (typeof val !== \"number\") {\n throwWrongValueType(this.ccId, `${property}.${key}`, \"number\", typeof val);\n }\n }\n // GH#2527: strip unsupported color components, because some devices don't react otherwise\n if (this.isSinglecast()) {\n const supportedColors = this.tryGetValueDB()?.getValue<readonly ColorComponent[]>(ColorSwitchCCValues.supportedColorComponents.endpoint(this.endpoint.index));\n if (supportedColors) {\n value = pick(value, supportedColors\n .map((c) => colorComponentToTableKey(c))\n .filter((c) => !!c));\n }\n }\n // Avoid sending empty commands\n if (Object.keys(value as any).length === 0)\n return;\n return this.set({ ...(value as ColorTable), duration });\n // We're not going to poll each color component separately\n }\n }\n else if (property === \"hexColor\") {\n // No property key, this is the hex color #rrggbb\n if (typeof value !== \"string\") {\n throwWrongValueType(this.ccId, property, \"string\", typeof value);\n }\n const duration = Duration.from(options?.transitionDuration);\n return this.set({ hexColor: value, duration });\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n public isSetValueOptimistic(_valueId: ValueID): boolean {\n return false; // Color Switch CC handles updating the value DB itself\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ColorSwitchCCAPI, { property, propertyKey }) {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n switch (property) {\n case \"currentColor\":\n return (await this.get(propertyKey))?.currentValue;\n case \"targetColor\":\n return (await this.get(propertyKey))?.targetValue;\n case \"duration\":\n return (await this.get(propertyKey))?.duration;\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n}\n@commandClass(CommandClasses[\"Color Switch\"])\n@implementedVersion(3)\n@ccValues(ColorSwitchCCValues)\nexport class ColorSwitchCC extends CommandClass {\n declare ccCommand: ColorSwitchCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Color Switch\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported colors...\",\n direction: \"outbound\",\n });\n const supportedColors = await api.getSupported();\n if (!supportedColors) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported colors timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(\"received supported colors:\", {\n nested: logList(supportedColors.map((c) => getEnumMemberName(ColorComponent, c))),\n }),\n direction: \"outbound\",\n });\n // Create metadata for the separate color channels\n for (const color of supportedColors) {\n const currentColorChannelValue = ColorSwitchCCValues.currentColorChannel(color);\n this.setMetadata(ctx, currentColorChannelValue);\n const targetColorChannelValue = ColorSwitchCCValues.targetColorChannel(color);\n this.setMetadata(ctx, targetColorChannelValue);\n }\n // And the compound one\n const currentColorValue = ColorSwitchCCValues.currentColor;\n this.setMetadata(ctx, currentColorValue);\n const targetColorValue = ColorSwitchCCValues.targetColor;\n this.setMetadata(ctx, targetColorValue);\n // Create the collective HEX color values\n const supportsHex = [\n ColorComponent.Red,\n ColorComponent.Green,\n ColorComponent.Blue,\n ].every((c) => supportedColors.includes(c));\n this.setValue(ctx, ColorSwitchCCValues.supportsHexColor, supportsHex);\n if (supportsHex) {\n const hexColorValue = ColorSwitchCCValues.hexColor;\n this.setMetadata(ctx, hexColorValue);\n }\n // Query all color components\n await this.refreshValues(ctx, {\n tag: \"interview\",\n onProgress: (completed, total) => node.reportInterviewProgress(completed, total),\n });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Color Switch\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n const supportedColors: readonly ColorComponent[] = this.getValue(ctx, ColorSwitchCCValues.supportedColorComponents)\n ?? [];\n for (const [i, color] of supportedColors.entries()) {\n // Some devices report invalid colors, but the CC API checks\n // for valid values and throws otherwise.\n if (!isEnumMember(ColorComponent, color))\n continue;\n const colorName = getEnumMemberName(ColorComponent, color);\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current color state (${colorName})`,\n direction: \"outbound\",\n });\n await api.get(color);\n options?.onProgress?.(i + 1, supportedColors.length);\n }\n }\n public translatePropertyKey(ctx: GetValueDB, property: string | number, propertyKey: string | number): string | undefined {\n if ((property === \"currentColor\" || property === \"targetColor\")\n && typeof propertyKey === \"number\") {\n const translated = ColorComponent[propertyKey];\n if (translated)\n return translated;\n }\n return super.translatePropertyKey(ctx, property, propertyKey);\n }\n}\n// @publicAPI\nexport interface ColorSwitchCCSupportedReportOptions {\n supportedColorComponents: readonly ColorComponent[];\n}\n@CCCommand(ColorSwitchCommand.SupportedReport)\n@ccValueProperty(\"supportedColorComponents\", ColorSwitchCCValues.supportedColorComponents)\nexport class ColorSwitchCCSupportedReport extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCSupportedReportOptions>) {\n super(options);\n this.supportedColorComponents = options.supportedColorComponents;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCSupportedReport {\n // Docs say 'variable length', but the table shows 2 bytes.\n validatePayload(raw.payload.length >= 2);\n const supportedColorComponents: ColorComponent[] = parseBitMask(raw.payload.subarray(0, 2), ColorComponent[\"Warm White\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedColorComponents,\n });\n }\n public readonly supportedColorComponents: readonly ColorComponent[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = encodeBitMask(this.supportedColorComponents, 15, // fixed 2 bytes\n ColorComponent[\"Warm White\"]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported color components\": logList(this.supportedColorComponents.map((c) => getEnumMemberName(ColorComponent, c))),\n },\n };\n }\n}\n@CCCommand(ColorSwitchCommand.SupportedGet)\n@expectedCCResponse(ColorSwitchCCSupportedReport)\nexport class ColorSwitchCCSupportedGet extends ColorSwitchCC {\n}\n// @publicAPI\nexport interface ColorSwitchCCReportOptions {\n colorComponent: ColorComponent;\n currentValue: number;\n targetValue?: number;\n duration?: Duration | string;\n}\n@CCCommand(ColorSwitchCommand.Report)\n@ccValueProperty(\"currentValue\", ColorSwitchCCValues.currentColorChannel, (self) => [self.colorComponent])\n@ccValueProperty(\"targetValue\", ColorSwitchCCValues.targetColorChannel, (self) => [self.colorComponent])\n@ccValueProperty(\"duration\", ColorSwitchCCValues.duration)\nexport class ColorSwitchCCReport extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCReportOptions>) {\n super(options);\n this.colorComponent = options.colorComponent;\n this.currentValue = options.currentValue;\n this.targetValue = options.targetValue;\n this.duration = Duration.from(options.duration);\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCReport {\n validatePayload(raw.payload.length >= 2);\n const colorComponent: ColorComponent = raw.payload[0];\n validatePayload(isEnumMember(ColorComponent, colorComponent));\n const currentValue = raw.payload[1];\n let targetValue: number | undefined;\n let duration: Duration | undefined;\n if (raw.payload.length >= 4) {\n targetValue = raw.payload[2];\n duration = Duration.parseReport(raw.payload[3]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n colorComponent,\n currentValue,\n targetValue,\n duration,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n // Duration is stored globally instead of per component\n if (!super.persistValues(ctx))\n return false;\n // Update compound current value\n const colorTableKey = colorComponentToTableKey(this.colorComponent);\n if (colorTableKey) {\n const compoundCurrentColorValue = ColorSwitchCCValues.currentColor;\n const compoundCurrentColor: Partial<Record<ColorKey, number>> = this.getValue(ctx, compoundCurrentColorValue) ?? {};\n compoundCurrentColor[colorTableKey] = this.currentValue;\n this.setValue(ctx, compoundCurrentColorValue, compoundCurrentColor);\n // and target value\n if (this.targetValue != undefined) {\n const compoundTargetColorValue = ColorSwitchCCValues.targetColor;\n const compoundTargetColor: Partial<Record<ColorKey, number>> = this.getValue(ctx, compoundTargetColorValue) ?? {};\n compoundTargetColor[colorTableKey] = this.targetValue;\n this.setValue(ctx, compoundTargetColorValue, compoundTargetColor);\n }\n }\n // Update collective hex value if required\n const supportsHex = !!this.getValue(ctx, ColorSwitchCCValues.supportsHexColor);\n if (supportsHex\n && (this.colorComponent === ColorComponent.Red\n || this.colorComponent === ColorComponent.Green\n || this.colorComponent === ColorComponent.Blue)) {\n const hexColorValue = ColorSwitchCCValues.hexColor;\n const hexValue: string = this.getValue(ctx, hexColorValue) ?? \"000000\";\n const byteOffset = ColorComponent.Blue - this.colorComponent;\n const byteMask = 0xff << (byteOffset * 8);\n let hexValueNumeric = parseInt(hexValue, 16);\n hexValueNumeric =\n (hexValueNumeric & ~byteMask)\n | (this.currentValue << (byteOffset * 8));\n this.setValue(ctx, hexColorValue, hexValueNumeric.toString(16).padStart(6, \"0\"));\n }\n return true;\n }\n public readonly colorComponent: ColorComponent;\n public readonly currentValue: number;\n public readonly targetValue: number | undefined;\n public readonly duration: Duration | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.colorComponent, this.currentValue]);\n if (this.targetValue != undefined && this.duration != undefined) {\n this.payload = Bytes.concat([\n this.payload,\n [\n this.targetValue ?? 0xfe,\n (this.duration ?? Duration.default()).serializeReport(),\n ],\n ]);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"color component\": getEnumMemberName(ColorComponent, this.colorComponent),\n \"current value\": this.currentValue,\n };\n if (this.targetValue != undefined) {\n message[\"target value\"] = this.targetValue;\n }\n if (this.duration != undefined) {\n message.duration = this.duration.toString();\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ColorSwitchCCGetOptions {\n colorComponent: ColorComponent;\n}\nfunction testResponseForColorSwitchGet(sent: ColorSwitchCCGet, received: ColorSwitchCCReport) {\n return sent.colorComponent === received.colorComponent;\n}\n@CCCommand(ColorSwitchCommand.Get)\n@expectedCCResponse(ColorSwitchCCReport, testResponseForColorSwitchGet)\nexport class ColorSwitchCCGet extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCGetOptions>) {\n super(options);\n this._colorComponent = options.colorComponent;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCGet {\n validatePayload(raw.payload.length >= 1);\n const colorComponent: ColorComponent = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n colorComponent,\n });\n }\n private _colorComponent: ColorComponent;\n public get colorComponent(): ColorComponent {\n return this._colorComponent;\n }\n public set colorComponent(value: ColorComponent) {\n if (!ColorComponent[value]) {\n throw new ZWaveError(\"colorComponent must be a valid color component index.\", ZWaveErrorCodes.Argument_Invalid);\n }\n this._colorComponent = value;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this._colorComponent]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"color component\": getEnumMemberName(ColorComponent, this.colorComponent),\n },\n };\n }\n}\n// @publicAPI\nexport type ColorSwitchCCSetOptions = (ColorTable | {\n hexColor: string;\n}) & {\n duration?: Duration | string;\n};\n@CCCommand(ColorSwitchCommand.Set)\n@useSupervision()\nexport class ColorSwitchCCSet extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCSetOptions>) {\n super(options);\n // Populate properties from options object\n if (\"hexColor\" in options) {\n const match = hexColorRegex.exec(options.hexColor);\n if (!match) {\n throw new ZWaveError(`${options.hexColor} is not a valid HEX color string`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.colorTable = {\n red: parseInt(match.groups!.red, 16),\n green: parseInt(match.groups!.green, 16),\n blue: parseInt(match.groups!.blue, 16),\n };\n }\n else {\n this.colorTable = pick(options, colorTableKeys as any[]);\n }\n this.duration = Duration.from(options.duration);\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCSet {\n validatePayload(raw.payload.length >= 1);\n const populatedColorCount = raw.payload[0] & 0b11111;\n validatePayload(raw.payload.length >= 1 + populatedColorCount * 2);\n const colorTable: ColorTable = {};\n let offset = 1;\n for (let color = 0; color < populatedColorCount; color++) {\n const component = raw.payload[offset];\n const value = raw.payload[offset + 1];\n const key = colorComponentToTableKey(component);\n if (key) {\n // @ts-expect-error\n this.colorTable[key] = value;\n }\n offset += 2;\n }\n let duration: Duration | undefined;\n if (raw.payload.length > offset) {\n duration = Duration.parseSet(raw.payload[offset]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n ...colorTable,\n duration,\n });\n }\n public colorTable: ColorTable;\n public duration: Duration | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const populatedColorCount = Object.keys(this.colorTable).length;\n this.payload = new Bytes(1 + populatedColorCount * 2 + 1);\n this.payload[0] = populatedColorCount & 0b11111;\n let i = 1;\n for (const [key, value] of Object.entries(this.colorTable)) {\n const component = colorTableKeyToComponent(key);\n this.payload[i] = component;\n this.payload[i + 1] = clamp(value, 0, 0xff);\n i += 2;\n }\n this.payload[i] = (this.duration ?? Duration.default()).serializeSet();\n const ccVersion = getEffectiveCCVersion(ctx, this);\n if (ccVersion < 2\n && ctx.getDeviceConfig?.(this.nodeId as number)?.compat\n ?.encodeCCsUsingTargetVersion) {\n // When forcing CC version 1, omit the duration byte\n this.payload = this.payload.subarray(0, -1);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n for (const [key, value] of Object.entries(this.colorTable)) {\n const realKey: string = key in ColorComponentMap\n ? (ColorComponent as any)[(ColorComponentMap as any)[key]]\n : (ColorComponent as any)[key];\n message[realKey] = value;\n }\n if (this.duration != undefined) {\n message.duration = this.duration.toString();\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport type ColorSwitchCCStartLevelChangeOptions = {\n colorComponent: ColorComponent;\n direction: keyof typeof LevelChangeDirection;\n} & ({\n ignoreStartLevel: true;\n startLevel?: number;\n} | {\n ignoreStartLevel: false;\n startLevel: number;\n}) & {\n // Version >= 3:\n duration?: Duration | string;\n};\n@CCCommand(ColorSwitchCommand.StartLevelChange)\n@useSupervision()\nexport class ColorSwitchCCStartLevelChange extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCStartLevelChangeOptions>) {\n super(options);\n this.duration = Duration.from(options.duration);\n this.ignoreStartLevel = options.ignoreStartLevel;\n this.startLevel = options.startLevel ?? 0;\n this.direction = options.direction;\n this.colorComponent = options.colorComponent;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCStartLevelChange {\n validatePayload(raw.payload.length >= 3);\n const ignoreStartLevel = !!((raw.payload[0] & 32) >>> 5);\n const direction = (raw.payload[0] & 64) >>> 6 ? \"down\" : \"up\";\n const colorComponent: ColorComponent = raw.payload[1];\n const startLevel = raw.payload[2];\n let duration: Duration | undefined;\n if (raw.payload.length >= 4) {\n duration = Duration.parseSet(raw.payload[3]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n ignoreStartLevel,\n direction,\n colorComponent,\n startLevel,\n duration,\n });\n }\n public duration: Duration | undefined;\n public startLevel: number;\n public ignoreStartLevel: boolean;\n public direction: keyof typeof LevelChangeDirection;\n public colorComponent: ColorComponent;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const controlByte = (LevelChangeDirection[this.direction] << 6)\n | (this.ignoreStartLevel ? 32 : 0);\n this.payload = Bytes.from([\n controlByte,\n this.colorComponent,\n this.startLevel,\n (this.duration ?? Duration.default()).serializeSet(),\n ]);\n const ccVersion = getEffectiveCCVersion(ctx, this);\n if (ccVersion < 3\n && ctx.getDeviceConfig?.(this.nodeId as number)?.compat\n ?.encodeCCsUsingTargetVersion) {\n // When forcing CC version 1 or 2, omit the duration byte\n this.payload = this.payload.subarray(0, -1);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"color component\": getEnumMemberName(ColorComponent, this.colorComponent),\n \"start level\": `${this.startLevel}${this.ignoreStartLevel ? \" (ignored)\" : \"\"}`,\n direction: this.direction,\n };\n if (this.duration != undefined) {\n message.duration = this.duration.toString();\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ColorSwitchCCStopLevelChangeOptions {\n colorComponent: ColorComponent;\n}\n@CCCommand(ColorSwitchCommand.StopLevelChange)\n@useSupervision()\nexport class ColorSwitchCCStopLevelChange extends ColorSwitchCC {\n public constructor(options: WithAddress<ColorSwitchCCStopLevelChangeOptions>) {\n super(options);\n this.colorComponent = options.colorComponent;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCStopLevelChange {\n validatePayload(raw.payload.length >= 1);\n const colorComponent: ColorComponent = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n colorComponent,\n });\n }\n public readonly colorComponent: ColorComponent;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.colorComponent]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"color component\": getEnumMemberName(ColorComponent, this.colorCompon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