@zwave-js/cc 15.0.0-beta.0 → 15.0.0-beta.1
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 +79 -161
- package/build/cjs/cc/AlarmSensorCC.js +12 -50
- package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
- package/build/cjs/cc/AssociationCC.d.ts +63 -199
- package/build/cjs/cc/AssociationCC.js +9 -22
- package/build/cjs/cc/AssociationCC.js.map +2 -2
- package/build/cjs/cc/AssociationGroupInfoCC.d.ts +66 -166
- package/build/cjs/cc/AssociationGroupInfoCC.js +11 -22
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/BarrierOperatorCC.d.ts +86 -294
- package/build/cjs/cc/BarrierOperatorCC.js +12 -44
- package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
- package/build/cjs/cc/BasicCC.d.ts +85 -331
- package/build/cjs/cc/BasicCC.js +15 -46
- package/build/cjs/cc/BasicCC.js.map +2 -2
- package/build/cjs/cc/BatteryCC.d.ts +237 -835
- package/build/cjs/cc/BatteryCC.js +7 -84
- package/build/cjs/cc/BatteryCC.js.map +2 -2
- package/build/cjs/cc/BinarySensorCC.d.ts +34 -99
- package/build/cjs/cc/BinarySensorCC.js +9 -29
- package/build/cjs/cc/BinarySensorCC.js.map +2 -2
- package/build/cjs/cc/BinarySwitchCC.d.ts +45 -197
- package/build/cjs/cc/BinarySwitchCC.js +6 -22
- package/build/cjs/cc/BinarySwitchCC.js.map +2 -2
- package/build/cjs/cc/CentralSceneCC.d.ts +77 -296
- package/build/cjs/cc/CentralSceneCC.js +7 -30
- package/build/cjs/cc/CentralSceneCC.js.map +2 -2
- package/build/cjs/cc/ClimateControlScheduleCC.d.ts +45 -160
- package/build/cjs/cc/ClimateControlScheduleCC.js +5 -24
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
- package/build/cjs/cc/ColorSwitchCC.d.ts +130 -457
- package/build/cjs/cc/ColorSwitchCC.js +23 -75
- package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
- package/build/cjs/cc/ConfigurationCC.d.ts +32 -100
- package/build/cjs/cc/ConfigurationCC.js +11 -31
- package/build/cjs/cc/ConfigurationCC.js.map +2 -2
- package/build/cjs/cc/DoorLockCC.d.ts +512 -1823
- package/build/cjs/cc/DoorLockCC.js +51 -156
- package/build/cjs/cc/DoorLockCC.js.map +2 -2
- package/build/cjs/cc/DoorLockLoggingCC.d.ts +11 -63
- package/build/cjs/cc/DoorLockLoggingCC.js +4 -8
- package/build/cjs/cc/DoorLockLoggingCC.js.map +2 -2
- package/build/cjs/cc/EnergyProductionCC.d.ts +14 -29
- package/build/cjs/cc/EnergyProductionCC.js +5 -17
- package/build/cjs/cc/EnergyProductionCC.js.map +2 -2
- package/build/cjs/cc/EntryControlCC.d.ts +73 -324
- package/build/cjs/cc/EntryControlCC.js +9 -36
- package/build/cjs/cc/EntryControlCC.js.map +2 -2
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.d.ts +78 -390
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +5 -26
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlModeCC.d.ts +31 -131
- package/build/cjs/cc/HumidityControlModeCC.js +6 -15
- package/build/cjs/cc/HumidityControlModeCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlOperatingStateCC.d.ts +17 -65
- package/build/cjs/cc/HumidityControlOperatingStateCC.js +4 -12
- package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlSetpointCC.d.ts +51 -128
- package/build/cjs/cc/HumidityControlSetpointCC.js +10 -28
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.d.ts +123 -365
- package/build/cjs/cc/IndicatorCC.js +15 -61
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/IrrigationCC.d.ts +826 -2317
- package/build/cjs/cc/IrrigationCC.js +29 -233
- package/build/cjs/cc/IrrigationCC.js.map +2 -2
- package/build/cjs/cc/LanguageCC.d.ts +31 -133
- package/build/cjs/cc/LanguageCC.js +4 -15
- package/build/cjs/cc/LanguageCC.js.map +2 -2
- package/build/cjs/cc/LockCC.d.ts +14 -64
- package/build/cjs/cc/LockCC.js +4 -12
- package/build/cjs/cc/LockCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.d.ts +77 -239
- package/build/cjs/cc/ManufacturerSpecificCC.js +5 -26
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
- package/build/cjs/cc/MeterCC.d.ts +119 -393
- package/build/cjs/cc/MeterCC.js +25 -69
- package/build/cjs/cc/MeterCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelAssociationCC.d.ts +66 -166
- package/build/cjs/cc/MultiChannelAssociationCC.js +10 -23
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelCC.d.ts +119 -499
- package/build/cjs/cc/MultiChannelCC.js +18 -46
- package/build/cjs/cc/MultiChannelCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSensorCC.d.ts +46 -130
- package/build/cjs/cc/MultilevelSensorCC.js +12 -33
- package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSwitchCC.d.ts +160 -525
- package/build/cjs/cc/MultilevelSwitchCC.js +13 -107
- package/build/cjs/cc/MultilevelSwitchCC.js.map +2 -2
- package/build/cjs/cc/NodeNamingCC.d.ts +33 -135
- package/build/cjs/cc/NodeNamingCC.js +5 -16
- package/build/cjs/cc/NodeNamingCC.js.map +2 -2
- package/build/cjs/cc/NotificationCC.d.ts +262 -702
- package/build/cjs/cc/NotificationCC.js +29 -112
- package/build/cjs/cc/NotificationCC.js.map +2 -2
- package/build/cjs/cc/ProtectionCC.d.ts +118 -524
- package/build/cjs/cc/ProtectionCC.js +15 -50
- package/build/cjs/cc/ProtectionCC.js.map +2 -2
- package/build/cjs/cc/SceneActivationCC.d.ts +33 -132
- package/build/cjs/cc/SceneActivationCC.js +4 -17
- package/build/cjs/cc/SceneActivationCC.js.map +2 -2
- package/build/cjs/cc/SceneActuatorConfigurationCC.d.ts +34 -61
- package/build/cjs/cc/SceneActuatorConfigurationCC.js +9 -21
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.d.ts +34 -61
- package/build/cjs/cc/SceneControllerConfigurationCC.js +10 -22
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
- package/build/cjs/cc/ScheduleEntryLockCC.d.ts +95 -299
- package/build/cjs/cc/ScheduleEntryLockCC.js +13 -30
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
- package/build/cjs/cc/SoundSwitchCC.d.ts +72 -261
- package/build/cjs/cc/SoundSwitchCC.js +11 -43
- package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
- package/build/cjs/cc/SupervisionCC.d.ts +17 -33
- package/build/cjs/cc/SupervisionCC.js +4 -9
- package/build/cjs/cc/SupervisionCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanModeCC.d.ts +44 -195
- package/build/cjs/cc/ThermostatFanModeCC.js +8 -21
- package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanStateCC.d.ts +17 -65
- package/build/cjs/cc/ThermostatFanStateCC.js +4 -12
- package/build/cjs/cc/ThermostatFanStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatModeCC.d.ts +44 -195
- package/build/cjs/cc/ThermostatModeCC.js +8 -21
- package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +17 -65
- package/build/cjs/cc/ThermostatOperatingStateCC.js +4 -12
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetpointCC.d.ts +49 -129
- package/build/cjs/cc/ThermostatSetpointCC.js +10 -25
- package/build/cjs/cc/ThermostatSetpointCC.js.map +2 -2
- package/build/cjs/cc/TimeParametersCC.d.ts +12 -63
- package/build/cjs/cc/TimeParametersCC.js +4 -11
- package/build/cjs/cc/TimeParametersCC.js.map +2 -2
- package/build/cjs/cc/UserCodeCC.d.ts +311 -1066
- package/build/cjs/cc/UserCodeCC.js +33 -98
- package/build/cjs/cc/UserCodeCC.js.map +2 -2
- package/build/cjs/cc/VersionCC.d.ts +289 -1003
- package/build/cjs/cc/VersionCC.js +7 -98
- package/build/cjs/cc/VersionCC.js.map +2 -2
- package/build/cjs/cc/WakeUpCC.d.ts +49 -201
- package/build/cjs/cc/WakeUpCC.js +6 -26
- package/build/cjs/cc/WakeUpCC.js.map +2 -2
- package/build/cjs/cc/WindowCoveringCC.d.ts +126 -220
- package/build/cjs/cc/WindowCoveringCC.js +16 -128
- package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
- package/build/cjs/cc/ZWavePlusCC.d.ts +69 -329
- package/build/cjs/cc/ZWavePlusCC.js +4 -25
- package/build/cjs/cc/ZWavePlusCC.js.map +2 -2
- package/build/cjs/cc/_CCValues.generated.d.ts +15814 -0
- package/build/cjs/cc/_CCValues.generated.js +8723 -0
- package/build/cjs/cc/_CCValues.generated.js.map +7 -0
- package/build/cjs/lib/CCValueUtils.d.ts +14 -0
- package/build/cjs/lib/CCValueUtils.js +93 -0
- package/build/cjs/lib/CCValueUtils.js.map +7 -0
- package/build/cjs/lib/Values.d.ts +6 -105
- package/build/cjs/lib/Values.js +13 -107
- package/build/cjs/lib/Values.js.map +3 -3
- package/build/esm/cc/AlarmSensorCC.d.ts +79 -161
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +2 -39
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/AssociationCC.d.ts +63 -199
- package/build/esm/cc/AssociationCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC.js +2 -14
- package/build/esm/cc/AssociationCC.js.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts +66 -166
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +2 -13
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts +86 -294
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +2 -34
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.d.ts +85 -331
- package/build/esm/cc/BasicCC.d.ts.map +1 -1
- package/build/esm/cc/BasicCC.js +2 -32
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.d.ts +237 -835
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +2 -78
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySensorCC.d.ts +34 -99
- package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySensorCC.js +2 -16
- package/build/esm/cc/BinarySensorCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.d.ts +45 -197
- package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +2 -17
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.d.ts +77 -296
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +2 -26
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts +45 -160
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +2 -23
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.d.ts +130 -457
- package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +2 -52
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts +32 -100
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +2 -15
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC.d.ts +512 -1823
- package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC.js +9 -127
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.d.ts +11 -63
- package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.js +2 -5
- package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/esm/cc/EnergyProductionCC.d.ts +14 -29
- package/build/esm/cc/EnergyProductionCC.d.ts.map +1 -1
- package/build/esm/cc/EnergyProductionCC.js +2 -13
- package/build/esm/cc/EnergyProductionCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts +73 -324
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +2 -28
- package/build/esm/cc/EntryControlCC.js.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts +78 -390
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js +2 -23
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.d.ts +31 -131
- package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.js +2 -10
- package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts +17 -65
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.js +2 -9
- package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.d.ts +51 -128
- package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +2 -19
- package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts +123 -365
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +2 -43
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts +826 -2317
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +3 -222
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.d.ts +31 -133
- package/build/esm/cc/LanguageCC.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC.js +2 -12
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/LockCC.d.ts +14 -64
- package/build/esm/cc/LockCC.d.ts.map +1 -1
- package/build/esm/cc/LockCC.js +2 -9
- package/build/esm/cc/LockCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js +0 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.d.ts +77 -239
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +2 -24
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts +119 -393
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +3 -49
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.d.ts +66 -166
- package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.js +2 -14
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts +119 -499
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +2 -30
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.d.ts +46 -130
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +2 -22
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts +160 -525
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +5 -101
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NodeNamingCC.d.ts +33 -135
- package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC.js +2 -12
- package/build/esm/cc/NodeNamingCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts +262 -702
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +3 -85
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts +118 -524
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +2 -36
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActivationCC.d.ts +33 -132
- package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActivationCC.js +2 -14
- package/build/esm/cc/SceneActivationCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts +34 -61
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +2 -14
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts +34 -61
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +2 -14
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.d.ts +95 -299
- package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js +2 -17
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.d.ts +72 -261
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +2 -33
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.d.ts +17 -33
- package/build/esm/cc/SupervisionCC.d.ts.map +1 -1
- package/build/esm/cc/SupervisionCC.js +2 -7
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.d.ts +44 -195
- package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +2 -14
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.d.ts +17 -65
- package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js +2 -9
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.d.ts +44 -195
- package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +2 -14
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts +17 -65
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.js +2 -9
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts +49 -129
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +2 -16
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TimeParametersCC.d.ts +12 -63
- package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
- package/build/esm/cc/TimeParametersCC.js +2 -8
- package/build/esm/cc/TimeParametersCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts +311 -1066
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +2 -60
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts +289 -1003
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +2 -92
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.d.ts +49 -201
- package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
- package/build/esm/cc/WakeUpCC.js +2 -21
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts +126 -220
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +3 -103
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.d.ts +69 -329
- package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +2 -25
- package/build/esm/cc/ZWavePlusCC.js.map +1 -1
- package/build/esm/cc/_CCValues.generated.d.ts +15814 -0
- package/build/esm/cc/_CCValues.generated.d.ts.map +1 -0
- package/build/esm/cc/_CCValues.generated.js +9187 -0
- package/build/esm/cc/_CCValues.generated.js.map +1 -0
- package/build/esm/lib/CCValueUtils.d.ts +14 -0
- package/build/esm/lib/CCValueUtils.d.ts.map +1 -0
- package/build/esm/lib/CCValueUtils.js +62 -0
- package/build/esm/lib/CCValueUtils.js.map +1 -0
- package/build/esm/lib/Values.d.ts +6 -105
- package/build/esm/lib/Values.d.ts.map +1 -1
- package/build/esm/lib/Values.js +7 -104
- package/build/esm/lib/Values.js.map +1 -1
- package/package.json +9 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/BinarySensorCC.ts"],
|
|
4
|
-
"sourcesContent": ["import { type CCEncodingContext, type CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\ttype EndpointId,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype SupervisionResult,\n\tValueMetadata,\n\ttype WithAddress,\n\tencodeBitMask,\n\tparseBitMask,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { getEnumMemberName, isEnumMember } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\tPhysicalCCAPI,\n\ttype PollValueImplementation,\n\tthrowUnsupportedProperty,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\ttype RefreshValuesContext,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { BinarySensorCommand, BinarySensorType } from \"../lib/_Types.js\";\n\nexport const BinarySensorCCValues = Object.freeze({\n\t...V.defineStaticCCValues(CommandClasses[\"Binary Sensor\"], {\n\t\t...V.staticProperty(\"supportedSensorTypes\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\t}),\n\n\t...V.defineDynamicCCValues(CommandClasses[\"Binary Sensor\"], {\n\t\t...V.dynamicPropertyWithName(\n\t\t\t\"state\",\n\t\t\t/* property */ (sensorType: BinarySensorType) =>\n\t\t\t\tgetEnumMemberName(BinarySensorType, sensorType),\n\t\t\t({ property }) =>\n\t\t\t\ttypeof property === \"string\" && property in BinarySensorType,\n\t\t\t/* meta */ (sensorType: BinarySensorType) => ({\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: `Sensor state (${\n\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\tBinarySensorType,\n\t\t\t\t\t\tsensorType,\n\t\t\t\t\t)\n\t\t\t\t})`,\n\t\t\t\tccSpecific: { sensorType },\n\t\t\t} as const),\n\t\t),\n\t}),\n});\n\n// @noSetValueAPI This CC is read-only\n\n@API(CommandClasses[\"Binary Sensor\"])\nexport class BinarySensorCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(cmd: BinarySensorCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase BinarySensorCommand.Get:\n\t\t\tcase BinarySensorCommand.Report:\n\t\t\t\treturn true; // This is mandatory\n\t\t\tcase BinarySensorCommand.SupportedGet:\n\t\t\tcase BinarySensorCommand.SupportedReport:\n\t\t\t\treturn this.version >= 2;\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: BinarySensorCCAPI, { property }) {\n\t\t\tif (typeof property === \"string\") {\n\t\t\t\tconst sensorType = (BinarySensorType as any)[property] as\n\t\t\t\t\t| BinarySensorType\n\t\t\t\t\t| undefined;\n\t\t\t\tif (sensorType) return this.get(sensorType);\n\t\t\t}\n\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t};\n\t}\n\n\t/**\n\t * Retrieves the current value from this sensor\n\t * @param sensorType The (optional) sensor type to retrieve the value for\n\t */\n\t@validateArgs({ strictEnums: true })\n\tpublic async get(\n\t\tsensorType?: BinarySensorType,\n\t): Promise<MaybeNotKnown<boolean>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySensorCommand,\n\t\t\tBinarySensorCommand.Get,\n\t\t);\n\n\t\tconst cc = new BinarySensorCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tsensorType,\n\t\t});\n\t\tconst response = await this.host.sendCommand<BinarySensorCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\t// We don't want to repeat the sensor type\n\t\treturn response?.value;\n\t}\n\n\t@validateArgs()\n\tpublic async sendReport(\n\t\tvalue: boolean,\n\t\tsensorType?: BinarySensorType,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySensorCommand,\n\t\t\tBinarySensorCommand.Report,\n\t\t);\n\n\t\tconst cc = new BinarySensorCCReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tvalue,\n\t\t\ttype: sensorType,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tpublic async getSupportedSensorTypes(): Promise<\n\t\treadonly BinarySensorType[] | undefined\n\t> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySensorCommand,\n\t\t\tBinarySensorCommand.SupportedGet,\n\t\t);\n\n\t\tconst cc = new BinarySensorCCSupportedGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tBinarySensorCCSupportedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\t// We don't want to repeat the sensor type\n\t\treturn response?.supportedSensorTypes;\n\t}\n\n\t@validateArgs()\n\tpublic async reportSupportedSensorTypes(\n\t\tsupported: BinarySensorType[],\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySensorCommand,\n\t\t\tBinarySensorCommand.SupportedReport,\n\t\t);\n\n\t\tconst cc = new BinarySensorCCSupportedReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tsupportedSensorTypes: supported,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\n@commandClass(CommandClasses[\"Binary Sensor\"])\n@implementedVersion(2)\n@ccValues(BinarySensorCCValues)\nexport class BinarySensorCC extends CommandClass {\n\tdeclare ccCommand: BinarySensorCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Binary Sensor\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\t// Find out which sensor types this sensor supports\n\t\tif (api.version >= 2) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying supported sensor types...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst supportedSensorTypes = await api.getSupportedSensorTypes();\n\t\t\tif (supportedSensorTypes) {\n\t\t\t\tconst logMessage = `received supported sensor types: ${\n\t\t\t\t\tsupportedSensorTypes\n\t\t\t\t\t\t.map((type) =>\n\t\t\t\t\t\t\tgetEnumMemberName(BinarySensorType, type)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.map((name) => `\\n\u00B7 ${name}`)\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}`;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Querying supported sensor types timed out, skipping interview...\",\n\t\t\t\t\tlevel: \"warn\",\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Binary Sensor\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\t// Query (all of) the sensor's current value(s)\n\t\tif (api.version === 1) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying current value...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst currentValue = await api.get();\n\t\t\tif (currentValue != undefined) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `received current value: ${currentValue}`,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tconst supportedSensorTypes: readonly BinarySensorType[] =\n\t\t\t\tthis.getValue(\n\t\t\t\t\tctx,\n\t\t\t\t\tBinarySensorCCValues.supportedSensorTypes,\n\t\t\t\t) ?? [];\n\n\t\t\tfor (const type of supportedSensorTypes) {\n\t\t\t\t// Some devices report invalid sensor types, but the CC API checks\n\t\t\t\t// for valid values and throws otherwise.\n\t\t\t\tif (!isEnumMember(BinarySensorType, type)) continue;\n\n\t\t\t\tconst sensorName = getEnumMemberName(BinarySensorType, type);\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `querying current value for ${sensorName}...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tconst currentValue = await api.get(type);\n\t\t\t\tif (currentValue != undefined) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`received current value for ${sensorName}: ${currentValue}`,\n\t\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns which sensor types are supported.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getSupportedSensorTypesCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): MaybeNotKnown<BinarySensorType[]> {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tBinarySensorCCValues.supportedSensorTypes.endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t);\n\t}\n\n\tpublic setMappedBasicValue(\n\t\tctx: GetValueDB,\n\t\tvalue: number,\n\t): boolean {\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tBinarySensorCCValues.state(BinarySensorType.Any),\n\t\t\tvalue > 0,\n\t\t);\n\t\treturn true;\n\t}\n}\n\n// @publicAPI\nexport interface BinarySensorCCReportOptions {\n\ttype?: BinarySensorType;\n\tvalue: boolean;\n}\n\n@CCCommand(BinarySensorCommand.Report)\nexport class BinarySensorCCReport extends BinarySensorCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySensorCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.type = options.type ?? BinarySensorType.Any;\n\t\tthis.value = options.value;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BinarySensorCCReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst value = raw.payload[0] === 0xff;\n\t\tlet type: BinarySensorType = BinarySensorType.Any;\n\n\t\tif (raw.payload.length >= 2) {\n\t\t\ttype = raw.payload[1];\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tvalue,\n\t\t\ttype,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// Workaround for devices reporting with sensor type Any -> find first supported sensor type and use that\n\t\tlet sensorType = this.type;\n\t\tif (sensorType === BinarySensorType.Any) {\n\t\t\tconst supportedSensorTypes = this.getValue<BinarySensorType[]>(\n\t\t\t\tctx,\n\t\t\t\tBinarySensorCCValues.supportedSensorTypes,\n\t\t\t);\n\t\t\tif (supportedSensorTypes?.length) {\n\t\t\t\tsensorType = supportedSensorTypes[0];\n\t\t\t}\n\t\t}\n\n\t\tconst binarySensorValue = BinarySensorCCValues.state(sensorType);\n\t\tthis.setMetadata(ctx, binarySensorValue, binarySensorValue.meta);\n\t\tthis.setValue(ctx, binarySensorValue, this.value);\n\n\t\treturn true;\n\t}\n\n\tpublic type: BinarySensorType;\n\tpublic value: boolean;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.value ? 0xff : 0x00, this.type]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\ttype: getEnumMemberName(BinarySensorType, this.type),\n\t\t\t\tvalue: this.value,\n\t\t\t},\n\t\t};\n\t}\n}\n\nfunction testResponseForBinarySensorGet(\n\tsent: BinarySensorCCGet,\n\treceived: BinarySensorCCReport,\n) {\n\t// We expect a Binary Sensor Report that matches the requested sensor type (if a type was requested)\n\treturn (\n\t\tsent.sensorType == undefined\n\t\t|| sent.sensorType === BinarySensorType.Any\n\t\t|| received.type === sent.sensorType\n\t\t// This is technically not correct, but some devices do this anyways\n\t\t|| received.type === BinarySensorType.Any\n\t);\n}\n\n// @publicAPI\nexport interface BinarySensorCCGetOptions {\n\tsensorType?: BinarySensorType;\n}\n\n@CCCommand(BinarySensorCommand.Get)\n@expectedCCResponse(BinarySensorCCReport, testResponseForBinarySensorGet)\nexport class BinarySensorCCGet extends BinarySensorCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySensorCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.sensorType = options.sensorType;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): BinarySensorCCGet {\n\t\tlet sensorType: BinarySensorType | undefined;\n\n\t\tif (raw.payload.length >= 1) {\n\t\t\tsensorType = raw.payload[0];\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tsensorType,\n\t\t});\n\t}\n\n\tpublic sensorType: BinarySensorType | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.sensorType ?? BinarySensorType.Any]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\ttype: getEnumMemberName(\n\t\t\t\t\tBinarySensorType,\n\t\t\t\t\tthis.sensorType ?? BinarySensorType.Any,\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface BinarySensorCCSupportedReportOptions {\n\tsupportedSensorTypes: BinarySensorType[];\n}\n\n@CCCommand(BinarySensorCommand.SupportedReport)\n@ccValueProperty(\n\t\"supportedSensorTypes\",\n\tBinarySensorCCValues.supportedSensorTypes,\n)\nexport class BinarySensorCCSupportedReport extends BinarySensorCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySensorCCSupportedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.supportedSensorTypes = options.supportedSensorTypes;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BinarySensorCCSupportedReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\t// The enumeration starts at 1, but the first (reserved) bit is included\n\t\t// in the report\n\t\tconst supportedSensorTypes: BinarySensorType[] = parseBitMask(\n\t\t\traw.payload,\n\t\t\t0,\n\t\t)\n\t\t\t.filter(\n\t\t\t\t(t) => t !== 0,\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tsupportedSensorTypes,\n\t\t});\n\t}\n\n\tpublic supportedSensorTypes: BinarySensorType[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = encodeBitMask(\n\t\t\tthis.supportedSensorTypes.filter((t) => t !== BinarySensorType.Any),\n\t\t\tundefined,\n\t\t\t0,\n\t\t);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"supported types\": this.supportedSensorTypes\n\t\t\t\t\t.map((type) => getEnumMemberName(BinarySensorType, type))\n\t\t\t\t\t.join(\", \"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(BinarySensorCommand.SupportedGet)\n@expectedCCResponse(BinarySensorCCSupportedReport)\nexport class BinarySensorCCSupportedGet extends BinarySensorCC {}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAaO;AACP,IAAAA,eAAsB;AACtB,IAAAA,eAAgD;AAEhD,iBAMO;AACP,0BAMO;AACP,oCAQO;AACP,oBAAkB;AAClB,mBAAsD
|
|
4
|
+
"sourcesContent": ["import { type CCEncodingContext, type CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\ttype EndpointId,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype SupervisionResult,\n\tValueMetadata,\n\ttype WithAddress,\n\tencodeBitMask,\n\tparseBitMask,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { getEnumMemberName, isEnumMember } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\tPhysicalCCAPI,\n\ttype PollValueImplementation,\n\tthrowUnsupportedProperty,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\ttype RefreshValuesContext,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { BinarySensorCommand, BinarySensorType } from \"../lib/_Types.js\";\n\nexport const BinarySensorCCValues = V.defineCCValues(\n\tCommandClasses[\"Binary Sensor\"],\n\t{\n\t\t...V.staticProperty(\"supportedSensorTypes\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\n\t\t...V.dynamicPropertyWithName(\n\t\t\t\"state\",\n\t\t\t/* property */ (sensorType: BinarySensorType) =>\n\t\t\t\tgetEnumMemberName(BinarySensorType, sensorType),\n\t\t\t({ property }) =>\n\t\t\t\ttypeof property === \"string\" && property in BinarySensorType,\n\t\t\t/* meta */ (sensorType: BinarySensorType) => ({\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: `Sensor state (${\n\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\tBinarySensorType,\n\t\t\t\t\t\tsensorType,\n\t\t\t\t\t)\n\t\t\t\t})`,\n\t\t\t\tccSpecific: { sensorType },\n\t\t\t} as const),\n\t\t),\n\t},\n);\n\n// @noSetValueAPI This CC is read-only\n\n@API(CommandClasses[\"Binary Sensor\"])\nexport class BinarySensorCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(cmd: BinarySensorCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase BinarySensorCommand.Get:\n\t\t\tcase BinarySensorCommand.Report:\n\t\t\t\treturn true; // This is mandatory\n\t\t\tcase BinarySensorCommand.SupportedGet:\n\t\t\tcase BinarySensorCommand.SupportedReport:\n\t\t\t\treturn this.version >= 2;\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: BinarySensorCCAPI, { property }) {\n\t\t\tif (typeof property === \"string\") {\n\t\t\t\tconst sensorType = (BinarySensorType as any)[property] as\n\t\t\t\t\t| BinarySensorType\n\t\t\t\t\t| undefined;\n\t\t\t\tif (sensorType) return this.get(sensorType);\n\t\t\t}\n\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t};\n\t}\n\n\t/**\n\t * Retrieves the current value from this sensor\n\t * @param sensorType The (optional) sensor type to retrieve the value for\n\t */\n\t@validateArgs({ strictEnums: true })\n\tpublic async get(\n\t\tsensorType?: BinarySensorType,\n\t): Promise<MaybeNotKnown<boolean>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySensorCommand,\n\t\t\tBinarySensorCommand.Get,\n\t\t);\n\n\t\tconst cc = new BinarySensorCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tsensorType,\n\t\t});\n\t\tconst response = await this.host.sendCommand<BinarySensorCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\t// We don't want to repeat the sensor type\n\t\treturn response?.value;\n\t}\n\n\t@validateArgs()\n\tpublic async sendReport(\n\t\tvalue: boolean,\n\t\tsensorType?: BinarySensorType,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySensorCommand,\n\t\t\tBinarySensorCommand.Report,\n\t\t);\n\n\t\tconst cc = new BinarySensorCCReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tvalue,\n\t\t\ttype: sensorType,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tpublic async getSupportedSensorTypes(): Promise<\n\t\treadonly BinarySensorType[] | undefined\n\t> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySensorCommand,\n\t\t\tBinarySensorCommand.SupportedGet,\n\t\t);\n\n\t\tconst cc = new BinarySensorCCSupportedGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tBinarySensorCCSupportedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\t// We don't want to repeat the sensor type\n\t\treturn response?.supportedSensorTypes;\n\t}\n\n\t@validateArgs()\n\tpublic async reportSupportedSensorTypes(\n\t\tsupported: BinarySensorType[],\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySensorCommand,\n\t\t\tBinarySensorCommand.SupportedReport,\n\t\t);\n\n\t\tconst cc = new BinarySensorCCSupportedReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tsupportedSensorTypes: supported,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\n@commandClass(CommandClasses[\"Binary Sensor\"])\n@implementedVersion(2)\n@ccValues(BinarySensorCCValues)\nexport class BinarySensorCC extends CommandClass {\n\tdeclare ccCommand: BinarySensorCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Binary Sensor\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\t// Find out which sensor types this sensor supports\n\t\tif (api.version >= 2) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying supported sensor types...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst supportedSensorTypes = await api.getSupportedSensorTypes();\n\t\t\tif (supportedSensorTypes) {\n\t\t\t\tconst logMessage = `received supported sensor types: ${\n\t\t\t\t\tsupportedSensorTypes\n\t\t\t\t\t\t.map((type) =>\n\t\t\t\t\t\t\tgetEnumMemberName(BinarySensorType, type)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.map((name) => `\\n\u00B7 ${name}`)\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}`;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Querying supported sensor types timed out, skipping interview...\",\n\t\t\t\t\tlevel: \"warn\",\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Binary Sensor\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\t// Query (all of) the sensor's current value(s)\n\t\tif (api.version === 1) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying current value...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst currentValue = await api.get();\n\t\t\tif (currentValue != undefined) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `received current value: ${currentValue}`,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tconst supportedSensorTypes: readonly BinarySensorType[] =\n\t\t\t\tthis.getValue(\n\t\t\t\t\tctx,\n\t\t\t\t\tBinarySensorCCValues.supportedSensorTypes,\n\t\t\t\t) ?? [];\n\n\t\t\tfor (const type of supportedSensorTypes) {\n\t\t\t\t// Some devices report invalid sensor types, but the CC API checks\n\t\t\t\t// for valid values and throws otherwise.\n\t\t\t\tif (!isEnumMember(BinarySensorType, type)) continue;\n\n\t\t\t\tconst sensorName = getEnumMemberName(BinarySensorType, type);\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `querying current value for ${sensorName}...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tconst currentValue = await api.get(type);\n\t\t\t\tif (currentValue != undefined) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`received current value for ${sensorName}: ${currentValue}`,\n\t\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns which sensor types are supported.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getSupportedSensorTypesCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): MaybeNotKnown<BinarySensorType[]> {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tBinarySensorCCValues.supportedSensorTypes.endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t);\n\t}\n\n\tpublic setMappedBasicValue(\n\t\tctx: GetValueDB,\n\t\tvalue: number,\n\t): boolean {\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tBinarySensorCCValues.state(BinarySensorType.Any),\n\t\t\tvalue > 0,\n\t\t);\n\t\treturn true;\n\t}\n}\n\n// @publicAPI\nexport interface BinarySensorCCReportOptions {\n\ttype?: BinarySensorType;\n\tvalue: boolean;\n}\n\n@CCCommand(BinarySensorCommand.Report)\nexport class BinarySensorCCReport extends BinarySensorCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySensorCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.type = options.type ?? BinarySensorType.Any;\n\t\tthis.value = options.value;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BinarySensorCCReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst value = raw.payload[0] === 0xff;\n\t\tlet type: BinarySensorType = BinarySensorType.Any;\n\n\t\tif (raw.payload.length >= 2) {\n\t\t\ttype = raw.payload[1];\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tvalue,\n\t\t\ttype,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// Workaround for devices reporting with sensor type Any -> find first supported sensor type and use that\n\t\tlet sensorType = this.type;\n\t\tif (sensorType === BinarySensorType.Any) {\n\t\t\tconst supportedSensorTypes = this.getValue<BinarySensorType[]>(\n\t\t\t\tctx,\n\t\t\t\tBinarySensorCCValues.supportedSensorTypes,\n\t\t\t);\n\t\t\tif (supportedSensorTypes?.length) {\n\t\t\t\tsensorType = supportedSensorTypes[0];\n\t\t\t}\n\t\t}\n\n\t\tconst binarySensorValue = BinarySensorCCValues.state(sensorType);\n\t\tthis.setMetadata(ctx, binarySensorValue, binarySensorValue.meta);\n\t\tthis.setValue(ctx, binarySensorValue, this.value);\n\n\t\treturn true;\n\t}\n\n\tpublic type: BinarySensorType;\n\tpublic value: boolean;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.value ? 0xff : 0x00, this.type]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\ttype: getEnumMemberName(BinarySensorType, this.type),\n\t\t\t\tvalue: this.value,\n\t\t\t},\n\t\t};\n\t}\n}\n\nfunction testResponseForBinarySensorGet(\n\tsent: BinarySensorCCGet,\n\treceived: BinarySensorCCReport,\n) {\n\t// We expect a Binary Sensor Report that matches the requested sensor type (if a type was requested)\n\treturn (\n\t\tsent.sensorType == undefined\n\t\t|| sent.sensorType === BinarySensorType.Any\n\t\t|| received.type === sent.sensorType\n\t\t// This is technically not correct, but some devices do this anyways\n\t\t|| received.type === BinarySensorType.Any\n\t);\n}\n\n// @publicAPI\nexport interface BinarySensorCCGetOptions {\n\tsensorType?: BinarySensorType;\n}\n\n@CCCommand(BinarySensorCommand.Get)\n@expectedCCResponse(BinarySensorCCReport, testResponseForBinarySensorGet)\nexport class BinarySensorCCGet extends BinarySensorCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySensorCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.sensorType = options.sensorType;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): BinarySensorCCGet {\n\t\tlet sensorType: BinarySensorType | undefined;\n\n\t\tif (raw.payload.length >= 1) {\n\t\t\tsensorType = raw.payload[0];\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tsensorType,\n\t\t});\n\t}\n\n\tpublic sensorType: BinarySensorType | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.sensorType ?? BinarySensorType.Any]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\ttype: getEnumMemberName(\n\t\t\t\t\tBinarySensorType,\n\t\t\t\t\tthis.sensorType ?? BinarySensorType.Any,\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface BinarySensorCCSupportedReportOptions {\n\tsupportedSensorTypes: BinarySensorType[];\n}\n\n@CCCommand(BinarySensorCommand.SupportedReport)\n@ccValueProperty(\n\t\"supportedSensorTypes\",\n\tBinarySensorCCValues.supportedSensorTypes,\n)\nexport class BinarySensorCCSupportedReport extends BinarySensorCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySensorCCSupportedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.supportedSensorTypes = options.supportedSensorTypes;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BinarySensorCCSupportedReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\t// The enumeration starts at 1, but the first (reserved) bit is included\n\t\t// in the report\n\t\tconst supportedSensorTypes: BinarySensorType[] = parseBitMask(\n\t\t\traw.payload,\n\t\t\t0,\n\t\t)\n\t\t\t.filter(\n\t\t\t\t(t) => t !== 0,\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tsupportedSensorTypes,\n\t\t});\n\t}\n\n\tpublic supportedSensorTypes: BinarySensorType[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = encodeBitMask(\n\t\t\tthis.supportedSensorTypes.filter((t) => t !== BinarySensorType.Any),\n\t\t\tundefined,\n\t\t\t0,\n\t\t);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"supported types\": this.supportedSensorTypes\n\t\t\t\t\t.map((type) => getEnumMemberName(BinarySensorType, type))\n\t\t\t\t\t.join(\", \"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(BinarySensorCommand.SupportedGet)\n@expectedCCResponse(BinarySensorCCSupportedReport)\nexport class BinarySensorCCSupportedGet extends BinarySensorCC {}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAaO;AACP,IAAAA,eAAsB;AACtB,IAAAA,eAAgD;AAEhD,iBAMO;AACP,0BAMO;AACP,oCAQO;AACP,oBAAkB;AAClB,mBAAsD;;;;;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C;IAEO,OAAO,KACb,KACA,KAAqB;AAErB,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AAGvC,YAAM,2BAA2C,0BAChD,IAAI,SACJ,CAAC,EAEA,OACA,CAAC,MAAM,MAAM,CAAC;AAGhB,aAAO,IAAI,KAAK;QACf,QAAQ,IAAI;QACZ;OACA;IACF;IAEO;IAEA,UAAU,KAAsB;AACtC,WAAK,cAAU,2BACd,KAAK,qBAAqB,OAAO,CAAC,MAAM,MAAM,8BAAiB,GAAG,GAClE,QACA,CAAC;AAEF,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACR,mBAAmB,KAAK,qBACtB,IAAI,CAAC,aAAS,gCAAkB,+BAAkB,IAAI,CAAC,EACvD,KAAK,IAAI;;;IAGd;;;;IAKY,8BAA0B,MAAA;8BAFtC,yCAAU,iCAAoB,YAAY,OAC1C,kDAAmB,6BAA6B,CAAC;;;;oBACF;kDAAA,YAAc;WAAA;;;;;;;;AAA9D,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;;;;",
|
|
6
6
|
"names": ["import_safe"]
|
|
7
7
|
}
|
|
@@ -1,240 +1,88 @@
|
|
|
1
1
|
import { type CCEncodingContext, type CCParsingContext } from "@zwave-js/cc";
|
|
2
|
-
import { CommandClasses, Duration, type GetValueDB, type MaybeNotKnown, type MaybeUnknown, type MessageOrCCLogEntry, type SupervisionResult,
|
|
2
|
+
import { CommandClasses, Duration, type GetValueDB, type MaybeNotKnown, type MaybeUnknown, type MessageOrCCLogEntry, type SupervisionResult, type WithAddress } from "@zwave-js/core/safe";
|
|
3
3
|
import { Bytes } from "@zwave-js/shared/safe";
|
|
4
4
|
import { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, SET_VALUE_HOOKS, type SetValueImplementation, type SetValueImplementationHooksFactory } from "../lib/API.js";
|
|
5
5
|
import { type CCRaw, CommandClass, type InterviewContext, type RefreshValuesContext } from "../lib/CommandClass.js";
|
|
6
6
|
import { BinarySwitchCommand } from "../lib/_Types.js";
|
|
7
7
|
export declare const BinarySwitchCCValues: Readonly<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
currentValue: {
|
|
9
|
+
id: {
|
|
10
|
+
readonly commandClass: (typeof CommandClasses)["Binary Switch"];
|
|
11
|
+
readonly property: "currentValue";
|
|
12
|
+
};
|
|
13
|
+
endpoint: (endpoint?: number) => {
|
|
11
14
|
readonly commandClass: (typeof CommandClasses)["Binary Switch"];
|
|
12
15
|
readonly endpoint: number;
|
|
13
|
-
readonly property: "
|
|
16
|
+
readonly property: "currentValue";
|
|
14
17
|
};
|
|
15
|
-
|
|
16
|
-
readonly meta:
|
|
17
|
-
readonly
|
|
18
|
+
is: (valueId: import("@zwave-js/core/safe").ValueID) => boolean;
|
|
19
|
+
readonly meta: {
|
|
20
|
+
readonly label: "Current value";
|
|
21
|
+
readonly writeable: false;
|
|
22
|
+
readonly type: "boolean";
|
|
18
23
|
readonly readable: true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
readonly type: "any";
|
|
22
|
-
readonly readable: true;
|
|
23
|
-
readonly writeable: true;
|
|
24
|
-
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>) extends infer T ? { [K in keyof T as [undefined] extends [(ValueMetadata extends NonNullable<TBlueprint["meta"]> ? Readonly<{
|
|
25
|
-
readonly type: "any";
|
|
26
|
-
readonly readable: true;
|
|
27
|
-
readonly writeable: true;
|
|
28
|
-
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
29
|
-
readonly type: "any";
|
|
30
|
-
readonly readable: true;
|
|
31
|
-
readonly writeable: true;
|
|
32
|
-
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>)[K]] ? never : K]: (ValueMetadata extends NonNullable<TBlueprint["meta"]> ? Readonly<{
|
|
33
|
-
readonly type: "any";
|
|
34
|
-
readonly readable: true;
|
|
35
|
-
readonly writeable: true;
|
|
36
|
-
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
37
|
-
readonly type: "any";
|
|
38
|
-
readonly readable: true;
|
|
39
|
-
readonly writeable: true;
|
|
40
|
-
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>)[K]; } : never>;
|
|
41
|
-
readonly options: Readonly<(import("@zwave-js/cc").CCValueOptions extends NonNullable<TBlueprint["options"]> ? {
|
|
42
|
-
readonly internal: false;
|
|
43
|
-
readonly minVersion: 1;
|
|
44
|
-
readonly secret: false;
|
|
45
|
-
readonly stateful: true;
|
|
46
|
-
readonly supportsEndpoints: true;
|
|
47
|
-
readonly autoCreate: true;
|
|
48
|
-
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
49
|
-
readonly internal: false;
|
|
50
|
-
readonly minVersion: 1;
|
|
51
|
-
readonly secret: false;
|
|
52
|
-
readonly stateful: true;
|
|
53
|
-
readonly supportsEndpoints: true;
|
|
54
|
-
readonly autoCreate: true;
|
|
55
|
-
}, ("stateful" | "secret" | "internal" | "minVersion" | "supportsEndpoints" | "autoCreate") & keyof NonNullable<TBlueprint["options"]>> & TBlueprint["options"]>) extends infer T ? { [K in keyof T as [undefined] extends [(import("@zwave-js/cc").CCValueOptions extends NonNullable<TBlueprint["options"]> ? {
|
|
56
|
-
readonly internal: false;
|
|
57
|
-
readonly minVersion: 1;
|
|
58
|
-
readonly secret: false;
|
|
59
|
-
readonly stateful: true;
|
|
60
|
-
readonly supportsEndpoints: true;
|
|
61
|
-
readonly autoCreate: true;
|
|
62
|
-
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
63
|
-
readonly internal: false;
|
|
64
|
-
readonly minVersion: 1;
|
|
65
|
-
readonly secret: false;
|
|
66
|
-
readonly stateful: true;
|
|
67
|
-
readonly supportsEndpoints: true;
|
|
68
|
-
readonly autoCreate: true;
|
|
69
|
-
}, ("stateful" | "secret" | "internal" | "minVersion" | "supportsEndpoints" | "autoCreate") & keyof NonNullable<TBlueprint["options"]>> & TBlueprint["options"]>)[K]] ? never : K]: (import("@zwave-js/cc").CCValueOptions extends NonNullable<TBlueprint["options"]> ? {
|
|
70
|
-
readonly internal: false;
|
|
71
|
-
readonly minVersion: 1;
|
|
72
|
-
readonly secret: false;
|
|
73
|
-
readonly stateful: true;
|
|
74
|
-
readonly supportsEndpoints: true;
|
|
75
|
-
readonly autoCreate: true;
|
|
76
|
-
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
24
|
+
};
|
|
25
|
+
options: {
|
|
77
26
|
readonly internal: false;
|
|
78
27
|
readonly minVersion: 1;
|
|
79
28
|
readonly secret: false;
|
|
80
29
|
readonly stateful: true;
|
|
81
30
|
readonly supportsEndpoints: true;
|
|
82
31
|
readonly autoCreate: true;
|
|
83
|
-
}
|
|
32
|
+
};
|
|
84
33
|
};
|
|
85
34
|
targetValue: {
|
|
86
|
-
|
|
87
|
-
|
|
35
|
+
id: {
|
|
36
|
+
readonly commandClass: (typeof CommandClasses)["Binary Switch"];
|
|
37
|
+
readonly property: "targetValue";
|
|
38
|
+
};
|
|
39
|
+
endpoint: (endpoint?: number) => {
|
|
88
40
|
readonly commandClass: (typeof CommandClasses)["Binary Switch"];
|
|
89
41
|
readonly endpoint: number;
|
|
90
42
|
readonly property: "targetValue";
|
|
91
43
|
};
|
|
92
|
-
|
|
93
|
-
readonly meta:
|
|
94
|
-
readonly
|
|
95
|
-
readonly
|
|
96
|
-
readonly
|
|
97
|
-
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
98
|
-
readonly type: "any";
|
|
44
|
+
is: (valueId: import("@zwave-js/core/safe").ValueID) => boolean;
|
|
45
|
+
readonly meta: {
|
|
46
|
+
readonly label: "Target value";
|
|
47
|
+
readonly valueChangeOptions: readonly ["transitionDuration"];
|
|
48
|
+
readonly type: "boolean";
|
|
99
49
|
readonly readable: true;
|
|
100
50
|
readonly writeable: true;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
readonly readable: true;
|
|
104
|
-
readonly writeable: true;
|
|
105
|
-
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
106
|
-
readonly type: "any";
|
|
107
|
-
readonly readable: true;
|
|
108
|
-
readonly writeable: true;
|
|
109
|
-
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>)[K]] ? never : K]: (ValueMetadata extends NonNullable<TBlueprint["meta"]> ? Readonly<{
|
|
110
|
-
readonly type: "any";
|
|
111
|
-
readonly readable: true;
|
|
112
|
-
readonly writeable: true;
|
|
113
|
-
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
114
|
-
readonly type: "any";
|
|
115
|
-
readonly readable: true;
|
|
116
|
-
readonly writeable: true;
|
|
117
|
-
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>)[K]; } : never>;
|
|
118
|
-
readonly options: Readonly<(import("@zwave-js/cc").CCValueOptions extends NonNullable<TBlueprint["options"]> ? {
|
|
119
|
-
readonly internal: false;
|
|
120
|
-
readonly minVersion: 1;
|
|
121
|
-
readonly secret: false;
|
|
122
|
-
readonly stateful: true;
|
|
123
|
-
readonly supportsEndpoints: true;
|
|
124
|
-
readonly autoCreate: true;
|
|
125
|
-
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
126
|
-
readonly internal: false;
|
|
127
|
-
readonly minVersion: 1;
|
|
128
|
-
readonly secret: false;
|
|
129
|
-
readonly stateful: true;
|
|
130
|
-
readonly supportsEndpoints: true;
|
|
131
|
-
readonly autoCreate: true;
|
|
132
|
-
}, ("stateful" | "secret" | "internal" | "minVersion" | "supportsEndpoints" | "autoCreate") & keyof NonNullable<TBlueprint["options"]>> & TBlueprint["options"]>) extends infer T ? { [K in keyof T as [undefined] extends [(import("@zwave-js/cc").CCValueOptions extends NonNullable<TBlueprint["options"]> ? {
|
|
133
|
-
readonly internal: false;
|
|
134
|
-
readonly minVersion: 1;
|
|
135
|
-
readonly secret: false;
|
|
136
|
-
readonly stateful: true;
|
|
137
|
-
readonly supportsEndpoints: true;
|
|
138
|
-
readonly autoCreate: true;
|
|
139
|
-
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
140
|
-
readonly internal: false;
|
|
141
|
-
readonly minVersion: 1;
|
|
142
|
-
readonly secret: false;
|
|
143
|
-
readonly stateful: true;
|
|
144
|
-
readonly supportsEndpoints: true;
|
|
145
|
-
readonly autoCreate: true;
|
|
146
|
-
}, ("stateful" | "secret" | "internal" | "minVersion" | "supportsEndpoints" | "autoCreate") & keyof NonNullable<TBlueprint["options"]>> & TBlueprint["options"]>)[K]] ? never : K]: (import("@zwave-js/cc").CCValueOptions extends NonNullable<TBlueprint["options"]> ? {
|
|
147
|
-
readonly internal: false;
|
|
148
|
-
readonly minVersion: 1;
|
|
149
|
-
readonly secret: false;
|
|
150
|
-
readonly stateful: true;
|
|
151
|
-
readonly supportsEndpoints: true;
|
|
152
|
-
readonly autoCreate: true;
|
|
153
|
-
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
51
|
+
};
|
|
52
|
+
options: {
|
|
154
53
|
readonly internal: false;
|
|
155
54
|
readonly minVersion: 1;
|
|
156
55
|
readonly secret: false;
|
|
157
56
|
readonly stateful: true;
|
|
158
57
|
readonly supportsEndpoints: true;
|
|
159
58
|
readonly autoCreate: true;
|
|
160
|
-
}
|
|
59
|
+
};
|
|
161
60
|
};
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
61
|
+
duration: {
|
|
62
|
+
id: {
|
|
63
|
+
readonly commandClass: (typeof CommandClasses)["Binary Switch"];
|
|
64
|
+
readonly property: "duration";
|
|
65
|
+
};
|
|
66
|
+
endpoint: (endpoint?: number) => {
|
|
165
67
|
readonly commandClass: (typeof CommandClasses)["Binary Switch"];
|
|
166
68
|
readonly endpoint: number;
|
|
167
|
-
readonly property: "
|
|
69
|
+
readonly property: "duration";
|
|
168
70
|
};
|
|
169
|
-
|
|
170
|
-
readonly meta:
|
|
171
|
-
readonly
|
|
172
|
-
readonly
|
|
173
|
-
readonly
|
|
174
|
-
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
175
|
-
readonly type: "any";
|
|
176
|
-
readonly readable: true;
|
|
177
|
-
readonly writeable: true;
|
|
178
|
-
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>) extends infer T ? { [K in keyof T as [undefined] extends [(ValueMetadata extends NonNullable<TBlueprint["meta"]> ? Readonly<{
|
|
179
|
-
readonly type: "any";
|
|
180
|
-
readonly readable: true;
|
|
181
|
-
readonly writeable: true;
|
|
182
|
-
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
183
|
-
readonly type: "any";
|
|
184
|
-
readonly readable: true;
|
|
185
|
-
readonly writeable: true;
|
|
186
|
-
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>)[K]] ? never : K]: (ValueMetadata extends NonNullable<TBlueprint["meta"]> ? Readonly<{
|
|
187
|
-
readonly type: "any";
|
|
71
|
+
is: (valueId: import("@zwave-js/core/safe").ValueID) => boolean;
|
|
72
|
+
readonly meta: {
|
|
73
|
+
readonly label: "Remaining duration";
|
|
74
|
+
readonly writeable: false;
|
|
75
|
+
readonly type: "duration";
|
|
188
76
|
readonly readable: true;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
readonly type: "any";
|
|
192
|
-
readonly readable: true;
|
|
193
|
-
readonly writeable: true;
|
|
194
|
-
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>)[K]; } : never>;
|
|
195
|
-
readonly options: Readonly<(import("@zwave-js/cc").CCValueOptions extends NonNullable<TBlueprint["options"]> ? {
|
|
196
|
-
readonly internal: false;
|
|
197
|
-
readonly minVersion: 1;
|
|
198
|
-
readonly secret: false;
|
|
199
|
-
readonly stateful: true;
|
|
200
|
-
readonly supportsEndpoints: true;
|
|
201
|
-
readonly autoCreate: true;
|
|
202
|
-
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
203
|
-
readonly internal: false;
|
|
204
|
-
readonly minVersion: 1;
|
|
205
|
-
readonly secret: false;
|
|
206
|
-
readonly stateful: true;
|
|
207
|
-
readonly supportsEndpoints: true;
|
|
208
|
-
readonly autoCreate: true;
|
|
209
|
-
}, ("stateful" | "secret" | "internal" | "minVersion" | "supportsEndpoints" | "autoCreate") & keyof NonNullable<TBlueprint["options"]>> & TBlueprint["options"]>) extends infer T ? { [K in keyof T as [undefined] extends [(import("@zwave-js/cc").CCValueOptions extends NonNullable<TBlueprint["options"]> ? {
|
|
210
|
-
readonly internal: false;
|
|
211
|
-
readonly minVersion: 1;
|
|
212
|
-
readonly secret: false;
|
|
213
|
-
readonly stateful: true;
|
|
214
|
-
readonly supportsEndpoints: true;
|
|
215
|
-
readonly autoCreate: true;
|
|
216
|
-
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
217
|
-
readonly internal: false;
|
|
218
|
-
readonly minVersion: 1;
|
|
219
|
-
readonly secret: false;
|
|
220
|
-
readonly stateful: true;
|
|
221
|
-
readonly supportsEndpoints: true;
|
|
222
|
-
readonly autoCreate: true;
|
|
223
|
-
}, ("stateful" | "secret" | "internal" | "minVersion" | "supportsEndpoints" | "autoCreate") & keyof NonNullable<TBlueprint["options"]>> & TBlueprint["options"]>)[K]] ? never : K]: (import("@zwave-js/cc").CCValueOptions extends NonNullable<TBlueprint["options"]> ? {
|
|
224
|
-
readonly internal: false;
|
|
225
|
-
readonly minVersion: 1;
|
|
226
|
-
readonly secret: false;
|
|
227
|
-
readonly stateful: true;
|
|
228
|
-
readonly supportsEndpoints: true;
|
|
229
|
-
readonly autoCreate: true;
|
|
230
|
-
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
77
|
+
};
|
|
78
|
+
options: {
|
|
231
79
|
readonly internal: false;
|
|
232
|
-
readonly minVersion:
|
|
80
|
+
readonly minVersion: 2;
|
|
233
81
|
readonly secret: false;
|
|
234
82
|
readonly stateful: true;
|
|
235
83
|
readonly supportsEndpoints: true;
|
|
236
84
|
readonly autoCreate: true;
|
|
237
|
-
}
|
|
85
|
+
};
|
|
238
86
|
};
|
|
239
87
|
}>;
|
|
240
88
|
export declare class BinarySwitchCCAPI extends CCAPI {
|
|
@@ -34,7 +34,7 @@ __export(BinarySwitchCC_exports, {
|
|
|
34
34
|
BinarySwitchCCGet: () => BinarySwitchCCGet,
|
|
35
35
|
BinarySwitchCCReport: () => BinarySwitchCCReport,
|
|
36
36
|
BinarySwitchCCSet: () => BinarySwitchCCSet,
|
|
37
|
-
BinarySwitchCCValues: () => BinarySwitchCCValues
|
|
37
|
+
BinarySwitchCCValues: () => import_CCValues_generated.BinarySwitchCCValues
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(BinarySwitchCC_exports);
|
|
40
40
|
var __validateArgs = __toESM(require("./BinarySwitchCC._validateArgs.js"), 1);
|
|
@@ -45,6 +45,7 @@ var import_CommandClass = require("../lib/CommandClass.js");
|
|
|
45
45
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|
|
46
46
|
var import_Values = require("../lib/Values.js");
|
|
47
47
|
var import_Types = require("../lib/_Types.js");
|
|
48
|
+
var import_CCValues_generated = require("./_CCValues.generated.js");
|
|
48
49
|
var __runInitializers = function(thisArg, initializers, value) {
|
|
49
50
|
var useValue = arguments.length > 2;
|
|
50
51
|
for (var i = 0; i < initializers.length; i++) {
|
|
@@ -86,23 +87,6 @@ var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializ
|
|
|
86
87
|
done = true;
|
|
87
88
|
};
|
|
88
89
|
const { validateArgs_BinarySwitchCCAPI_set } = __validateArgs;
|
|
89
|
-
const BinarySwitchCCValues = Object.freeze({
|
|
90
|
-
...import_Values.V.defineStaticCCValues(import_safe.CommandClasses["Binary Switch"], {
|
|
91
|
-
...import_Values.V.staticProperty("currentValue", {
|
|
92
|
-
...import_safe.ValueMetadata.ReadOnlyBoolean,
|
|
93
|
-
label: "Current value"
|
|
94
|
-
}),
|
|
95
|
-
...import_Values.V.staticProperty("targetValue", {
|
|
96
|
-
...import_safe.ValueMetadata.Boolean,
|
|
97
|
-
label: "Target value",
|
|
98
|
-
valueChangeOptions: ["transitionDuration"]
|
|
99
|
-
}),
|
|
100
|
-
...import_Values.V.staticProperty("duration", {
|
|
101
|
-
...import_safe.ValueMetadata.ReadOnlyDuration,
|
|
102
|
-
label: "Remaining duration"
|
|
103
|
-
}, { minVersion: 2 })
|
|
104
|
-
})
|
|
105
|
-
});
|
|
106
90
|
let BinarySwitchCCAPI = (() => {
|
|
107
91
|
let _classDecorators = [(0, import_CommandClassDecorators.API)(import_safe.CommandClasses["Binary Switch"])];
|
|
108
92
|
let _classDescriptor;
|
|
@@ -181,7 +165,7 @@ let BinarySwitchCCAPI = (() => {
|
|
|
181
165
|
}
|
|
182
166
|
[import_API.SET_VALUE_HOOKS] = (__runInitializers(this, _instanceExtraInitializers), ({ property }, value, options) => {
|
|
183
167
|
if (property === "targetValue") {
|
|
184
|
-
const currentValueValueId = BinarySwitchCCValues.currentValue.endpoint(this.endpoint.index);
|
|
168
|
+
const currentValueValueId = import_CCValues_generated.BinarySwitchCCValues.currentValue.endpoint(this.endpoint.index);
|
|
185
169
|
return {
|
|
186
170
|
optimisticallyUpdateRelatedValues: /* @__PURE__ */ __name((_supervisedAndSuccessful) => {
|
|
187
171
|
if (this.isSinglecast()) {
|
|
@@ -222,7 +206,7 @@ let BinarySwitchCCAPI = (() => {
|
|
|
222
206
|
return BinarySwitchCCAPI2 = _classThis;
|
|
223
207
|
})();
|
|
224
208
|
let BinarySwitchCC = (() => {
|
|
225
|
-
let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_safe.CommandClasses["Binary Switch"]), (0, import_CommandClassDecorators.implementedVersion)(2), (0, import_CommandClassDecorators.ccValues)(BinarySwitchCCValues)];
|
|
209
|
+
let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_safe.CommandClasses["Binary Switch"]), (0, import_CommandClassDecorators.implementedVersion)(2), (0, import_CommandClassDecorators.ccValues)(import_CCValues_generated.BinarySwitchCCValues)];
|
|
226
210
|
let _classDescriptor;
|
|
227
211
|
let _classExtraInitializers = [];
|
|
228
212
|
let _classThis;
|
|
@@ -279,7 +263,7 @@ remaining duration: ${resp.duration?.toString() ?? "undefined"}`;
|
|
|
279
263
|
}
|
|
280
264
|
}
|
|
281
265
|
setMappedBasicValue(ctx, value) {
|
|
282
|
-
this.setValue(ctx, BinarySwitchCCValues.currentValue, value > 0);
|
|
266
|
+
this.setValue(ctx, import_CCValues_generated.BinarySwitchCCValues.currentValue, value > 0);
|
|
283
267
|
return true;
|
|
284
268
|
}
|
|
285
269
|
};
|
|
@@ -352,7 +336,7 @@ let BinarySwitchCCSet = (() => {
|
|
|
352
336
|
return BinarySwitchCCSet2 = _classThis;
|
|
353
337
|
})();
|
|
354
338
|
let BinarySwitchCCReport = (() => {
|
|
355
|
-
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.BinarySwitchCommand.Report), (0, import_CommandClassDecorators.ccValueProperty)("currentValue", BinarySwitchCCValues.currentValue), (0, import_CommandClassDecorators.ccValueProperty)("targetValue", BinarySwitchCCValues.targetValue), (0, import_CommandClassDecorators.ccValueProperty)("duration", BinarySwitchCCValues.duration)];
|
|
339
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.BinarySwitchCommand.Report), (0, import_CommandClassDecorators.ccValueProperty)("currentValue", import_CCValues_generated.BinarySwitchCCValues.currentValue), (0, import_CommandClassDecorators.ccValueProperty)("targetValue", import_CCValues_generated.BinarySwitchCCValues.targetValue), (0, import_CommandClassDecorators.ccValueProperty)("duration", import_CCValues_generated.BinarySwitchCCValues.duration)];
|
|
356
340
|
let _classDescriptor;
|
|
357
341
|
let _classExtraInitializers = [];
|
|
358
342
|
let _classThis;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/BinarySwitchCC.ts"],
|
|
4
|
-
"sourcesContent": ["import { type CCEncodingContext, type CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\tDuration,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MaybeUnknown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\tUNKNOWN_STATE,\n\tValueMetadata,\n\ttype WithAddress,\n\tencodeMaybeBoolean,\n\tmaybeUnknownToString,\n\tparseMaybeBoolean,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\tSET_VALUE_HOOKS,\n\ttype SetValueImplementation,\n\ttype SetValueImplementationHooksFactory,\n\tthrowUnsupportedProperty,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype RefreshValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { BinarySwitchCommand } from \"../lib/_Types.js\";\n\nexport const BinarySwitchCCValues = Object.freeze({\n\t...V.defineStaticCCValues(CommandClasses[\"Binary Switch\"], {\n\t\t...V.staticProperty(\n\t\t\t\"currentValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Current value\",\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"targetValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Boolean,\n\t\t\t\tlabel: \"Target value\",\n\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"duration\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyDuration,\n\t\t\t\tlabel: \"Remaining duration\",\n\t\t\t} as const,\n\t\t\t{ minVersion: 2 } as const,\n\t\t),\n\t}),\n});\n\n@API(CommandClasses[\"Binary Switch\"])\nexport class BinarySwitchCCAPI extends CCAPI {\n\tpublic supportsCommand(cmd: BinarySwitchCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase BinarySwitchCommand.Get:\n\t\t\t\treturn this.isSinglecast();\n\t\t\tcase BinarySwitchCommand.Set:\n\t\t\t\treturn true;\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async get() {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySwitchCommand,\n\t\t\tBinarySwitchCommand.Get,\n\t\t);\n\n\t\tconst cc = new BinarySwitchCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<BinarySwitchCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\t// interpret unknown values as false\n\t\t\t\tcurrentValue: response.currentValue || false,\n\t\t\t\ttargetValue: response.targetValue,\n\t\t\t\tduration: response.duration,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Sets the switch to the given value\n\t * @param targetValue The target value to set\n\t * @param duration The duration after which the target value should be reached. Can be a Duration instance or a user-friendly duration string like `\"1m17s\"`. Only supported in V2 and above.\n\t */\n\t@validateArgs()\n\tpublic async set(\n\t\ttargetValue: boolean,\n\t\tduration?: Duration | string,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySwitchCommand,\n\t\t\tBinarySwitchCommand.Set,\n\t\t);\n\n\t\tconst cc = new BinarySwitchCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tprotected override get [SET_VALUE](): SetValueImplementation {\n\t\treturn async function(\n\t\t\tthis: BinarySwitchCCAPI,\n\t\t\t{ property },\n\t\t\tvalue,\n\t\t\toptions,\n\t\t) {\n\t\t\tif (property !== \"targetValue\") {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t\tif (typeof value !== \"boolean\") {\n\t\t\t\tthrowWrongValueType(\n\t\t\t\t\tthis.ccId,\n\t\t\t\t\tproperty,\n\t\t\t\t\t\"boolean\",\n\t\t\t\t\ttypeof value,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\treturn this.set(value, duration);\n\t\t};\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory = (\n\t\t{ property },\n\t\tvalue,\n\t\toptions,\n\t) => {\n\t\tif (property === \"targetValue\") {\n\t\t\tconst currentValueValueId = BinarySwitchCCValues.currentValue\n\t\t\t\t.endpoint(this.endpoint.index);\n\n\t\t\treturn {\n\t\t\t\toptimisticallyUpdateRelatedValues: (\n\t\t\t\t\t_supervisedAndSuccessful,\n\t\t\t\t) => {\n\t\t\t\t\t// After setting targetValue, optimistically update currentValue\n\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\tthis.tryGetValueDB()?.setValue(\n\t\t\t\t\t\t\tcurrentValueValueId,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (this.isMulticast()) {\n\t\t\t\t\t\t// Figure out which nodes were affected by this command\n\t\t\t\t\t\tconst affectedNodes = this.endpoint.node.physicalNodes\n\t\t\t\t\t\t\t.filter((node) =>\n\t\t\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t\t\t\t?.supportsCC(this.ccId)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t// and optimistically update the currentValue\n\t\t\t\t\t\tfor (const node of affectedNodes) {\n\t\t\t\t\t\t\tthis.host\n\t\t\t\t\t\t\t\t.tryGetValueDB(node.id)\n\t\t\t\t\t\t\t\t?.setValue(currentValueValueId, value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tverifyChanges: () => {\n\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\t// We query currentValue instead of targetValue to make sure that unsolicited updates cancel the scheduled poll\n\t\t\t\t\t\tthis.schedulePoll(currentValueValueId, value, {\n\t\t\t\t\t\t\tduration: Duration.from(\n\t\t\t\t\t\t\t\toptions?.transitionDuration,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t// on/off \"transitions\" are usually fast\n\t\t\t\t\t\t\ttransition: \"fast\",\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// For multicasts, do not schedule a refresh - this could cause a LOT of traffic\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t};\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: BinarySwitchCCAPI, { property }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"currentValue\":\n\t\t\t\tcase \"targetValue\":\n\t\t\t\tcase \"duration\":\n\t\t\t\t\treturn (await this.get())?.[property];\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n}\n\n@commandClass(CommandClasses[\"Binary Switch\"])\n@implementedVersion(2)\n@ccValues(BinarySwitchCCValues)\nexport class BinarySwitchCC extends CommandClass {\n\tdeclare ccCommand: BinarySwitchCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Binary Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\t// Query the current state\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying Binary Switch state...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\n\t\tconst resp = await api.get();\n\t\tif (resp) {\n\t\t\tlet logMessage = `received Binary Switch state:\ncurrent value: ${resp.currentValue}`;\n\t\t\tif (resp.targetValue != undefined) {\n\t\t\t\tlogMessage += `\ntarget value: ${resp.targetValue}\nremaining duration: ${resp.duration?.toString() ?? \"undefined\"}`;\n\t\t\t}\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: logMessage,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic setMappedBasicValue(\n\t\tctx: GetValueDB,\n\t\tvalue: number,\n\t): boolean {\n\t\tthis.setValue(ctx, BinarySwitchCCValues.currentValue, value > 0);\n\t\treturn true;\n\t}\n}\n\n// @publicAPI\nexport interface BinarySwitchCCSetOptions {\n\ttargetValue: boolean;\n\tduration?: Duration | string;\n}\n\n@CCCommand(BinarySwitchCommand.Set)\n@useSupervision()\nexport class BinarySwitchCCSet extends BinarySwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySwitchCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): BinarySwitchCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst targetValue = !!raw.payload[0];\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 2) {\n\t\t\tduration = Duration.parseSet(raw.payload[1]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic targetValue: boolean;\n\tpublic duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.targetValue ? 0xff : 0x00,\n\t\t\t(this.duration ?? Duration.default()).serializeSet(),\n\t\t]);\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 2 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1, only send the target value\n\t\t\tthis.payload = this.payload.subarray(0, 1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"target value\": this.targetValue,\n\t\t};\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface BinarySwitchCCReportOptions {\n\tcurrentValue?: MaybeUnknown<boolean>;\n\ttargetValue?: MaybeUnknown<boolean>;\n\tduration?: Duration | string;\n}\n\n@CCCommand(BinarySwitchCommand.Report)\n@ccValueProperty(\"currentValue\", BinarySwitchCCValues.currentValue)\n@ccValueProperty(\"targetValue\", BinarySwitchCCValues.targetValue)\n@ccValueProperty(\"duration\", BinarySwitchCCValues.duration)\nexport class BinarySwitchCCReport extends BinarySwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySwitchCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.currentValue = options.currentValue;\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BinarySwitchCCReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst currentValue: MaybeUnknown<boolean> | undefined =\n\t\t\tparseMaybeBoolean(\n\t\t\t\traw.payload[0],\n\t\t\t);\n\t\tlet targetValue: MaybeUnknown<boolean> | undefined;\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\ttargetValue = parseMaybeBoolean(raw.payload[1]);\n\t\t\tduration = Duration.parseReport(raw.payload[2]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcurrentValue,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic readonly currentValue: MaybeUnknown<boolean> | undefined;\n\n\tpublic readonly targetValue: MaybeUnknown<boolean> | undefined;\n\n\tpublic readonly duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tencodeMaybeBoolean(this.currentValue ?? UNKNOWN_STATE),\n\t\t]);\n\t\tif (this.targetValue !== undefined) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tBytes.from([\n\t\t\t\t\tencodeMaybeBoolean(this.targetValue),\n\t\t\t\t\t(this.duration ?? Duration.default()).serializeReport(),\n\t\t\t\t]),\n\t\t\t]);\n\t\t}\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"current value\": maybeUnknownToString(this.currentValue),\n\t\t};\n\t\tif (this.targetValue !== undefined) {\n\t\t\tmessage[\"target value\"] = maybeUnknownToString(this.targetValue);\n\t\t}\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(BinarySwitchCommand.Get)\n@expectedCCResponse(BinarySwitchCCReport)\nexport class BinarySwitchCCGet extends BinarySwitchCC {}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAiBO;AACP,IAAAA,eAAsB;AAEtB,iBAUO;AACP,0BAMO;AACP,oCASO;AACP,oBAAkB;AAClB,mBAAoC
|
|
4
|
+
"sourcesContent": ["import { type CCEncodingContext, type CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\tDuration,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MaybeUnknown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\tUNKNOWN_STATE,\n\tValueMetadata,\n\ttype WithAddress,\n\tencodeMaybeBoolean,\n\tmaybeUnknownToString,\n\tparseMaybeBoolean,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\tSET_VALUE_HOOKS,\n\ttype SetValueImplementation,\n\ttype SetValueImplementationHooksFactory,\n\tthrowUnsupportedProperty,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype RefreshValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { BinarySwitchCommand } from \"../lib/_Types.js\";\n\nexport const BinarySwitchCCValues = V.defineCCValues(\n\tCommandClasses[\"Binary Switch\"],\n\t{\n\t\t...V.staticProperty(\n\t\t\t\"currentValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Current value\",\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"targetValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Boolean,\n\t\t\t\tlabel: \"Target value\",\n\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"duration\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyDuration,\n\t\t\t\tlabel: \"Remaining duration\",\n\t\t\t} as const,\n\t\t\t{ minVersion: 2 } as const,\n\t\t),\n\t},\n);\n\n@API(CommandClasses[\"Binary Switch\"])\nexport class BinarySwitchCCAPI extends CCAPI {\n\tpublic supportsCommand(cmd: BinarySwitchCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase BinarySwitchCommand.Get:\n\t\t\t\treturn this.isSinglecast();\n\t\t\tcase BinarySwitchCommand.Set:\n\t\t\t\treturn true;\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async get() {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySwitchCommand,\n\t\t\tBinarySwitchCommand.Get,\n\t\t);\n\n\t\tconst cc = new BinarySwitchCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<BinarySwitchCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\t// interpret unknown values as false\n\t\t\t\tcurrentValue: response.currentValue || false,\n\t\t\t\ttargetValue: response.targetValue,\n\t\t\t\tduration: response.duration,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Sets the switch to the given value\n\t * @param targetValue The target value to set\n\t * @param duration The duration after which the target value should be reached. Can be a Duration instance or a user-friendly duration string like `\"1m17s\"`. Only supported in V2 and above.\n\t */\n\t@validateArgs()\n\tpublic async set(\n\t\ttargetValue: boolean,\n\t\tduration?: Duration | string,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tBinarySwitchCommand,\n\t\t\tBinarySwitchCommand.Set,\n\t\t);\n\n\t\tconst cc = new BinarySwitchCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tprotected override get [SET_VALUE](): SetValueImplementation {\n\t\treturn async function(\n\t\t\tthis: BinarySwitchCCAPI,\n\t\t\t{ property },\n\t\t\tvalue,\n\t\t\toptions,\n\t\t) {\n\t\t\tif (property !== \"targetValue\") {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t\tif (typeof value !== \"boolean\") {\n\t\t\t\tthrowWrongValueType(\n\t\t\t\t\tthis.ccId,\n\t\t\t\t\tproperty,\n\t\t\t\t\t\"boolean\",\n\t\t\t\t\ttypeof value,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\treturn this.set(value, duration);\n\t\t};\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory = (\n\t\t{ property },\n\t\tvalue,\n\t\toptions,\n\t) => {\n\t\tif (property === \"targetValue\") {\n\t\t\tconst currentValueValueId = BinarySwitchCCValues.currentValue\n\t\t\t\t.endpoint(this.endpoint.index);\n\n\t\t\treturn {\n\t\t\t\toptimisticallyUpdateRelatedValues: (\n\t\t\t\t\t_supervisedAndSuccessful,\n\t\t\t\t) => {\n\t\t\t\t\t// After setting targetValue, optimistically update currentValue\n\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\tthis.tryGetValueDB()?.setValue(\n\t\t\t\t\t\t\tcurrentValueValueId,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (this.isMulticast()) {\n\t\t\t\t\t\t// Figure out which nodes were affected by this command\n\t\t\t\t\t\tconst affectedNodes = this.endpoint.node.physicalNodes\n\t\t\t\t\t\t\t.filter((node) =>\n\t\t\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t\t\t\t?.supportsCC(this.ccId)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t// and optimistically update the currentValue\n\t\t\t\t\t\tfor (const node of affectedNodes) {\n\t\t\t\t\t\t\tthis.host\n\t\t\t\t\t\t\t\t.tryGetValueDB(node.id)\n\t\t\t\t\t\t\t\t?.setValue(currentValueValueId, value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tverifyChanges: () => {\n\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\t// We query currentValue instead of targetValue to make sure that unsolicited updates cancel the scheduled poll\n\t\t\t\t\t\tthis.schedulePoll(currentValueValueId, value, {\n\t\t\t\t\t\t\tduration: Duration.from(\n\t\t\t\t\t\t\t\toptions?.transitionDuration,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t// on/off \"transitions\" are usually fast\n\t\t\t\t\t\t\ttransition: \"fast\",\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// For multicasts, do not schedule a refresh - this could cause a LOT of traffic\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t};\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: BinarySwitchCCAPI, { property }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"currentValue\":\n\t\t\t\tcase \"targetValue\":\n\t\t\t\tcase \"duration\":\n\t\t\t\t\treturn (await this.get())?.[property];\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n}\n\n@commandClass(CommandClasses[\"Binary Switch\"])\n@implementedVersion(2)\n@ccValues(BinarySwitchCCValues)\nexport class BinarySwitchCC extends CommandClass {\n\tdeclare ccCommand: BinarySwitchCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Binary Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\t// Query the current state\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying Binary Switch state...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\n\t\tconst resp = await api.get();\n\t\tif (resp) {\n\t\t\tlet logMessage = `received Binary Switch state:\ncurrent value: ${resp.currentValue}`;\n\t\t\tif (resp.targetValue != undefined) {\n\t\t\t\tlogMessage += `\ntarget value: ${resp.targetValue}\nremaining duration: ${resp.duration?.toString() ?? \"undefined\"}`;\n\t\t\t}\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: logMessage,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic setMappedBasicValue(\n\t\tctx: GetValueDB,\n\t\tvalue: number,\n\t): boolean {\n\t\tthis.setValue(ctx, BinarySwitchCCValues.currentValue, value > 0);\n\t\treturn true;\n\t}\n}\n\n// @publicAPI\nexport interface BinarySwitchCCSetOptions {\n\ttargetValue: boolean;\n\tduration?: Duration | string;\n}\n\n@CCCommand(BinarySwitchCommand.Set)\n@useSupervision()\nexport class BinarySwitchCCSet extends BinarySwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySwitchCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): BinarySwitchCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst targetValue = !!raw.payload[0];\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 2) {\n\t\t\tduration = Duration.parseSet(raw.payload[1]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic targetValue: boolean;\n\tpublic duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.targetValue ? 0xff : 0x00,\n\t\t\t(this.duration ?? Duration.default()).serializeSet(),\n\t\t]);\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 2 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1, only send the target value\n\t\t\tthis.payload = this.payload.subarray(0, 1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"target value\": this.targetValue,\n\t\t};\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface BinarySwitchCCReportOptions {\n\tcurrentValue?: MaybeUnknown<boolean>;\n\ttargetValue?: MaybeUnknown<boolean>;\n\tduration?: Duration | string;\n}\n\n@CCCommand(BinarySwitchCommand.Report)\n@ccValueProperty(\"currentValue\", BinarySwitchCCValues.currentValue)\n@ccValueProperty(\"targetValue\", BinarySwitchCCValues.targetValue)\n@ccValueProperty(\"duration\", BinarySwitchCCValues.duration)\nexport class BinarySwitchCCReport extends BinarySwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BinarySwitchCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.currentValue = options.currentValue;\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BinarySwitchCCReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst currentValue: MaybeUnknown<boolean> | undefined =\n\t\t\tparseMaybeBoolean(\n\t\t\t\traw.payload[0],\n\t\t\t);\n\t\tlet targetValue: MaybeUnknown<boolean> | undefined;\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\ttargetValue = parseMaybeBoolean(raw.payload[1]);\n\t\t\tduration = Duration.parseReport(raw.payload[2]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcurrentValue,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic readonly currentValue: MaybeUnknown<boolean> | undefined;\n\n\tpublic readonly targetValue: MaybeUnknown<boolean> | undefined;\n\n\tpublic readonly duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tencodeMaybeBoolean(this.currentValue ?? UNKNOWN_STATE),\n\t\t]);\n\t\tif (this.targetValue !== undefined) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tBytes.from([\n\t\t\t\t\tencodeMaybeBoolean(this.targetValue),\n\t\t\t\t\t(this.duration ?? Duration.default()).serializeReport(),\n\t\t\t\t]),\n\t\t\t]);\n\t\t}\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"current value\": maybeUnknownToString(this.currentValue),\n\t\t};\n\t\tif (this.targetValue !== undefined) {\n\t\t\tmessage[\"target value\"] = maybeUnknownToString(this.targetValue);\n\t\t}\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(BinarySwitchCommand.Get)\n@expectedCCResponse(BinarySwitchCCReport)\nexport class BinarySwitchCCGet extends BinarySwitchCC {}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAiBO;AACP,IAAAA,eAAsB;AAEtB,iBAUO;AACP,0BAMO;AACP,oCASO;AACP,oBAAkB;AAClB,mBAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgCvB,qBAAiB,MAAA;8BAD7B,mCAAI,2BAAe,eAAe,CAAC,CAAC;;;;oBACE;;;yCAAA,YAAK;WAAA;;;;;;;;AA0C3C,mBAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAgB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AA1CjB,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;IACL,gBAAgB,KAAwB;AAC9C,cAAQ,KAAK;QACZ,KAAK,iCAAoB;AACxB,iBA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