@zwave-js/cc 15.28.0 → 15.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/cc/AlarmSensorCC.d.ts +3 -1
- package/build/cjs/cc/AlarmSensorCC.js +22 -2
- 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 +4 -5
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/BarrierOperatorCC.d.ts +6 -3
- package/build/cjs/cc/BarrierOperatorCC.js +40 -6
- 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 +16 -3
- package/build/cjs/cc/BatteryCC.js.map +2 -2
- 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.d.ts +4 -1
- package/build/cjs/cc/CentralSceneCC.js +34 -2
- package/build/cjs/cc/CentralSceneCC.js.map +2 -2
- package/build/cjs/cc/ClimateControlScheduleCC.d.ts +6 -3
- package/build/cjs/cc/ClimateControlScheduleCC.js +54 -6
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
- package/build/cjs/cc/ClockCC.d.ts +2 -1
- package/build/cjs/cc/ClockCC.js +19 -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.d.ts +3 -2
- package/build/cjs/cc/ConfigurationCC.js +62 -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.map +2 -2
- package/build/cjs/cc/DoorLockLoggingCC.d.ts +3 -1
- package/build/cjs/cc/DoorLockLoggingCC.js +35 -2
- package/build/cjs/cc/DoorLockLoggingCC.js.map +2 -2
- package/build/cjs/cc/EntryControlCC.d.ts +5 -1
- package/build/cjs/cc/EntryControlCC.js +57 -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/HumidityControlModeCC.d.ts +3 -1
- package/build/cjs/cc/HumidityControlModeCC.js +14 -2
- package/build/cjs/cc/HumidityControlModeCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlOperatingStateCC.d.ts +3 -1
- package/build/cjs/cc/HumidityControlOperatingStateCC.js +4 -0
- package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlSetpointCC.d.ts +8 -4
- package/build/cjs/cc/HumidityControlSetpointCC.js +61 -12
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.js +1 -5
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/IrrigationCC.d.ts +15 -9
- package/build/cjs/cc/IrrigationCC.js +260 -24
- package/build/cjs/cc/IrrigationCC.js.map +2 -2
- package/build/cjs/cc/LanguageCC.d.ts +2 -1
- package/build/cjs/cc/LanguageCC.js +18 -2
- package/build/cjs/cc/LanguageCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.js +4 -5
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
- package/build/cjs/cc/MeterCC.js +8 -21
- 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 +5 -2
- package/build/cjs/cc/MultiChannelCC.js +35 -12
- 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.map +2 -2
- package/build/cjs/cc/SceneActuatorConfigurationCC.d.ts +3 -2
- package/build/cjs/cc/SceneActuatorConfigurationCC.js +38 -5
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.d.ts +3 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.js +25 -4
- 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 +2 -1
- 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.d.ts +3 -1
- package/build/cjs/cc/ThermostatFanModeCC.js +17 -2
- package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanStateCC.d.ts +3 -1
- package/build/cjs/cc/ThermostatFanStateCC.js +4 -0
- package/build/cjs/cc/ThermostatFanStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatModeCC.js +2 -4
- 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.d.ts +1 -1
- package/build/cjs/cc/TimeCC.js +11 -2
- package/build/cjs/cc/TimeCC.js.map +2 -2
- package/build/cjs/cc/TransportServiceCC.js.map +2 -2
- package/build/cjs/cc/UserCodeCC.d.ts +2 -1
- package/build/cjs/cc/UserCodeCC.js +32 -8
- package/build/cjs/cc/UserCodeCC.js.map +2 -2
- package/build/cjs/cc/UserCredentialCC.js +4 -6
- package/build/cjs/cc/UserCredentialCC.js.map +2 -2
- package/build/cjs/cc/VersionCC.d.ts +1 -0
- package/build/cjs/cc/VersionCC.js +32 -0
- package/build/cjs/cc/VersionCC.js.map +2 -2
- package/build/cjs/cc/WakeUpCC.d.ts +2 -0
- package/build/cjs/cc/WakeUpCC.js +14 -0
- package/build/cjs/cc/WakeUpCC.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 +2 -2
- 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/cc/manufacturerProprietary/FibaroCC.d.ts +2 -1
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +30 -2
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.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 +20 -0
- package/build/cjs/lib/CommandClass.js +52 -11
- 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 +30 -30
- package/build/cjs/lib/_Types.js.map +2 -2
- 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 +3 -1
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +26 -9
- 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 +10 -12
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts +6 -3
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +55 -27
- 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 +12 -12
- 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 +4 -5
- 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 +4 -1
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +37 -7
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts +6 -3
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +63 -18
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.d.ts +2 -1
- package/build/esm/cc/ClockCC.d.ts.map +1 -1
- package/build/esm/cc/ClockCC.js +26 -9
- 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 +3 -2
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +83 -41
- 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 +25 -29
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.d.ts +3 -1
- package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.js +39 -5
- package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts +5 -1
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +74 -14
- 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/HumidityControlModeCC.d.ts +3 -1
- package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.js +15 -7
- package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts +3 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.js +5 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.d.ts +8 -4
- package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +60 -34
- 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 +19 -38
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts +15 -9
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +276 -67
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.d.ts +2 -1
- package/build/esm/cc/LanguageCC.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC.js +18 -6
- package/build/esm/cc/LanguageCC.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.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +5 -8
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +15 -29
- 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 +5 -2
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +43 -29
- 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 +10 -9
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts +3 -2
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +44 -21
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts +3 -2
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +35 -28
- 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 +2 -1
- 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 +3 -1
- package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +19 -9
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.d.ts +3 -1
- package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js +5 -1
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +2 -4
- 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 +1 -1
- package/build/esm/cc/TimeCC.d.ts.map +1 -1
- package/build/esm/cc/TimeCC.js +18 -9
- 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 +2 -1
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +51 -36
- 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 +42 -59
- package/build/esm/cc/UserCredentialCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts +1 -0
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +37 -3
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.d.ts +2 -0
- package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
- package/build/esm/cc/WakeUpCC.js +14 -0
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +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 +2 -2
- package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
- package/build/esm/cc/_CCValues.generated.js +637 -678
- 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/cc/manufacturerProprietary/FibaroCC.d.ts +2 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +34 -4
- package/build/esm/cc/manufacturerProprietary/FibaroCC.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 +20 -0
- package/build/esm/lib/CommandClass.d.ts.map +1 -1
- package/build/esm/lib/CommandClass.js +50 -16
- 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 +30 -30
- package/build/esm/lib/_Types.d.ts.map +1 -1
- 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/BinarySwitchCC.ts"],
|
|
4
|
-
"sourcesContent": ["import * as __validateArgs from \"./BinarySwitchCC._validateArgs.js\";\nconst { validateArgs_BinarySwitchCCAPI_set } = __validateArgs;\nimport { CommandClasses, Duration, type GetValueDB, type MaybeNotKnown, type MaybeUnknown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, UNKNOWN_STATE, ValueMetadata, type WithAddress, encodeMaybeBoolean, maybeUnknownToString, parseMaybeBoolean, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, SET_VALUE_HOOKS, type SetValueImplementation, type SetValueImplementationHooksFactory, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, 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 { BinarySwitchCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { BinarySwitchCCValues } from \"./_CCValues.generated.js\";\nexport { BinarySwitchCCValues };\n@API(CommandClasses[\"Binary Switch\"])\nexport class BinarySwitchCCAPI extends CCAPI {\n public supportsCommand(cmd: BinarySwitchCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case BinarySwitchCommand.Get:\n return this.isSinglecast();\n case BinarySwitchCommand.Set:\n return true;\n }\n return super.supportsCommand(cmd);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(BinarySwitchCommand, BinarySwitchCommand.Get);\n const cc = new BinarySwitchCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<BinarySwitchCCReport>(cc, this.commandOptions);\n if (response) {\n return {\n // interpret unknown values as false\n currentValue: response.currentValue || false,\n targetValue: response.targetValue,\n duration: response.duration,\n };\n }\n }\n /**\n * Sets the switch to the given value\n * @param targetValue The target value to set\n * @param duration The duration after which the target value should be reached. Can be a Duration instance or a user-friendly duration string like `\"1m17s\"`. Only supported in V2 and above.\n */\n @validateArgs_BinarySwitchCCAPI_set()\n public async set(targetValue: boolean, duration?: Duration | string): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(BinarySwitchCommand, BinarySwitchCommand.Set);\n const cc = new BinarySwitchCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n targetValue,\n duration,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: BinarySwitchCCAPI, { property }, value, options) {\n if (property !== \"targetValue\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof value !== \"boolean\") {\n throwWrongValueType(this.ccId, property, \"boolean\", typeof value);\n }\n const duration = Duration.from(options?.transitionDuration);\n return this.set(value, duration);\n };\n }\n protected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory = ({ property }, value, options) => {\n if (property === \"targetValue\") {\n const currentValueValueId = BinarySwitchCCValues.currentValue\n .endpoint(this.endpoint.index);\n return {\n // This is the target value for a split target/current state pair.\n isSplitStateTargetValue: true,\n optimisticallyUpdateRelatedValues: (_supervisedAndSuccessful) => {\n // After setting targetValue, optimistically update currentValue\n if (this.isSinglecast()) {\n this.tryGetValueDB()?.setValue(currentValueValueId, value);\n }\n else if (this.isMulticast()) {\n // Figure out which nodes were affected by this command\n const affectedNodes = this.endpoint.node.physicalNodes\n .filter((node) => node\n .getEndpoint(this.endpoint.index)\n ?.supportsCC(this.ccId));\n // and optimistically update the currentValue\n for (const node of affectedNodes) {\n this.host\n .tryGetValueDB(node.id)\n ?.setValue(currentValueValueId, value);\n }\n }\n },\n verifyChanges: () => {\n if (this.isSinglecast()) {\n // We query currentValue instead of targetValue to make sure that unsolicited updates cancel the scheduled poll\n this.schedulePoll(currentValueValueId, value, {\n duration: Duration.from(options?.transitionDuration),\n // on/off \"transitions\" are usually fast\n transition: \"fast\",\n });\n }\n else {\n // For multicasts, do not schedule a refresh - this could cause a LOT of traffic\n }\n },\n };\n }\n };\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: BinarySwitchCCAPI, { property }) {\n switch (property) {\n case \"currentValue\":\n case \"targetValue\":\n case \"duration\":\n return (await this.get())?.[property];\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n}\n@commandClass(CommandClasses[\"Binary Switch\"])\n@implementedVersion(2)\n@ccValues(BinarySwitchCCValues)\nexport class BinarySwitchCC extends CommandClass {\n declare ccCommand: BinarySwitchCommand;\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[\"Binary Switch\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the current state\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying Binary Switch state...\",\n direction: \"outbound\",\n });\n const resp = await api.get();\n if (resp) {\n let logMessage = `received Binary Switch state:\ncurrent value: ${resp.currentValue}`;\n if (resp.targetValue != undefined) {\n logMessage += `\ntarget value: ${resp.targetValue}\nremaining duration: ${resp.duration?.toString() ?? \"undefined\"}`;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n public setMappedBasicValue(ctx: GetValueDB, value: number): boolean {\n this.setValue(ctx, BinarySwitchCCValues.currentValue, value > 0);\n return true;\n }\n}\n// @publicAPI\nexport interface BinarySwitchCCSetOptions {\n targetValue: boolean;\n duration?: Duration | string;\n}\n@CCCommand(BinarySwitchCommand.Set)\n@useSupervision()\nexport class BinarySwitchCCSet extends BinarySwitchCC {\n public constructor(options: WithAddress<BinarySwitchCCSetOptions>) {\n super(options);\n this.targetValue = options.targetValue;\n this.duration = Duration.from(options.duration);\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): BinarySwitchCCSet {\n validatePayload(raw.payload.length >= 1);\n const targetValue = !!raw.payload[0];\n let duration: Duration | undefined;\n if (raw.payload.length >= 2) {\n duration = Duration.parseSet(raw.payload[1]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n targetValue,\n duration,\n });\n }\n public targetValue: boolean;\n public duration: Duration | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.targetValue ? 0xff : 0x00,\n (this.duration ?? Duration.default()).serializeSet(),\n ]);\n const ccVersion = getEffectiveCCVersion(ctx, this);\n if (ccVersion < 2 && ctx.getDeviceConfig?.(this.nodeId as number)?.compat?.encodeCCsUsingTargetVersion) {\n // When forcing CC version 1, only send the target value\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 \"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 BinarySwitchCCReportOptions {\n currentValue?: MaybeUnknown<boolean>;\n targetValue?: MaybeUnknown<boolean>;\n duration?: Duration | string;\n}\n@CCCommand(BinarySwitchCommand.Report)\n@ccValueProperty(\"currentValue\", BinarySwitchCCValues.currentValue)\n@ccValueProperty(\"targetValue\", BinarySwitchCCValues.targetValue)\n@ccValueProperty(\"duration\", BinarySwitchCCValues.duration)\nexport class BinarySwitchCCReport extends BinarySwitchCC {\n public constructor(options: WithAddress<BinarySwitchCCReportOptions>) {\n super(options);\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): BinarySwitchCCReport {\n validatePayload(raw.payload.length >= 1);\n const currentValue: MaybeUnknown<boolean> | undefined = parseMaybeBoolean(raw.payload[0]);\n let targetValue: MaybeUnknown<boolean> | undefined;\n let duration: Duration | undefined;\n if (raw.payload.length >= 3) {\n targetValue = parseMaybeBoolean(raw.payload[1]);\n duration = Duration.parseReport(raw.payload[2]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n currentValue,\n targetValue,\n duration,\n });\n }\n public readonly currentValue: MaybeUnknown<boolean> | undefined;\n public readonly targetValue: MaybeUnknown<boolean> | undefined;\n public readonly duration: Duration | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n encodeMaybeBoolean(this.currentValue ?? UNKNOWN_STATE),\n ]);\n if (this.targetValue !== undefined) {\n this.payload = Bytes.concat([\n this.payload,\n [\n encodeMaybeBoolean(this.targetValue),\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 \"current value\": maybeUnknownToString(this.currentValue),\n };\n if (this.targetValue !== undefined) {\n message[\"target value\"] = maybeUnknownToString(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@CCCommand(BinarySwitchCommand.Get)\n@expectedCCResponse(BinarySwitchCCReport)\nexport class BinarySwitchCCGet extends BinarySwitchCC {\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAuT;AACvT,oBAAsB;AACtB,iBAAkN;AAClN,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import * as __validateArgs from \"./BinarySwitchCC._validateArgs.js\";\nconst { validateArgs_BinarySwitchCCAPI_set } = __validateArgs;\nimport { CommandClasses, Duration, type GetValueDB, type MaybeNotKnown, type MaybeUnknown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, UNKNOWN_STATE, ValueMetadata, type WithAddress, encodeMaybeBoolean, maybeUnknownToString, parseMaybeBoolean, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, SET_VALUE_HOOKS, type SetValueImplementation, type SetValueImplementationHooksFactory, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, CommandRelation, type InterviewContext, 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 { BinarySwitchCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { BinarySwitchCCValues } from \"./_CCValues.generated.js\";\nexport { BinarySwitchCCValues };\n@API(CommandClasses[\"Binary Switch\"])\nexport class BinarySwitchCCAPI extends CCAPI {\n public supportsCommand(cmd: BinarySwitchCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case BinarySwitchCommand.Get:\n return this.isSinglecast();\n case BinarySwitchCommand.Set:\n return true;\n }\n return super.supportsCommand(cmd);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(BinarySwitchCommand, BinarySwitchCommand.Get);\n const cc = new BinarySwitchCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<BinarySwitchCCReport>(cc, this.commandOptions);\n if (response) {\n return {\n // interpret unknown values as false\n currentValue: response.currentValue || false,\n targetValue: response.targetValue,\n duration: response.duration,\n };\n }\n }\n /**\n * Sets the switch to the given value\n * @param targetValue The target value to set\n * @param duration The duration after which the target value should be reached. Can be a Duration instance or a user-friendly duration string like `\"1m17s\"`. Only supported in V2 and above.\n */\n @validateArgs_BinarySwitchCCAPI_set()\n public async set(targetValue: boolean, duration?: Duration | string): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(BinarySwitchCommand, BinarySwitchCommand.Set);\n const cc = new BinarySwitchCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n targetValue,\n duration,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: BinarySwitchCCAPI, { property }, value, options) {\n if (property !== \"targetValue\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof value !== \"boolean\") {\n throwWrongValueType(this.ccId, property, \"boolean\", typeof value);\n }\n const duration = Duration.from(options?.transitionDuration);\n return this.set(value, duration);\n };\n }\n protected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory = ({ property }, value, options) => {\n if (property === \"targetValue\") {\n const currentValueValueId = BinarySwitchCCValues.currentValue.endpoint(this.endpoint.index);\n return {\n // This is the target value for a split target/current state pair.\n isSplitStateTargetValue: true,\n optimisticallyUpdateRelatedValues: (_supervisedAndSuccessful) => {\n // After setting targetValue, optimistically update currentValue\n if (this.isSinglecast()) {\n this.tryGetValueDB()?.setValue(currentValueValueId, value);\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 currentValue\n for (const node of affectedNodes) {\n this.host\n .tryGetValueDB(node.id)\n ?.setValue(currentValueValueId, value);\n }\n }\n },\n verifyChanges: () => {\n if (this.isSinglecast()) {\n // We query currentValue instead of targetValue to make sure that unsolicited updates cancel the scheduled poll\n this.schedulePoll(currentValueValueId, value, {\n duration: Duration.from(options?.transitionDuration),\n // on/off \"transitions\" are usually fast\n transition: \"fast\",\n });\n }\n else {\n // For multicasts, do not schedule a refresh - this could cause a LOT of traffic\n }\n },\n };\n }\n };\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: BinarySwitchCCAPI, { property }) {\n switch (property) {\n case \"currentValue\":\n case \"targetValue\":\n case \"duration\":\n return (await this.get())?.[property];\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n}\n@commandClass(CommandClasses[\"Binary Switch\"])\n@implementedVersion(2)\n@ccValues(BinarySwitchCCValues)\nexport class BinarySwitchCC extends CommandClass {\n declare ccCommand: BinarySwitchCommand;\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[\"Binary Switch\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the current state\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying Binary Switch state...\",\n direction: \"outbound\",\n });\n const resp = await api.get();\n if (resp) {\n let logMessage = `received Binary Switch state:\ncurrent value: ${resp.currentValue}`;\n if (resp.targetValue != undefined) {\n logMessage += `\ntarget value: ${resp.targetValue}\nremaining duration: ${resp.duration?.toString() ?? \"undefined\"}`;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n public setMappedBasicValue(ctx: GetValueDB, value: number): boolean {\n this.setValue(ctx, BinarySwitchCCValues.currentValue, value > 0);\n return true;\n }\n}\n// @publicAPI\nexport interface BinarySwitchCCSetOptions {\n targetValue: boolean;\n duration?: Duration | string;\n}\n@CCCommand(BinarySwitchCommand.Set)\n@useSupervision()\nexport class BinarySwitchCCSet extends BinarySwitchCC {\n public constructor(options: WithAddress<BinarySwitchCCSetOptions>) {\n super(options);\n this.targetValue = options.targetValue;\n this.duration = Duration.from(options.duration);\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): BinarySwitchCCSet {\n validatePayload(raw.payload.length >= 1);\n const targetValue = !!raw.payload[0];\n let duration: Duration | undefined;\n if (raw.payload.length >= 2) {\n duration = Duration.parseSet(raw.payload[1]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n targetValue,\n duration,\n });\n }\n public targetValue: boolean;\n public duration: Duration | undefined;\n protected override determineRelation(other: CommandClass): CommandRelation {\n if (other instanceof BinarySwitchCCSet) {\n return this.targetValue === other.targetValue\n && (this.duration ?? Duration.default()).equals(other.duration ?? Duration.default())\n ? CommandRelation.Redundant\n : CommandRelation.Supersedes;\n }\n return CommandRelation.Unrelated;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.targetValue ? 0xff : 0x00,\n (this.duration ?? Duration.default()).serializeSet(),\n ]);\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, only send the target value\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 \"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 BinarySwitchCCReportOptions {\n currentValue?: MaybeUnknown<boolean>;\n targetValue?: MaybeUnknown<boolean>;\n duration?: Duration | string;\n}\n@CCCommand(BinarySwitchCommand.Report)\n@ccValueProperty(\"currentValue\", BinarySwitchCCValues.currentValue)\n@ccValueProperty(\"targetValue\", BinarySwitchCCValues.targetValue)\n@ccValueProperty(\"duration\", BinarySwitchCCValues.duration)\nexport class BinarySwitchCCReport extends BinarySwitchCC {\n public constructor(options: WithAddress<BinarySwitchCCReportOptions>) {\n super(options);\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): BinarySwitchCCReport {\n validatePayload(raw.payload.length >= 1);\n const currentValue: MaybeUnknown<boolean> | undefined = parseMaybeBoolean(raw.payload[0]);\n let targetValue: MaybeUnknown<boolean> | undefined;\n let duration: Duration | undefined;\n if (raw.payload.length >= 3) {\n targetValue = parseMaybeBoolean(raw.payload[1]);\n duration = Duration.parseReport(raw.payload[2]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n currentValue,\n targetValue,\n duration,\n });\n }\n public readonly currentValue: MaybeUnknown<boolean> | undefined;\n public readonly targetValue: MaybeUnknown<boolean> | undefined;\n public readonly duration: Duration | undefined;\n protected override determineRelation(other: CommandClass): CommandRelation {\n if (other instanceof BinarySwitchCCReport) {\n return this.currentValue === other.currentValue\n && this.targetValue === other.targetValue\n && (this.duration ?? Duration.default()).equals(other.duration ?? Duration.default())\n ? CommandRelation.Redundant\n : CommandRelation.Supersedes;\n }\n return CommandRelation.Unrelated;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n encodeMaybeBoolean(this.currentValue ?? UNKNOWN_STATE),\n ]);\n if (this.targetValue !== undefined) {\n this.payload = Bytes.concat([\n this.payload,\n [\n encodeMaybeBoolean(this.targetValue),\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 \"current value\": maybeUnknownToString(this.currentValue),\n };\n if (this.targetValue !== undefined) {\n message[\"target value\"] = maybeUnknownToString(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@CCCommand(BinarySwitchCommand.Get)\n@expectedCCResponse(BinarySwitchCCReport)\nexport class BinarySwitchCCGet extends BinarySwitchCC {\n protected override determineRelation(other: CommandClass): CommandRelation {\n if (other instanceof BinarySwitchCCGet) {\n return CommandRelation.Redundant;\n }\n return CommandRelation.Unrelated;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAuT;AACvT,oBAAsB;AACtB,iBAAkN;AAClN,0BAA+J;AAC/J,oCAAiI;AAEjI,mBAAoC;AAEpC,gCAAqC;AATrC,MAAM,EAAE,mCAAkC,IAAK;IAYlC,qBAAiB,MAAA;8BAD7B,mCAAI,2BAAe,eAAe,CAAC,CAAC;;;;oBACE;;;yCAAA,YAAK;WAAA;;;;;;;;AAiCxC,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;AAjCpB,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACF,gBAAgB,KAAwB;AAC3C,cAAQ,KAAK;QACT,KAAK,iCAAoB;AACrB,iBAAO,KAAK,aAAY;QAC5B,KAAK,iCAAoB;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gB,QAAW;AAChC,gBAAQ,cAAc,QAAI,kCAAqB,KAAK,WAAW;MACnE;AACA,UAAI,KAAK,YAAY,QAAW;AAC5B,gBAAQ,WAAW,KAAK,SAAS,SAAQ;MAC7C;AACA,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB;;IAER;;;;IAIS,qBAAiB,MAAA;8BAF7B,yCAAU,iCAAoB,GAAG,OACjC,kDAAmB,oBAAoB,CAAC;;;;oBACF;yCAAA,YAAc;WAAA;;;;;;;;AAArD,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACU,kBAAkB,OAAmB;AACpD,UAAI,iBAAiBC,oBAAmB;AACpC,eAAO,oCAAgB;MAC3B;AACA,aAAO,oCAAgB;IAC3B;;;;",
|
|
6
|
+
"names": ["BinarySwitchCCSet", "BinarySwitchCCReport", "BinarySwitchCCGet"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type WithAddress } from "@zwave-js/core";
|
|
2
|
-
import { CCAPI } from "../lib/API.js";
|
|
3
|
-
import { type CCRaw, CommandClass } from "../lib/CommandClass.js";
|
|
4
2
|
import { Bytes } from "@zwave-js/shared";
|
|
3
|
+
import { CCAPI } from "../lib/API.js";
|
|
4
|
+
import { type CCRaw, CommandClass, CommandRelation } from "../lib/CommandClass.js";
|
|
5
5
|
import { CRC16Command } from "../lib/_Types.js";
|
|
6
6
|
import type { CCEncodingContext, CCParsingContext } from "../lib/traits.js";
|
|
7
7
|
export declare class CRC16CCAPI extends CCAPI {
|
|
@@ -22,6 +22,7 @@ export declare class CRC16CCCommandEncapsulation extends CRC16CC {
|
|
|
22
22
|
constructor(options: WithAddress<CRC16CCCommandEncapsulationOptions>);
|
|
23
23
|
static from(raw: CCRaw, ctx: CCParsingContext): Promise<CRC16CCCommandEncapsulation>;
|
|
24
24
|
encapsulated: CommandClass;
|
|
25
|
+
protected determineRelation(other: CommandClass): CommandRelation;
|
|
25
26
|
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
26
27
|
protected computeEncapsulationOverhead(): number;
|
|
27
28
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
package/build/cjs/cc/CRC16CC.js
CHANGED
|
@@ -26,10 +26,10 @@ __export(CRC16CC_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(CRC16CC_exports);
|
|
27
27
|
var import_tslib = require("tslib");
|
|
28
28
|
var import_core = require("@zwave-js/core");
|
|
29
|
+
var import_shared = require("@zwave-js/shared");
|
|
29
30
|
var import_API = require("../lib/API.js");
|
|
30
31
|
var import_CommandClass = require("../lib/CommandClass.js");
|
|
31
32
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|
|
32
|
-
var import_shared = require("@zwave-js/shared");
|
|
33
33
|
var import_Types = require("../lib/_Types.js");
|
|
34
34
|
const headerBuffer = import_shared.Bytes.from([
|
|
35
35
|
import_core.CommandClasses["CRC-16 Encapsulation"],
|
|
@@ -151,6 +151,12 @@ let CRC16CCCommandEncapsulation = (() => {
|
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
encapsulated;
|
|
154
|
+
determineRelation(other) {
|
|
155
|
+
if (other instanceof CRC16CCCommandEncapsulation2) {
|
|
156
|
+
return this.encapsulated.getRelationTo(other.encapsulated);
|
|
157
|
+
}
|
|
158
|
+
return import_CommandClass.CommandRelation.Unrelated;
|
|
159
|
+
}
|
|
154
160
|
async serialize(ctx) {
|
|
155
161
|
const commandBuffer = await this.encapsulated.serialize(ctx);
|
|
156
162
|
this.payload = import_shared.Bytes.concat([commandBuffer, new import_shared.Bytes(2)]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src_gen/cc/CRC16CC.ts"],
|
|
4
|
-
"sourcesContent": ["import { CRC16_CCITT, CommandClasses, EncapsulationFlags, type GetNode, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type NodeId, type SupportsCC, type WithAddress, validatePayload, } from \"@zwave-js/core\";\nimport { CCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAA+M;AAC/M,iBAAsB;AACtB,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { CRC16_CCITT, CommandClasses, EncapsulationFlags, type GetNode, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type NodeId, type SupportsCC, type WithAddress, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes } from \"@zwave-js/shared\";\nimport { CCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, CommandRelation, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { CRC16Command } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nconst headerBuffer = Bytes.from([\n CommandClasses[\"CRC-16 Encapsulation\"],\n CRC16Command.CommandEncapsulation,\n]);\n// @noSetValueAPI\n// @noInterview This CC only has a single encapsulation command\n// Encapsulation CCs are used internally and too frequently that we\n// want to pay the cost of validating each call\n/* eslint-disable @zwave-js/ccapi-validate-args */\n@API(CommandClasses[\"CRC-16 Encapsulation\"])\nexport class CRC16CCAPI extends CCAPI {\n public supportsCommand(_cmd: CRC16Command): MaybeNotKnown<boolean> {\n // switch (cmd) {\n // \tcase CRC16Command.CommandEncapsulation:\n return true; // This is mandatory\n // }\n // return super.supportsCommand(cmd);\n }\n public async sendEncapsulated(encapsulatedCC: CommandClass): Promise<void> {\n this.assertSupportsCommand(CRC16Command, CRC16Command.CommandEncapsulation);\n const cc = new CRC16CCCommandEncapsulation({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n encapsulated: encapsulatedCC,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n}\n@commandClass(CommandClasses[\"CRC-16 Encapsulation\"])\n@implementedVersion(1)\nexport class CRC16CC extends CommandClass {\n declare ccCommand: CRC16Command;\n /** Tests if a command should be supervised and thus requires encapsulation */\n public static requiresEncapsulation(cc: CommandClass): boolean {\n return (!!(cc.encapsulationFlags & EncapsulationFlags.CRC16)\n && !(cc instanceof CRC16CCCommandEncapsulation));\n }\n /** Encapsulates a command in a CRC-16 CC */\n public static encapsulate(cc: CommandClass): CRC16CCCommandEncapsulation {\n const ret = new CRC16CCCommandEncapsulation({\n nodeId: cc.nodeId,\n encapsulated: cc,\n });\n // Copy the encapsulation flags from the encapsulated command\n // but omit CRC-16, since we're doing that right now\n ret.encapsulationFlags =\n cc.encapsulationFlags & ~EncapsulationFlags.CRC16;\n return ret;\n }\n}\n// @publicAPI\nexport interface CRC16CCCommandEncapsulationOptions {\n encapsulated: CommandClass;\n}\nfunction getCCResponseForCommandEncapsulation(ctx: GetNode<NodeId & SupportsCC>, sent: CRC16CCCommandEncapsulation) {\n if (sent.encapsulated?.expectsCCResponse(ctx)) {\n return CRC16CCCommandEncapsulation;\n }\n}\n@CCCommand(CRC16Command.CommandEncapsulation)\n@expectedCCResponse(getCCResponseForCommandEncapsulation, () => \"checkEncapsulated\")\nexport class CRC16CCCommandEncapsulation extends CRC16CC {\n public constructor(options: WithAddress<CRC16CCCommandEncapsulationOptions>) {\n super(options);\n this.encapsulated = options.encapsulated;\n this.encapsulated.encapsulatingCC = this as any;\n }\n public static async from(raw: CCRaw, ctx: CCParsingContext): Promise<CRC16CCCommandEncapsulation> {\n validatePayload(raw.payload.length >= 3);\n const ccBuffer = raw.payload.subarray(0, -2);\n // Verify the CRC\n let expectedCRC = CRC16_CCITT(headerBuffer);\n expectedCRC = CRC16_CCITT(ccBuffer, expectedCRC);\n const actualCRC = raw.payload.readUInt16BE(raw.payload.length - 2);\n validatePayload(expectedCRC === actualCRC);\n const encapsulated = await CommandClass.parse(ccBuffer, ctx);\n return new this({\n nodeId: ctx.sourceNodeId,\n encapsulated,\n });\n }\n public encapsulated: CommandClass;\n protected override determineRelation(other: CommandClass): CommandRelation {\n if (other instanceof CRC16CCCommandEncapsulation) {\n return this.encapsulated.getRelationTo(other.encapsulated);\n }\n return CommandRelation.Unrelated;\n }\n public async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const commandBuffer = await this.encapsulated.serialize(ctx);\n // Reserve 2 bytes for the CRC\n this.payload = Bytes.concat([commandBuffer, new Bytes(2)]);\n // Compute and save the CRC16 in the payload\n // The CC header is included in the CRC computation\n let crc = CRC16_CCITT(headerBuffer);\n crc = CRC16_CCITT(commandBuffer, crc);\n this.payload.writeUInt16BE(crc, this.payload.length - 2);\n return super.serialize(ctx);\n }\n protected computeEncapsulationOverhead(): number {\n // CRC16 adds two bytes CRC to the default overhead\n return super.computeEncapsulationOverhead() + 2;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n // Hide the default payload line\n message: undefined,\n };\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAA+M;AAC/M,oBAAsB;AACtB,iBAAsB;AACtB,0BAA2D;AAC3D,oCAAsF;AACtF,mBAA6B;AAE7B,MAAM,eAAe,oBAAM,KAAK;EAC5B,2BAAe,sBAAsB;EACrC,0BAAa;CAChB;IAOY,cAAU,MAAA;8BADtB,mCAAI,2BAAe,sBAAsB,CAAC,CAAC;;;;oBACZ;kCAAA,YAAK;WAAA;;;;;;;;AAArC,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAA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SceneCC {
|
|
|
34
34
|
readonly keyAttribute: CentralSceneKeys;
|
|
35
35
|
readonly sceneNumber: number;
|
|
36
36
|
readonly slowRefresh: boolean | undefined;
|
|
37
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
37
38
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
38
39
|
}
|
|
39
40
|
export interface CentralSceneCCSupportedReportOptions {
|
|
@@ -46,6 +47,7 @@ export declare class CentralSceneCCSupportedReport extends CentralSceneCC {
|
|
|
46
47
|
static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCSupportedReport;
|
|
47
48
|
persistValues(ctx: PersistValuesContext): boolean;
|
|
48
49
|
readonly sceneCount: number;
|
|
50
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
49
51
|
readonly supportsSlowRefresh: MaybeNotKnown<boolean>;
|
|
50
52
|
private _supportedKeyAttributes;
|
|
51
53
|
get supportedKeyAttributes(): ReadonlyMap<number, readonly CentralSceneKeys[]>;
|
|
@@ -60,6 +62,7 @@ export declare class CentralSceneCCConfigurationReport extends CentralSceneCC {
|
|
|
60
62
|
constructor(options: WithAddress<CentralSceneCCConfigurationReportOptions>);
|
|
61
63
|
static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCConfigurationReport;
|
|
62
64
|
readonly slowRefresh: boolean;
|
|
65
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
63
66
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
64
67
|
}
|
|
65
68
|
export declare class CentralSceneCCConfigurationGet extends CentralSceneCC {
|
|
@@ -69,7 +72,7 @@ export interface CentralSceneCCConfigurationSetOptions {
|
|
|
69
72
|
}
|
|
70
73
|
export declare class CentralSceneCCConfigurationSet extends CentralSceneCC {
|
|
71
74
|
constructor(options: WithAddress<CentralSceneCCConfigurationSetOptions>);
|
|
72
|
-
static from(
|
|
75
|
+
static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCConfigurationSet;
|
|
73
76
|
slowRefresh: boolean;
|
|
74
77
|
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
75
78
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
@@ -303,6 +303,17 @@ let CentralSceneCCNotification = (() => {
|
|
|
303
303
|
keyAttribute;
|
|
304
304
|
sceneNumber;
|
|
305
305
|
slowRefresh;
|
|
306
|
+
serialize(ctx) {
|
|
307
|
+
let keyAttributeByte = this.keyAttribute & 7;
|
|
308
|
+
if (this.slowRefresh)
|
|
309
|
+
keyAttributeByte |= 128;
|
|
310
|
+
this.payload = import_shared.Bytes.from([
|
|
311
|
+
this.sequenceNumber,
|
|
312
|
+
keyAttributeByte,
|
|
313
|
+
this.sceneNumber
|
|
314
|
+
]);
|
|
315
|
+
return super.serialize(ctx);
|
|
316
|
+
}
|
|
306
317
|
toLogEntry(ctx) {
|
|
307
318
|
const message = {
|
|
308
319
|
"sequence number": this.sequenceNumber,
|
|
@@ -395,6 +406,19 @@ let CentralSceneCCSupportedReport = (() => {
|
|
|
395
406
|
return true;
|
|
396
407
|
}
|
|
397
408
|
sceneCount;
|
|
409
|
+
serialize(ctx) {
|
|
410
|
+
const masks = [];
|
|
411
|
+
for (let i = 1; i <= this.sceneCount; i++) {
|
|
412
|
+
masks.push((0, import_core.encodeBitMask)(this.supportedKeyAttributes.get(i) ?? [], 7, import_Types.CentralSceneKeys.KeyPressed));
|
|
413
|
+
}
|
|
414
|
+
const bitMaskBytes = masks[0]?.length ?? 1;
|
|
415
|
+
let byte1 = bitMaskBytes << 1;
|
|
416
|
+
if (this.supportsSlowRefresh) {
|
|
417
|
+
byte1 |= 128;
|
|
418
|
+
}
|
|
419
|
+
this.payload = import_shared.Bytes.concat([[this.sceneCount, byte1], ...masks]);
|
|
420
|
+
return super.serialize(ctx);
|
|
421
|
+
}
|
|
398
422
|
// TODO: Only offer `slowRefresh` if this is true
|
|
399
423
|
supportsSlowRefresh;
|
|
400
424
|
_supportedKeyAttributes = /* @__PURE__ */ new Map();
|
|
@@ -473,6 +497,10 @@ let CentralSceneCCConfigurationReport = (() => {
|
|
|
473
497
|
});
|
|
474
498
|
}
|
|
475
499
|
slowRefresh;
|
|
500
|
+
serialize(ctx) {
|
|
501
|
+
this.payload = import_shared.Bytes.from([this.slowRefresh ? 128 : 0]);
|
|
502
|
+
return super.serialize(ctx);
|
|
503
|
+
}
|
|
476
504
|
toLogEntry(ctx) {
|
|
477
505
|
return {
|
|
478
506
|
...super.toLogEntry(ctx),
|
|
@@ -529,8 +557,12 @@ let CentralSceneCCConfigurationSet = (() => {
|
|
|
529
557
|
super(options);
|
|
530
558
|
this.slowRefresh = options.slowRefresh;
|
|
531
559
|
}
|
|
532
|
-
static from(
|
|
533
|
-
|
|
560
|
+
static from(raw, ctx) {
|
|
561
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
562
|
+
return new this({
|
|
563
|
+
nodeId: ctx.sourceNodeId,
|
|
564
|
+
slowRefresh: !!(raw.payload[0] & 128)
|
|
565
|
+
});
|
|
534
566
|
}
|
|
535
567
|
slowRefresh;
|
|
536
568
|
serialize(ctx) {
|
|
@@ -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,
|
|
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, enumValuesToMetadataStates, encodeBitMask, 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 serialize(ctx: CCEncodingContext): Promise<Bytes> {\n let keyAttributeByte = this.keyAttribute & 0b111;\n if (this.slowRefresh)\n keyAttributeByte |= 0x80;\n this.payload = Bytes.from([\n this.sequenceNumber,\n keyAttributeByte,\n this.sceneNumber,\n ]);\n return super.serialize(ctx);\n }\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 public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const masks: Bytes[] = [];\n for (let i = 1; i <= this.sceneCount; i++) {\n masks.push(encodeBitMask(this.supportedKeyAttributes.get(i) ?? [], 7, CentralSceneKeys.KeyPressed));\n }\n const bitMaskBytes = masks[0]?.length ?? 1;\n let byte1 = bitMaskBytes << 1;\n if (this.supportsSlowRefresh) {\n byte1 |= 0x80;\n }\n this.payload = Bytes.concat([[this.sceneCount, byte1], ...masks]);\n return super.serialize(ctx);\n }\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 serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.slowRefresh ? 0x80 : 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@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 validatePayload(raw.payload.length >= 1);\n return new this({\n nodeId: ctx.sourceNodeId,\n slowRefresh: !!(raw.payload[0] & 0x80),\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,kBAAmU;AACnU,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,oBAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,sBAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,kBAAb,OAA6B,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAzCjC,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACF,gBAAgB,KAAwB;AAC3C,cAAQ,KAAK;QACT,KAAK,iCA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,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;IAQA,kCAA8B,MAAA;8BAF1C,yCAAU,iCAAoB,gBAAgB,OAC9C,8CAAc,CAAE;;;;oBACmC;sDAAA,YAAc;WAAA;;;;;;;;AAAlE,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,SAA2D;AAC1E,YAAM,OAAO;AACb,WAAK,cAAc,QAAQ;IAC/B;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ,aAAa,CAAC,EAAE,IAAI,QAAQ,CAAC,IAAI;OACpC;IACL;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
|
}
|
|
@@ -26,7 +26,7 @@ export interface ClimateControlScheduleCCSetOptions {
|
|
|
26
26
|
}
|
|
27
27
|
export declare class ClimateControlScheduleCCSet extends ClimateControlScheduleCC {
|
|
28
28
|
constructor(options: WithAddress<ClimateControlScheduleCCSetOptions>);
|
|
29
|
-
static from(
|
|
29
|
+
static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCSet;
|
|
30
30
|
switchPoints: Switchpoint[];
|
|
31
31
|
weekday: Weekday;
|
|
32
32
|
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
@@ -41,6 +41,7 @@ export declare class ClimateControlScheduleCCReport extends ClimateControlSchedu
|
|
|
41
41
|
static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCReport;
|
|
42
42
|
readonly weekday: Weekday;
|
|
43
43
|
readonly schedule: readonly Switchpoint[];
|
|
44
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
44
45
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
45
46
|
}
|
|
46
47
|
export interface ClimateControlScheduleCCGetOptions {
|
|
@@ -48,7 +49,7 @@ export interface ClimateControlScheduleCCGetOptions {
|
|
|
48
49
|
}
|
|
49
50
|
export declare class ClimateControlScheduleCCGet extends ClimateControlScheduleCC {
|
|
50
51
|
constructor(options: WithAddress<ClimateControlScheduleCCGetOptions>);
|
|
51
|
-
static from(
|
|
52
|
+
static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCGet;
|
|
52
53
|
weekday: Weekday;
|
|
53
54
|
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
54
55
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
@@ -60,6 +61,7 @@ export declare class ClimateControlScheduleCCChangedReport extends ClimateContro
|
|
|
60
61
|
constructor(options: WithAddress<ClimateControlScheduleCCChangedReportOptions>);
|
|
61
62
|
static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCChangedReport;
|
|
62
63
|
readonly changeCounter: number;
|
|
64
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
63
65
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
64
66
|
}
|
|
65
67
|
export declare class ClimateControlScheduleCCChangedGet extends ClimateControlScheduleCC {
|
|
@@ -73,6 +75,7 @@ export declare class ClimateControlScheduleCCOverrideReport extends ClimateContr
|
|
|
73
75
|
static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCOverrideReport;
|
|
74
76
|
readonly overrideType: ScheduleOverrideType;
|
|
75
77
|
readonly overrideState: SetbackState;
|
|
78
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
76
79
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
77
80
|
}
|
|
78
81
|
export declare class ClimateControlScheduleCCOverrideGet extends ClimateControlScheduleCC {
|
|
@@ -83,7 +86,7 @@ export interface ClimateControlScheduleCCOverrideSetOptions {
|
|
|
83
86
|
}
|
|
84
87
|
export declare class ClimateControlScheduleCCOverrideSet extends ClimateControlScheduleCC {
|
|
85
88
|
constructor(options: WithAddress<ClimateControlScheduleCCOverrideSetOptions>);
|
|
86
|
-
static from(
|
|
89
|
+
static from(raw: CCRaw, ctx: CCParsingContext): ClimateControlScheduleCCOverrideSet;
|
|
87
90
|
overrideType: ScheduleOverrideType;
|
|
88
91
|
overrideState: SetbackState;
|
|
89
92
|
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
@@ -205,8 +205,19 @@ let ClimateControlScheduleCCSet = (() => {
|
|
|
205
205
|
this.switchPoints = options.switchPoints;
|
|
206
206
|
this.weekday = options.weekday;
|
|
207
207
|
}
|
|
208
|
-
static from(
|
|
209
|
-
|
|
208
|
+
static from(raw, ctx) {
|
|
209
|
+
(0, import_core.validatePayload)(raw.payload.length >= 28);
|
|
210
|
+
const switchPoints = [];
|
|
211
|
+
for (let i = 0; i < 9; i++) {
|
|
212
|
+
const sp = (0, import_serializers.decodeSwitchpoint)(raw.payload.subarray(1 + 3 * i));
|
|
213
|
+
if (sp.state !== "Unused")
|
|
214
|
+
switchPoints.push(sp);
|
|
215
|
+
}
|
|
216
|
+
return new this({
|
|
217
|
+
nodeId: ctx.sourceNodeId,
|
|
218
|
+
weekday: raw.payload[0] & 7,
|
|
219
|
+
switchPoints
|
|
220
|
+
});
|
|
210
221
|
}
|
|
211
222
|
switchPoints;
|
|
212
223
|
weekday;
|
|
@@ -279,6 +290,21 @@ let ClimateControlScheduleCCReport = (() => {
|
|
|
279
290
|
}
|
|
280
291
|
weekday;
|
|
281
292
|
schedule;
|
|
293
|
+
serialize(ctx) {
|
|
294
|
+
const switchpointBytes = [];
|
|
295
|
+
for (let i = 0; i < 9; i++) {
|
|
296
|
+
switchpointBytes.push((0, import_serializers.encodeSwitchpoint)(this.schedule[i] ?? {
|
|
297
|
+
hour: 0,
|
|
298
|
+
minute: 0,
|
|
299
|
+
state: "Unused"
|
|
300
|
+
}));
|
|
301
|
+
}
|
|
302
|
+
this.payload = import_shared.Bytes.concat([
|
|
303
|
+
[this.weekday & 7],
|
|
304
|
+
...switchpointBytes
|
|
305
|
+
]);
|
|
306
|
+
return super.serialize(ctx);
|
|
307
|
+
}
|
|
282
308
|
toLogEntry(ctx) {
|
|
283
309
|
return {
|
|
284
310
|
...super.toLogEntry(ctx),
|
|
@@ -316,8 +342,12 @@ let ClimateControlScheduleCCGet = (() => {
|
|
|
316
342
|
super(options);
|
|
317
343
|
this.weekday = options.weekday;
|
|
318
344
|
}
|
|
319
|
-
static from(
|
|
320
|
-
|
|
345
|
+
static from(raw, ctx) {
|
|
346
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
347
|
+
return new this({
|
|
348
|
+
nodeId: ctx.sourceNodeId,
|
|
349
|
+
weekday: raw.payload[0] & 7
|
|
350
|
+
});
|
|
321
351
|
}
|
|
322
352
|
weekday;
|
|
323
353
|
serialize(ctx) {
|
|
@@ -366,6 +396,10 @@ let ClimateControlScheduleCCChangedReport = (() => {
|
|
|
366
396
|
});
|
|
367
397
|
}
|
|
368
398
|
changeCounter;
|
|
399
|
+
serialize(ctx) {
|
|
400
|
+
this.payload = import_shared.Bytes.from([this.changeCounter]);
|
|
401
|
+
return super.serialize(ctx);
|
|
402
|
+
}
|
|
369
403
|
toLogEntry(ctx) {
|
|
370
404
|
return {
|
|
371
405
|
...super.toLogEntry(ctx),
|
|
@@ -435,6 +469,13 @@ let ClimateControlScheduleCCOverrideReport = (() => {
|
|
|
435
469
|
}
|
|
436
470
|
overrideType;
|
|
437
471
|
overrideState;
|
|
472
|
+
serialize(ctx) {
|
|
473
|
+
this.payload = import_shared.Bytes.concat([
|
|
474
|
+
[this.overrideType & 3],
|
|
475
|
+
(0, import_serializers.encodeSetbackState)(this.overrideState)
|
|
476
|
+
]);
|
|
477
|
+
return super.serialize(ctx);
|
|
478
|
+
}
|
|
438
479
|
toLogEntry(ctx) {
|
|
439
480
|
return {
|
|
440
481
|
...super.toLogEntry(ctx),
|
|
@@ -495,8 +536,15 @@ let ClimateControlScheduleCCOverrideSet = (() => {
|
|
|
495
536
|
this.overrideType = options.overrideType;
|
|
496
537
|
this.overrideState = options.overrideState;
|
|
497
538
|
}
|
|
498
|
-
static from(
|
|
499
|
-
|
|
539
|
+
static from(raw, ctx) {
|
|
540
|
+
(0, import_core.validatePayload)(raw.payload.length >= 2);
|
|
541
|
+
const overrideType = raw.payload[0] & 3;
|
|
542
|
+
const overrideState = (0, import_serializers.decodeSetbackState)(raw.payload, 1) ?? raw.payload.readInt8(1);
|
|
543
|
+
return new this({
|
|
544
|
+
nodeId: ctx.sourceNodeId,
|
|
545
|
+
overrideType,
|
|
546
|
+
overrideState
|
|
547
|
+
});
|
|
500
548
|
}
|
|
501
549
|
overrideType;
|
|
502
550
|
overrideState;
|