@zwave-js/cc 14.3.10 → 15.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/cc/AlarmSensorCC.d.ts +139 -57
- package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
- package/build/cjs/cc/AssociationCC.d.ts +178 -43
- package/build/cjs/cc/AssociationCC.js +0 -4
- package/build/cjs/cc/AssociationCC.js.map +2 -2
- package/build/cjs/cc/AssociationGroupInfoCC.d.ts +138 -38
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/BarrierOperatorCC.d.ts +275 -73
- package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
- package/build/cjs/cc/BasicCC.d.ts +316 -71
- package/build/cjs/cc/BasicCC.js.map +2 -2
- package/build/cjs/cc/BatteryCC.d.ts +759 -164
- package/build/cjs/cc/BatteryCC.js.map +2 -2
- package/build/cjs/cc/BinarySensorCC.d.ts +91 -26
- package/build/cjs/cc/BinarySensorCC.js.map +2 -2
- package/build/cjs/cc/BinarySwitchCC.d.ts +190 -38
- package/build/cjs/cc/BinarySwitchCC.js.map +2 -2
- package/build/cjs/cc/CRC16CC.d.ts +4 -8
- package/build/cjs/cc/CRC16CC.js +4 -27
- package/build/cjs/cc/CRC16CC.js.map +2 -2
- package/build/cjs/cc/CentralSceneCC.d.ts +272 -53
- package/build/cjs/cc/CentralSceneCC.js.map +2 -2
- package/build/cjs/cc/ClimateControlScheduleCC.d.ts +150 -37
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
- package/build/cjs/cc/ClockCC.d.ts +3 -3
- package/build/cjs/cc/ClockCC.js.map +2 -2
- package/build/cjs/cc/ColorSwitchCC.d.ts +423 -96
- package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
- package/build/cjs/cc/ConfigurationCC._validateArgs.js +1 -1
- package/build/cjs/cc/ConfigurationCC._validateArgs.js.map +1 -1
- package/build/cjs/cc/ConfigurationCC.d.ts +101 -37
- package/build/cjs/cc/ConfigurationCC.js +0 -8
- package/build/cjs/cc/ConfigurationCC.js.map +2 -2
- package/build/cjs/cc/DeviceResetLocallyCC.d.ts +1 -1
- package/build/cjs/cc/DeviceResetLocallyCC.js.map +2 -2
- package/build/cjs/cc/DoorLockCC._validateArgs.js +1 -1
- package/build/cjs/cc/DoorLockCC._validateArgs.js.map +1 -1
- package/build/cjs/cc/DoorLockCC.d.ts +1731 -419
- package/build/cjs/cc/DoorLockCC.js.map +2 -2
- package/build/cjs/cc/DoorLockLoggingCC.d.ts +64 -12
- package/build/cjs/cc/DoorLockLoggingCC.js.map +2 -2
- package/build/cjs/cc/EnergyProductionCC.d.ts +29 -14
- package/build/cjs/cc/EnergyProductionCC.js.map +2 -2
- package/build/cjs/cc/EntryControlCC.d.ts +308 -57
- package/build/cjs/cc/EntryControlCC.js.map +2 -2
- package/build/cjs/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts +2 -0
- package/build/cjs/cc/FirmwareUpdateMetaDataCC._validateArgs.js +26 -0
- package/build/cjs/cc/FirmwareUpdateMetaDataCC._validateArgs.js.map +1 -1
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.d.ts +389 -64
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +154 -8
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlModeCC.d.ts +125 -27
- package/build/cjs/cc/HumidityControlModeCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlOperatingStateCC.d.ts +64 -18
- package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlSetpointCC.d.ts +116 -39
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
- package/build/cjs/cc/InclusionControllerCC.d.ts +4 -4
- package/build/cjs/cc/InclusionControllerCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.d.ts +325 -83
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/IrrigationCC.d.ts +2170 -683
- package/build/cjs/cc/IrrigationCC.js.map +2 -2
- package/build/cjs/cc/LanguageCC.d.ts +128 -26
- package/build/cjs/cc/LanguageCC.js.map +2 -2
- package/build/cjs/cc/LockCC.d.ts +64 -14
- package/build/cjs/cc/LockCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerProprietaryCC.d.ts +2 -2
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.d.ts +219 -57
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
- package/build/cjs/cc/MeterCC.d.ts +364 -89
- package/build/cjs/cc/MeterCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelAssociationCC.d.ts +138 -40
- package/build/cjs/cc/MultiChannelAssociationCC.js +0 -5
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelCC.d.ts +469 -99
- package/build/cjs/cc/MultiChannelCC.js +8 -72
- package/build/cjs/cc/MultiChannelCC.js.map +2 -2
- package/build/cjs/cc/MultiCommandCC.d.ts +4 -8
- package/build/cjs/cc/MultiCommandCC.js +4 -37
- package/build/cjs/cc/MultiCommandCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSensorCC.d.ts +118 -33
- package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSwitchCC.d.ts +490 -125
- package/build/cjs/cc/MultilevelSwitchCC.js.map +2 -2
- package/build/cjs/cc/NodeNamingCC.d.ts +128 -26
- package/build/cjs/cc/NodeNamingCC.js.map +2 -2
- package/build/cjs/cc/NotificationCC.d.ts +603 -161
- package/build/cjs/cc/NotificationCC.js +12 -1
- package/build/cjs/cc/NotificationCC.js.map +2 -2
- package/build/cjs/cc/PowerlevelCC.d.ts +6 -6
- package/build/cjs/cc/PowerlevelCC.js.map +2 -2
- package/build/cjs/cc/ProtectionCC.d.ts +496 -94
- package/build/cjs/cc/ProtectionCC.js.map +2 -2
- package/build/cjs/cc/SceneActivationCC.d.ts +127 -28
- package/build/cjs/cc/SceneActivationCC.js.map +2 -2
- package/build/cjs/cc/SceneActuatorConfigurationCC.d.ts +52 -25
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.d.ts +53 -25
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
- package/build/cjs/cc/ScheduleEntryLockCC.d.ts +268 -64
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
- package/build/cjs/cc/Security2CC.d.ts +15 -21
- package/build/cjs/cc/Security2CC.js +32 -347
- package/build/cjs/cc/Security2CC.js.map +3 -3
- package/build/cjs/cc/SecurityCC.d.ts +12 -19
- package/build/cjs/cc/SecurityCC.js +12 -106
- package/build/cjs/cc/SecurityCC.js.map +2 -2
- package/build/cjs/cc/SoundSwitchCC.d.ts +253 -64
- package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
- package/build/cjs/cc/SupervisionCC.d.ts +28 -16
- package/build/cjs/cc/SupervisionCC.js +4 -29
- package/build/cjs/cc/SupervisionCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanModeCC.d.ts +187 -38
- package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanStateCC.d.ts +64 -18
- package/build/cjs/cc/ThermostatFanStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatModeCC.d.ts +189 -40
- package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +65 -19
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetbackCC.d.ts +4 -4
- package/build/cjs/cc/ThermostatSetbackCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetpointCC.d.ts +116 -36
- package/build/cjs/cc/ThermostatSetpointCC.js.map +2 -2
- package/build/cjs/cc/TimeCC.d.ts +6 -6
- package/build/cjs/cc/TimeCC.js.map +2 -2
- package/build/cjs/cc/TimeParametersCC.d.ts +63 -12
- package/build/cjs/cc/TimeParametersCC.js.map +2 -2
- package/build/cjs/cc/TransportServiceCC.d.ts +7 -12
- package/build/cjs/cc/TransportServiceCC.js +3 -20
- package/build/cjs/cc/TransportServiceCC.js.map +2 -2
- package/build/cjs/cc/UserCodeCC._validateArgs.js +1 -1
- package/build/cjs/cc/UserCodeCC._validateArgs.js.map +1 -1
- package/build/cjs/cc/UserCodeCC.d.ts +931 -176
- package/build/cjs/cc/UserCodeCC.js.map +2 -2
- package/build/cjs/cc/VersionCC.d.ts +897 -185
- package/build/cjs/cc/VersionCC.js.map +2 -2
- package/build/cjs/cc/WakeUpCC.d.ts +190 -38
- package/build/cjs/cc/WakeUpCC.js.map +2 -2
- package/build/cjs/cc/WindowCoveringCC.d.ts +193 -103
- package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
- package/build/cjs/cc/ZWavePlusCC.d.ts +311 -51
- package/build/cjs/cc/ZWavePlusCC.js.map +2 -2
- package/build/cjs/cc/ZWaveProtocolCC.d.ts +28 -28
- package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.d.ts +4 -4
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +2 -2
- package/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index_browser.d.ts +9 -0
- package/build/cjs/index_browser.js +41 -1
- package/build/cjs/index_browser.js.map +2 -2
- package/build/cjs/lib/API.d.ts +7 -5
- package/build/cjs/lib/API.js +1 -1
- package/build/cjs/lib/API.js.map +2 -2
- package/build/cjs/lib/CommandClass.d.ts +10 -21
- package/build/cjs/lib/CommandClass.js +51 -106
- package/build/cjs/lib/CommandClass.js.map +3 -3
- package/build/cjs/lib/CommandClassDecorators.d.ts +1 -1
- package/build/cjs/lib/CommandClassDecorators.js +3 -3
- package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
- package/build/cjs/lib/Values.d.ts +2 -2
- package/build/cjs/lib/Values.js.map +2 -2
- package/build/cjs/lib/traits.d.ts +94 -0
- package/build/cjs/lib/traits.js +17 -0
- package/build/cjs/lib/traits.js.map +7 -0
- package/build/cjs/lib/utils.d.ts +2 -2
- package/build/cjs/lib/utils.js.map +2 -2
- package/build/esm/cc/AlarmSensorCC.d.ts +139 -57
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +0 -1
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/AssociationCC.d.ts +178 -43
- package/build/esm/cc/AssociationCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC.js +0 -13
- package/build/esm/cc/AssociationCC.js.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts +138 -38
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +0 -6
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts +275 -73
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +0 -3
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.d.ts +316 -71
- package/build/esm/cc/BasicCC.d.ts.map +1 -1
- package/build/esm/cc/BasicCC.js +0 -2
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.d.ts +759 -164
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +1 -2
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySensorCC.d.ts +91 -26
- package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySensorCC.js +0 -3
- package/build/esm/cc/BinarySensorCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.d.ts +190 -38
- package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +0 -2
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CRC16CC.d.ts +4 -8
- package/build/esm/cc/CRC16CC.d.ts.map +1 -1
- package/build/esm/cc/CRC16CC.js +4 -34
- package/build/esm/cc/CRC16CC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.d.ts +272 -53
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +0 -1
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts +150 -37
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +0 -3
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.d.ts +3 -3
- package/build/esm/cc/ClockCC.d.ts.map +1 -1
- package/build/esm/cc/ClockCC.js +0 -1
- package/build/esm/cc/ClockCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.d.ts +423 -96
- package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +0 -6
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC._validateArgs.js +1 -1
- package/build/esm/cc/ConfigurationCC._validateArgs.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts +101 -37
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +0 -25
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.d.ts +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.d.ts.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC._validateArgs.js +1 -1
- package/build/esm/cc/DoorLockCC._validateArgs.js.map +1 -1
- package/build/esm/cc/DoorLockCC.d.ts +1731 -419
- package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC.js +0 -2
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.d.ts +64 -12
- package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.js +0 -1
- package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/esm/cc/EnergyProductionCC.d.ts +29 -14
- package/build/esm/cc/EnergyProductionCC.d.ts.map +1 -1
- package/build/esm/cc/EnergyProductionCC.js +0 -2
- package/build/esm/cc/EnergyProductionCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts +308 -57
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +0 -1
- package/build/esm/cc/EntryControlCC.js.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts +2 -0
- package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.js +20 -0
- package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.js.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts +389 -64
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js +158 -30
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.d.ts +125 -27
- package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.js +0 -1
- package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts +64 -18
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.d.ts +116 -39
- package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +0 -4
- package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/esm/cc/InclusionControllerCC.d.ts +4 -4
- package/build/esm/cc/InclusionControllerCC.d.ts.map +1 -1
- package/build/esm/cc/InclusionControllerCC.js +0 -2
- package/build/esm/cc/InclusionControllerCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts +325 -83
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +0 -7
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts +2170 -683
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +0 -9
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.d.ts +128 -26
- package/build/esm/cc/LanguageCC.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC.js +0 -1
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/LockCC.d.ts +64 -14
- package/build/esm/cc/LockCC.d.ts.map +1 -1
- package/build/esm/cc/LockCC.js +0 -1
- package/build/esm/cc/LockCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.d.ts +2 -2
- 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 +219 -57
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +0 -2
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts +364 -89
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +0 -4
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.d.ts +138 -40
- package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.js +0 -16
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts +469 -99
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +8 -101
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultiCommandCC.d.ts +4 -8
- package/build/esm/cc/MultiCommandCC.d.ts.map +1 -1
- package/build/esm/cc/MultiCommandCC.js +4 -38
- package/build/esm/cc/MultiCommandCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.d.ts +118 -33
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +0 -5
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts +490 -125
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +0 -4
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NodeNamingCC.d.ts +128 -26
- package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC.js +0 -2
- package/build/esm/cc/NodeNamingCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts +603 -161
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +18 -12
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/PowerlevelCC.d.ts +6 -6
- package/build/esm/cc/PowerlevelCC.d.ts.map +1 -1
- package/build/esm/cc/PowerlevelCC.js +0 -4
- package/build/esm/cc/PowerlevelCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts +496 -94
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +0 -3
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActivationCC.d.ts +127 -28
- package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActivationCC.js +0 -1
- package/build/esm/cc/SceneActivationCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts +52 -25
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +0 -2
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts +53 -25
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +0 -2
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.d.ts +268 -64
- package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js +0 -14
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.d.ts +15 -21
- package/build/esm/cc/Security2CC.d.ts.map +1 -1
- package/build/esm/cc/Security2CC.js +27 -475
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.d.ts +12 -19
- package/build/esm/cc/SecurityCC.d.ts.map +1 -1
- package/build/esm/cc/SecurityCC.js +13 -138
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.d.ts +253 -64
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +0 -7
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.d.ts +28 -16
- package/build/esm/cc/SupervisionCC.d.ts.map +1 -1
- package/build/esm/cc/SupervisionCC.js +4 -34
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.d.ts +187 -38
- package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +0 -1
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.d.ts +64 -18
- package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.d.ts +189 -40
- package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +0 -3
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts +65 -19
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.d.ts +4 -4
- package/build/esm/cc/ThermostatSetbackCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js +0 -2
- package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts +116 -36
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +0 -6
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TimeCC.d.ts +6 -6
- package/build/esm/cc/TimeCC.d.ts.map +1 -1
- package/build/esm/cc/TimeCC.js +0 -4
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/TimeParametersCC.d.ts +63 -12
- package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
- package/build/esm/cc/TimeParametersCC.js +0 -1
- package/build/esm/cc/TimeParametersCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.d.ts +7 -12
- package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +5 -38
- package/build/esm/cc/TransportServiceCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC._validateArgs.js +1 -1
- package/build/esm/cc/UserCodeCC._validateArgs.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts +931 -176
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +0 -12
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts +897 -185
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +0 -4
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.d.ts +190 -38
- package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
- package/build/esm/cc/WakeUpCC.js +0 -1
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts +193 -103
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +0 -5
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.d.ts +311 -51
- package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +0 -1
- package/build/esm/cc/ZWavePlusCC.js.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.d.ts +28 -28
- package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js +0 -27
- package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts +4 -4
- package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +0 -3
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/index.d.ts +1 -0
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index_browser.d.ts +9 -0
- package/build/esm/index_browser.d.ts.map +1 -1
- package/build/esm/index_browser.js +8 -1
- package/build/esm/index_browser.js.map +1 -1
- package/build/esm/lib/API.d.ts +7 -5
- package/build/esm/lib/API.d.ts.map +1 -1
- package/build/esm/lib/API.js +1 -1
- package/build/esm/lib/API.js.map +1 -1
- package/build/esm/lib/CommandClass.d.ts +10 -21
- package/build/esm/lib/CommandClass.d.ts.map +1 -1
- package/build/esm/lib/CommandClass.js +8 -101
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/CommandClassDecorators.d.ts +1 -1
- package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
- package/build/esm/lib/CommandClassDecorators.js +1 -1
- package/build/esm/lib/CommandClassDecorators.js.map +1 -1
- package/build/esm/lib/Values.d.ts +2 -2
- package/build/esm/lib/Values.d.ts.map +1 -1
- package/build/esm/lib/Values.js.map +1 -1
- package/build/esm/lib/traits.d.ts +94 -0
- package/build/esm/lib/traits.d.ts.map +1 -0
- package/build/esm/lib/traits.js +2 -0
- package/build/esm/lib/traits.js.map +1 -0
- package/build/esm/lib/utils.d.ts +2 -2
- package/build/esm/lib/utils.d.ts.map +1 -1
- package/build/esm/lib/utils.js.map +1 -1
- package/package.json +13 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/BatteryCC.ts"],
|
|
4
|
-
"sourcesContent": ["import { type WithAddress, timespan } from \"@zwave-js/core\";\nimport type {\n\tControlsCC,\n\tEndpointId,\n\tGetEndpoint,\n\tMessageOrCCLogEntry,\n\tMessageRecord,\n\tNodeId,\n\tSinglecastCC,\n\tSupportsCC,\n} from \"@zwave-js/core/safe\";\nimport {\n\tCommandClasses,\n\ttype MaybeNotKnown,\n\tMessagePriority,\n\tValueMetadata,\n\tenumValuesToMetadataStates,\n\tparseFloatWithScale,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport type {\n\tCCEncodingContext,\n\tCCParsingContext,\n\tGetDeviceConfig,\n\tGetNode,\n\tGetSupportedCCVersion,\n\tGetValueDB,\n} from \"@zwave-js/host/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { type AllOrNone, getEnumMemberName, pick } from \"@zwave-js/shared/safe\";\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 {\n\tBatteryChargingStatus,\n\tBatteryCommand,\n\tBatteryReplacementStatus,\n} from \"../lib/_Types.js\";\nimport { NotificationCCValues } from \"./NotificationCC.js\";\n\nexport const BatteryCCValues = Object.freeze({\n\t...V.defineStaticCCValues(CommandClasses.Battery, {\n\t\t...V.staticProperty(\n\t\t\t\"level\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tmax: 100,\n\t\t\t\tunit: \"%\",\n\t\t\t\tlabel: \"Battery level\",\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"isLow\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Low battery level\",\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"maximumCapacity\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tmax: 100,\n\t\t\t\tunit: \"%\",\n\t\t\t\tlabel: \"Maximum capacity\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"temperature\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyInt8,\n\t\t\t\tlabel: \"Temperature\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"chargingStatus\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tlabel: \"Charging status\",\n\t\t\t\tstates: enumValuesToMetadataStates(BatteryChargingStatus),\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"rechargeable\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Rechargeable\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"backup\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Used as backup\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"overheating\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Overheating\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"lowFluid\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Fluid is low\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"rechargeOrReplace\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tlabel: \"Recharge or replace\",\n\t\t\t\tstates: enumValuesToMetadataStates(BatteryReplacementStatus),\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"disconnected\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Battery is disconnected\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"lowTemperatureStatus\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Battery temperature is low\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 3,\n\t\t\t} as const,\n\t\t),\n\t}),\n});\n\n// @noSetValueAPI This CC is read-only\n\n@API(CommandClasses.Battery)\nexport class BatteryCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(cmd: BatteryCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase BatteryCommand.Get:\n\t\t\t\treturn true; // This is mandatory\n\t\t\tcase BatteryCommand.HealthGet:\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: BatteryCCAPI, { property }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"level\":\n\t\t\t\tcase \"isLow\":\n\t\t\t\tcase \"chargingStatus\":\n\t\t\t\tcase \"rechargeable\":\n\t\t\t\tcase \"backup\":\n\t\t\t\tcase \"overheating\":\n\t\t\t\tcase \"lowFluid\":\n\t\t\t\tcase \"rechargeOrReplace\":\n\t\t\t\tcase \"lowTemperatureStatus\":\n\t\t\t\tcase \"disconnected\":\n\t\t\t\t\treturn (await this.get())?.[property];\n\n\t\t\t\tcase \"maximumCapacity\":\n\t\t\t\tcase \"temperature\":\n\t\t\t\t\treturn (await this.getHealth())?.[property];\n\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\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async get() {\n\t\tthis.assertSupportsCommand(BatteryCommand, BatteryCommand.Get);\n\n\t\tconst cc = new BatteryCCGet({\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<BatteryCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\n\t\t\t\t\"level\",\n\t\t\t\t\"isLow\",\n\t\t\t\t\"chargingStatus\",\n\t\t\t\t\"rechargeable\",\n\t\t\t\t\"backup\",\n\t\t\t\t\"overheating\",\n\t\t\t\t\"lowFluid\",\n\t\t\t\t\"rechargeOrReplace\",\n\t\t\t\t\"lowTemperatureStatus\",\n\t\t\t\t\"disconnected\",\n\t\t\t]);\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getHealth() {\n\t\tthis.assertSupportsCommand(BatteryCommand, BatteryCommand.HealthGet);\n\n\t\tconst cc = new BatteryCCHealthGet({\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<BatteryCCHealthReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"maximumCapacity\", \"temperature\"]);\n\t\t}\n\t}\n}\n\n@commandClass(CommandClasses.Battery)\n@implementedVersion(3)\n@ccValues(BatteryCCValues)\nexport class BatteryCC extends CommandClass {\n\tdeclare ccCommand: BatteryCommand;\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\t// Query the Battery status\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.Battery,\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: \"querying battery status...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\n\t\tconst batteryStatus = await api.get();\n\t\tif (batteryStatus) {\n\t\t\tlet logMessage = `received response for battery information:\nlevel: ${batteryStatus.level}${\n\t\t\t\tbatteryStatus.isLow ? \" (low)\" : \"\"\n\t\t\t}`;\n\t\t\tif (api.version >= 2) {\n\t\t\t\tlogMessage += `\nstatus: ${\n\t\t\t\t\tBatteryChargingStatus[batteryStatus.chargingStatus!]\n\t\t\t\t}\nrechargeable: ${batteryStatus.rechargeable}\nis backup: ${batteryStatus.backup}\nis overheating: ${batteryStatus.overheating}\nfluid is low: ${batteryStatus.lowFluid}\nneeds to be replaced or charged: ${\n\t\t\t\t\tBatteryReplacementStatus[batteryStatus.rechargeOrReplace!]\n\t\t\t\t}\nis low temperature ${batteryStatus.lowTemperatureStatus}\nis disconnected: ${batteryStatus.disconnected}`;\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\n\t\tif (api.version >= 2) {\n\t\t\t// always query the health\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying battery health...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\n\t\t\tconst batteryHealth = await api.getHealth();\n\t\t\tif (batteryHealth) {\n\t\t\t\tconst logMessage = `received response for battery health:\nmax. capacity: ${batteryHealth.maximumCapacity} %\ntemperature: ${batteryHealth.temperature} \u00B0C`;\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}\n\t\t}\n\t}\n\n\tpublic shouldRefreshValues(\n\t\tthis: SinglecastCC<this>,\n\t\tctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t): boolean {\n\t\t// Check when the battery state was last updated\n\t\tconst valueDB = ctx.tryGetValueDB(this.nodeId);\n\t\tif (!valueDB) return true;\n\n\t\tconst lastUpdated = valueDB.getTimestamp(\n\t\t\tBatteryCCValues.level.endpoint(this.endpointIndex),\n\t\t);\n\t\treturn (\n\t\t\tlastUpdated == undefined\n\t\t\t// The specs say once per month, but that's a bit too unfrequent IMO\n\t\t\t// Also the maximum that setInterval supports is ~24.85 days\n\t\t\t|| Date.now() - lastUpdated > timespan.days(7)\n\t\t);\n\t}\n}\n\n// @publicAPI\nexport type BatteryCCReportOptions =\n\t& (\n\t\t| {\n\t\t\tisLow?: false;\n\t\t\tlevel: number;\n\t\t}\n\t\t| {\n\t\t\tisLow: true;\n\t\t\tlevel?: undefined;\n\t\t}\n\t)\n\t& AllOrNone<{\n\t\t// V2+\n\t\tchargingStatus: BatteryChargingStatus;\n\t\trechargeable: boolean;\n\t\tbackup: boolean;\n\t\toverheating: boolean;\n\t\tlowFluid: boolean;\n\t\trechargeOrReplace: BatteryReplacementStatus;\n\t\tdisconnected: boolean;\n\t}>\n\t& AllOrNone<{\n\t\t// V3+\n\t\tlowTemperatureStatus: boolean;\n\t}>;\n\n@CCCommand(BatteryCommand.Report)\n@ccValueProperty(\"level\", BatteryCCValues.level)\n@ccValueProperty(\"isLow\", BatteryCCValues.isLow)\n@ccValueProperty(\"chargingStatus\", BatteryCCValues.chargingStatus)\n@ccValueProperty(\"rechargeable\", BatteryCCValues.rechargeable)\n@ccValueProperty(\"backup\", BatteryCCValues.backup)\n@ccValueProperty(\"overheating\", BatteryCCValues.overheating)\n@ccValueProperty(\"lowFluid\", BatteryCCValues.lowFluid)\n@ccValueProperty(\"rechargeOrReplace\", BatteryCCValues.rechargeOrReplace)\n@ccValueProperty(\"disconnected\", BatteryCCValues.disconnected)\n@ccValueProperty(\"lowTemperatureStatus\", BatteryCCValues.lowTemperatureStatus)\nexport class BatteryCCReport extends BatteryCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BatteryCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.level = options.isLow ? 0 : options.level;\n\t\tthis.isLow = !!options.isLow;\n\t\tthis.chargingStatus = options.chargingStatus;\n\t\tthis.rechargeable = options.rechargeable;\n\t\tthis.backup = options.backup;\n\t\tthis.overheating = options.overheating;\n\t\tthis.lowFluid = options.lowFluid;\n\t\tthis.rechargeOrReplace = options.rechargeOrReplace;\n\t\tthis.disconnected = options.disconnected;\n\t\tthis.lowTemperatureStatus = options.lowTemperatureStatus;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): BatteryCCReport {\n\t\tlet ccOptions: BatteryCCReportOptions;\n\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst level = raw.payload[0];\n\n\t\tif (level === 0xff) {\n\t\t\tccOptions = {\n\t\t\t\tisLow: true,\n\t\t\t};\n\t\t} else {\n\t\t\tccOptions = {\n\t\t\t\tisLow: false,\n\t\t\t\tlevel,\n\t\t\t};\n\t\t}\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\t// Starting with V2\n\t\t\tconst chargingStatus: BatteryChargingStatus = raw.payload[1] >>> 6;\n\t\t\tconst rechargeable = !!(raw.payload[1] & 0b0010_0000);\n\t\t\tconst backup = !!(raw.payload[1] & 0b0001_0000);\n\t\t\tconst overheating = !!(raw.payload[1] & 0b1000);\n\t\t\tconst lowFluid = !!(raw.payload[1] & 0b0100);\n\t\t\tconst rechargeOrReplace: BatteryReplacementStatus =\n\t\t\t\t!!(raw.payload[1] & 0b10)\n\t\t\t\t\t? BatteryReplacementStatus.Now\n\t\t\t\t\t: !!(raw.payload[1] & 0b1)\n\t\t\t\t\t? BatteryReplacementStatus.Soon\n\t\t\t\t\t: BatteryReplacementStatus.No;\n\t\t\tconst lowTemperatureStatus = !!(raw.payload[2] & 0b10);\n\t\t\tconst disconnected = !!(raw.payload[2] & 0b1);\n\n\t\t\tccOptions = {\n\t\t\t\t...ccOptions,\n\t\t\t\tchargingStatus,\n\t\t\t\trechargeable,\n\t\t\t\tbackup,\n\t\t\t\toverheating,\n\t\t\t\tlowFluid,\n\t\t\t\trechargeOrReplace,\n\t\t\t\tlowTemperatureStatus,\n\t\t\t\tdisconnected,\n\t\t\t};\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t...ccOptions,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// Na\u00EFve heuristic for a full battery\n\t\tif (this.level >= 90) {\n\t\t\t// Some devices send Notification CC Reports with battery information,\n\t\t\t// or this information is mapped from legacy V1 alarm values.\n\t\t\t// We may need to idle the corresponding values when the battery is full\n\t\t\tconst notificationCCVersion = ctx.getSupportedCCVersion(\n\t\t\t\tCommandClasses.Notification,\n\t\t\t\tthis.nodeId as number,\n\t\t\t\tthis.endpointIndex,\n\t\t\t);\n\t\t\tif (\n\t\t\t\t// supported\n\t\t\t\tnotificationCCVersion > 0\n\t\t\t\t// but idling is not required\n\t\t\t\t&& notificationCCVersion < 8\n\t\t\t) {\n\t\t\t\tconst batteryLevelStatusValue = NotificationCCValues\n\t\t\t\t\t.notificationVariable(\n\t\t\t\t\t\t\"Power Management\",\n\t\t\t\t\t\t\"Battery level status\",\n\t\t\t\t\t);\n\t\t\t\t// If not undefined and not idle\n\t\t\t\tif (this.getValue(ctx, batteryLevelStatusValue)) {\n\t\t\t\t\tthis.setValue(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tbatteryLevelStatusValue,\n\t\t\t\t\t\t0, /* idle */\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic readonly level: number;\n\n\tpublic readonly isLow: boolean;\n\n\tpublic readonly chargingStatus: BatteryChargingStatus | undefined;\n\n\tpublic readonly rechargeable: boolean | undefined;\n\n\tpublic readonly backup: boolean | undefined;\n\n\tpublic readonly overheating: boolean | undefined;\n\n\tpublic readonly lowFluid: boolean | undefined;\n\n\tpublic readonly rechargeOrReplace: BatteryReplacementStatus | undefined;\n\n\tpublic readonly disconnected: boolean | undefined;\n\n\tpublic readonly lowTemperatureStatus: boolean | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([this.isLow ? 0xff : this.level]);\n\t\tif (this.chargingStatus != 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\t(this.chargingStatus << 6)\n\t\t\t\t\t+ (this.rechargeable ? 0b0010_0000 : 0)\n\t\t\t\t\t+ (this.backup ? 0b0001_0000 : 0)\n\t\t\t\t\t+ (this.overheating ? 0b1000 : 0)\n\t\t\t\t\t+ (this.lowFluid ? 0b0100 : 0)\n\t\t\t\t\t+ (this.rechargeOrReplace === BatteryReplacementStatus.Now\n\t\t\t\t\t\t? 0b10\n\t\t\t\t\t\t: this.rechargeOrReplace\n\t\t\t\t\t\t\t\t=== BatteryReplacementStatus.Soon\n\t\t\t\t\t\t? 0b1\n\t\t\t\t\t\t: 0),\n\t\t\t\t\t(this.lowTemperatureStatus ? 0b10 : 0)\n\t\t\t\t\t+ (this.disconnected ? 0b1 : 0),\n\t\t\t\t]),\n\t\t\t]);\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\tlevel: this.level,\n\t\t\t\"is low\": this.isLow,\n\t\t};\n\t\tif (this.chargingStatus != undefined) {\n\t\t\tmessage[\"charging status\"] = getEnumMemberName(\n\t\t\t\tBatteryChargingStatus,\n\t\t\t\tthis.chargingStatus,\n\t\t\t);\n\t\t}\n\t\tif (this.rechargeable != undefined) {\n\t\t\tmessage.rechargeable = this.rechargeable;\n\t\t}\n\t\tif (this.backup != undefined) {\n\t\t\tmessage.backup = this.backup;\n\t\t}\n\t\tif (this.overheating != undefined) {\n\t\t\tmessage.overheating = this.overheating;\n\t\t}\n\t\tif (this.lowFluid != undefined) {\n\t\t\tmessage[\"low fluid\"] = this.lowFluid;\n\t\t}\n\t\tif (this.rechargeOrReplace != undefined) {\n\t\t\tmessage[\"recharge or replace\"] = getEnumMemberName(\n\t\t\t\tBatteryReplacementStatus,\n\t\t\t\tthis.rechargeOrReplace,\n\t\t\t);\n\t\t}\n\t\tif (this.lowTemperatureStatus != undefined) {\n\t\t\tmessage.lowTemperatureStatus = this.lowTemperatureStatus;\n\t\t}\n\t\tif (this.disconnected != undefined) {\n\t\t\tmessage.disconnected = this.disconnected;\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(BatteryCommand.Get)\n@expectedCCResponse(BatteryCCReport)\nexport class BatteryCCGet extends BatteryCC {}\n\n// @publicAPI\nexport interface BatteryCCHealthReportOptions {\n\tmaximumCapacity?: number;\n\ttemperature?: number;\n\ttemperatureScale?: number;\n}\n\n@CCCommand(BatteryCommand.HealthReport)\n@ccValueProperty(\"maximumCapacity\", BatteryCCValues.maximumCapacity)\n@ccValueProperty(\"temperature\", BatteryCCValues.temperature)\nexport class BatteryCCHealthReport extends BatteryCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BatteryCCHealthReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.maximumCapacity = options.maximumCapacity;\n\t\tthis.temperature = options.temperature;\n\t\tthis.temperatureScale = options.temperatureScale;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BatteryCCHealthReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\t// Parse maximum capacity. 0xff means unknown\n\t\tlet maximumCapacity: number | undefined = raw.payload[0];\n\t\tif (maximumCapacity === 0xff) maximumCapacity = undefined;\n\t\tconst {\n\t\t\tvalue: temperature,\n\t\t\tscale: temperatureScale,\n\t\t} = parseFloatWithScale(\n\t\t\traw.payload.subarray(1),\n\t\t\ttrue, // The temperature field may be omitted\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tmaximumCapacity,\n\t\t\ttemperature,\n\t\t\ttemperatureScale,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// Update the temperature unit in the value DB\n\t\tconst temperatureValue = BatteryCCValues.temperature;\n\t\tthis.setMetadata(ctx, temperatureValue, {\n\t\t\t...temperatureValue.meta,\n\t\t\tunit: this.temperatureScale === 0x00 ? \"\u00B0C\" : undefined,\n\t\t});\n\n\t\treturn true;\n\t}\n\n\tpublic readonly maximumCapacity: number | undefined;\n\n\tpublic readonly temperature: number | undefined;\n\n\tprivate readonly temperatureScale: number | undefined;\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\ttemperature: this.temperature != undefined\n\t\t\t\t\t? this.temperature\n\t\t\t\t\t: \"unknown\",\n\t\t\t\t\"max capacity\": this.maximumCapacity != undefined\n\t\t\t\t\t? `${this.maximumCapacity} %`\n\t\t\t\t\t: \"unknown\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(BatteryCommand.HealthGet)\n@expectedCCResponse(BatteryCCHealthReport)\nexport class BatteryCCHealthGet extends BatteryCC {}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
4
|
+
"sourcesContent": ["import { type CCEncodingContext, type CCParsingContext } from \"@zwave-js/cc\";\nimport { type GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\ttype GetNode,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype WithAddress,\n\ttimespan,\n} from \"@zwave-js/core\";\nimport type {\n\tControlsCC,\n\tEndpointId,\n\tGetEndpoint,\n\tMessageOrCCLogEntry,\n\tMessageRecord,\n\tNodeId,\n\tSinglecastCC,\n\tSupportsCC,\n} from \"@zwave-js/core/safe\";\nimport {\n\tCommandClasses,\n\ttype MaybeNotKnown,\n\tMessagePriority,\n\tValueMetadata,\n\tenumValuesToMetadataStates,\n\tparseFloatWithScale,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { type AllOrNone, getEnumMemberName, pick } from \"@zwave-js/shared/safe\";\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 {\n\tBatteryChargingStatus,\n\tBatteryCommand,\n\tBatteryReplacementStatus,\n} from \"../lib/_Types.js\";\nimport { NotificationCCValues } from \"./NotificationCC.js\";\n\nexport const BatteryCCValues = Object.freeze({\n\t...V.defineStaticCCValues(CommandClasses.Battery, {\n\t\t...V.staticProperty(\n\t\t\t\"level\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tmax: 100,\n\t\t\t\tunit: \"%\",\n\t\t\t\tlabel: \"Battery level\",\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"isLow\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Low battery level\",\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"maximumCapacity\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tmax: 100,\n\t\t\t\tunit: \"%\",\n\t\t\t\tlabel: \"Maximum capacity\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"temperature\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyInt8,\n\t\t\t\tlabel: \"Temperature\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"chargingStatus\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tlabel: \"Charging status\",\n\t\t\t\tstates: enumValuesToMetadataStates(BatteryChargingStatus),\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"rechargeable\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Rechargeable\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"backup\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Used as backup\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"overheating\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Overheating\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"lowFluid\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Fluid is low\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"rechargeOrReplace\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tlabel: \"Recharge or replace\",\n\t\t\t\tstates: enumValuesToMetadataStates(BatteryReplacementStatus),\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"disconnected\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Battery is disconnected\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 2,\n\t\t\t} as const,\n\t\t),\n\n\t\t...V.staticProperty(\n\t\t\t\"lowTemperatureStatus\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\t\tlabel: \"Battery temperature is low\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tminVersion: 3,\n\t\t\t} as const,\n\t\t),\n\t}),\n});\n\n// @noSetValueAPI This CC is read-only\n\n@API(CommandClasses.Battery)\nexport class BatteryCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(cmd: BatteryCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase BatteryCommand.Get:\n\t\t\t\treturn true; // This is mandatory\n\t\t\tcase BatteryCommand.HealthGet:\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: BatteryCCAPI, { property }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"level\":\n\t\t\t\tcase \"isLow\":\n\t\t\t\tcase \"chargingStatus\":\n\t\t\t\tcase \"rechargeable\":\n\t\t\t\tcase \"backup\":\n\t\t\t\tcase \"overheating\":\n\t\t\t\tcase \"lowFluid\":\n\t\t\t\tcase \"rechargeOrReplace\":\n\t\t\t\tcase \"lowTemperatureStatus\":\n\t\t\t\tcase \"disconnected\":\n\t\t\t\t\treturn (await this.get())?.[property];\n\n\t\t\t\tcase \"maximumCapacity\":\n\t\t\t\tcase \"temperature\":\n\t\t\t\t\treturn (await this.getHealth())?.[property];\n\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\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async get() {\n\t\tthis.assertSupportsCommand(BatteryCommand, BatteryCommand.Get);\n\n\t\tconst cc = new BatteryCCGet({\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<BatteryCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\n\t\t\t\t\"level\",\n\t\t\t\t\"isLow\",\n\t\t\t\t\"chargingStatus\",\n\t\t\t\t\"rechargeable\",\n\t\t\t\t\"backup\",\n\t\t\t\t\"overheating\",\n\t\t\t\t\"lowFluid\",\n\t\t\t\t\"rechargeOrReplace\",\n\t\t\t\t\"lowTemperatureStatus\",\n\t\t\t\t\"disconnected\",\n\t\t\t]);\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getHealth() {\n\t\tthis.assertSupportsCommand(BatteryCommand, BatteryCommand.HealthGet);\n\n\t\tconst cc = new BatteryCCHealthGet({\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<BatteryCCHealthReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"maximumCapacity\", \"temperature\"]);\n\t\t}\n\t}\n}\n\n@commandClass(CommandClasses.Battery)\n@implementedVersion(3)\n@ccValues(BatteryCCValues)\nexport class BatteryCC extends CommandClass {\n\tdeclare ccCommand: BatteryCommand;\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\t// Query the Battery status\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.Battery,\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: \"querying battery status...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\n\t\tconst batteryStatus = await api.get();\n\t\tif (batteryStatus) {\n\t\t\tlet logMessage = `received response for battery information:\nlevel: ${batteryStatus.level}${\n\t\t\t\tbatteryStatus.isLow ? \" (low)\" : \"\"\n\t\t\t}`;\n\t\t\tif (api.version >= 2) {\n\t\t\t\tlogMessage += `\nstatus: ${\n\t\t\t\t\tBatteryChargingStatus[batteryStatus.chargingStatus!]\n\t\t\t\t}\nrechargeable: ${batteryStatus.rechargeable}\nis backup: ${batteryStatus.backup}\nis overheating: ${batteryStatus.overheating}\nfluid is low: ${batteryStatus.lowFluid}\nneeds to be replaced or charged: ${\n\t\t\t\t\tBatteryReplacementStatus[batteryStatus.rechargeOrReplace!]\n\t\t\t\t}\nis low temperature ${batteryStatus.lowTemperatureStatus}\nis disconnected: ${batteryStatus.disconnected}`;\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\n\t\tif (api.version >= 2) {\n\t\t\t// always query the health\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying battery health...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\n\t\t\tconst batteryHealth = await api.getHealth();\n\t\t\tif (batteryHealth) {\n\t\t\t\tconst logMessage = `received response for battery health:\nmax. capacity: ${batteryHealth.maximumCapacity} %\ntemperature: ${batteryHealth.temperature} \u00B0C`;\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}\n\t\t}\n\t}\n\n\tpublic shouldRefreshValues(\n\t\tthis: SinglecastCC<this>,\n\t\tctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t): boolean {\n\t\t// Check when the battery state was last updated\n\t\tconst valueDB = ctx.tryGetValueDB(this.nodeId);\n\t\tif (!valueDB) return true;\n\n\t\tconst lastUpdated = valueDB.getTimestamp(\n\t\t\tBatteryCCValues.level.endpoint(this.endpointIndex),\n\t\t);\n\t\treturn (\n\t\t\tlastUpdated == undefined\n\t\t\t// The specs say once per month, but that's a bit too unfrequent IMO\n\t\t\t// Also the maximum that setInterval supports is ~24.85 days\n\t\t\t|| Date.now() - lastUpdated > timespan.days(7)\n\t\t);\n\t}\n}\n\n// @publicAPI\nexport type BatteryCCReportOptions =\n\t& (\n\t\t| {\n\t\t\tisLow?: false;\n\t\t\tlevel: number;\n\t\t}\n\t\t| {\n\t\t\tisLow: true;\n\t\t\tlevel?: undefined;\n\t\t}\n\t)\n\t& AllOrNone<{\n\t\t// V2+\n\t\tchargingStatus: BatteryChargingStatus;\n\t\trechargeable: boolean;\n\t\tbackup: boolean;\n\t\toverheating: boolean;\n\t\tlowFluid: boolean;\n\t\trechargeOrReplace: BatteryReplacementStatus;\n\t\tdisconnected: boolean;\n\t}>\n\t& AllOrNone<{\n\t\t// V3+\n\t\tlowTemperatureStatus: boolean;\n\t}>;\n\n@CCCommand(BatteryCommand.Report)\n@ccValueProperty(\"level\", BatteryCCValues.level)\n@ccValueProperty(\"isLow\", BatteryCCValues.isLow)\n@ccValueProperty(\"chargingStatus\", BatteryCCValues.chargingStatus)\n@ccValueProperty(\"rechargeable\", BatteryCCValues.rechargeable)\n@ccValueProperty(\"backup\", BatteryCCValues.backup)\n@ccValueProperty(\"overheating\", BatteryCCValues.overheating)\n@ccValueProperty(\"lowFluid\", BatteryCCValues.lowFluid)\n@ccValueProperty(\"rechargeOrReplace\", BatteryCCValues.rechargeOrReplace)\n@ccValueProperty(\"disconnected\", BatteryCCValues.disconnected)\n@ccValueProperty(\"lowTemperatureStatus\", BatteryCCValues.lowTemperatureStatus)\nexport class BatteryCCReport extends BatteryCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BatteryCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.level = options.isLow ? 0 : options.level;\n\t\tthis.isLow = !!options.isLow;\n\t\tthis.chargingStatus = options.chargingStatus;\n\t\tthis.rechargeable = options.rechargeable;\n\t\tthis.backup = options.backup;\n\t\tthis.overheating = options.overheating;\n\t\tthis.lowFluid = options.lowFluid;\n\t\tthis.rechargeOrReplace = options.rechargeOrReplace;\n\t\tthis.disconnected = options.disconnected;\n\t\tthis.lowTemperatureStatus = options.lowTemperatureStatus;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): BatteryCCReport {\n\t\tlet ccOptions: BatteryCCReportOptions;\n\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst level = raw.payload[0];\n\n\t\tif (level === 0xff) {\n\t\t\tccOptions = {\n\t\t\t\tisLow: true,\n\t\t\t};\n\t\t} else {\n\t\t\tccOptions = {\n\t\t\t\tisLow: false,\n\t\t\t\tlevel,\n\t\t\t};\n\t\t}\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\t// Starting with V2\n\t\t\tconst chargingStatus: BatteryChargingStatus = raw.payload[1] >>> 6;\n\t\t\tconst rechargeable = !!(raw.payload[1] & 0b0010_0000);\n\t\t\tconst backup = !!(raw.payload[1] & 0b0001_0000);\n\t\t\tconst overheating = !!(raw.payload[1] & 0b1000);\n\t\t\tconst lowFluid = !!(raw.payload[1] & 0b0100);\n\t\t\tconst rechargeOrReplace: BatteryReplacementStatus =\n\t\t\t\t!!(raw.payload[1] & 0b10)\n\t\t\t\t\t? BatteryReplacementStatus.Now\n\t\t\t\t\t: !!(raw.payload[1] & 0b1)\n\t\t\t\t\t? BatteryReplacementStatus.Soon\n\t\t\t\t\t: BatteryReplacementStatus.No;\n\t\t\tconst lowTemperatureStatus = !!(raw.payload[2] & 0b10);\n\t\t\tconst disconnected = !!(raw.payload[2] & 0b1);\n\n\t\t\tccOptions = {\n\t\t\t\t...ccOptions,\n\t\t\t\tchargingStatus,\n\t\t\t\trechargeable,\n\t\t\t\tbackup,\n\t\t\t\toverheating,\n\t\t\t\tlowFluid,\n\t\t\t\trechargeOrReplace,\n\t\t\t\tlowTemperatureStatus,\n\t\t\t\tdisconnected,\n\t\t\t};\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t...ccOptions,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// Na\u00EFve heuristic for a full battery\n\t\tif (this.level >= 90) {\n\t\t\t// Some devices send Notification CC Reports with battery information,\n\t\t\t// or this information is mapped from legacy V1 alarm values.\n\t\t\t// We may need to idle the corresponding values when the battery is full\n\t\t\tconst notificationCCVersion = ctx.getSupportedCCVersion(\n\t\t\t\tCommandClasses.Notification,\n\t\t\t\tthis.nodeId as number,\n\t\t\t\tthis.endpointIndex,\n\t\t\t);\n\t\t\tif (\n\t\t\t\t// supported\n\t\t\t\tnotificationCCVersion > 0\n\t\t\t\t// but idling is not required\n\t\t\t\t&& notificationCCVersion < 8\n\t\t\t) {\n\t\t\t\tconst batteryLevelStatusValue = NotificationCCValues\n\t\t\t\t\t.notificationVariable(\n\t\t\t\t\t\t\"Power Management\",\n\t\t\t\t\t\t\"Battery level status\",\n\t\t\t\t\t);\n\t\t\t\t// If not undefined and not idle\n\t\t\t\tif (this.getValue(ctx, batteryLevelStatusValue)) {\n\t\t\t\t\tthis.setValue(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tbatteryLevelStatusValue,\n\t\t\t\t\t\t0, /* idle */\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic readonly level: number;\n\n\tpublic readonly isLow: boolean;\n\n\tpublic readonly chargingStatus: BatteryChargingStatus | undefined;\n\n\tpublic readonly rechargeable: boolean | undefined;\n\n\tpublic readonly backup: boolean | undefined;\n\n\tpublic readonly overheating: boolean | undefined;\n\n\tpublic readonly lowFluid: boolean | undefined;\n\n\tpublic readonly rechargeOrReplace: BatteryReplacementStatus | undefined;\n\n\tpublic readonly disconnected: boolean | undefined;\n\n\tpublic readonly lowTemperatureStatus: boolean | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.isLow ? 0xff : this.level]);\n\t\tif (this.chargingStatus != 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\t(this.chargingStatus << 6)\n\t\t\t\t\t+ (this.rechargeable ? 0b0010_0000 : 0)\n\t\t\t\t\t+ (this.backup ? 0b0001_0000 : 0)\n\t\t\t\t\t+ (this.overheating ? 0b1000 : 0)\n\t\t\t\t\t+ (this.lowFluid ? 0b0100 : 0)\n\t\t\t\t\t+ (this.rechargeOrReplace === BatteryReplacementStatus.Now\n\t\t\t\t\t\t? 0b10\n\t\t\t\t\t\t: this.rechargeOrReplace\n\t\t\t\t\t\t\t\t=== BatteryReplacementStatus.Soon\n\t\t\t\t\t\t? 0b1\n\t\t\t\t\t\t: 0),\n\t\t\t\t\t(this.lowTemperatureStatus ? 0b10 : 0)\n\t\t\t\t\t+ (this.disconnected ? 0b1 : 0),\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\tlevel: this.level,\n\t\t\t\"is low\": this.isLow,\n\t\t};\n\t\tif (this.chargingStatus != undefined) {\n\t\t\tmessage[\"charging status\"] = getEnumMemberName(\n\t\t\t\tBatteryChargingStatus,\n\t\t\t\tthis.chargingStatus,\n\t\t\t);\n\t\t}\n\t\tif (this.rechargeable != undefined) {\n\t\t\tmessage.rechargeable = this.rechargeable;\n\t\t}\n\t\tif (this.backup != undefined) {\n\t\t\tmessage.backup = this.backup;\n\t\t}\n\t\tif (this.overheating != undefined) {\n\t\t\tmessage.overheating = this.overheating;\n\t\t}\n\t\tif (this.lowFluid != undefined) {\n\t\t\tmessage[\"low fluid\"] = this.lowFluid;\n\t\t}\n\t\tif (this.rechargeOrReplace != undefined) {\n\t\t\tmessage[\"recharge or replace\"] = getEnumMemberName(\n\t\t\t\tBatteryReplacementStatus,\n\t\t\t\tthis.rechargeOrReplace,\n\t\t\t);\n\t\t}\n\t\tif (this.lowTemperatureStatus != undefined) {\n\t\t\tmessage.lowTemperatureStatus = this.lowTemperatureStatus;\n\t\t}\n\t\tif (this.disconnected != undefined) {\n\t\t\tmessage.disconnected = this.disconnected;\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(BatteryCommand.Get)\n@expectedCCResponse(BatteryCCReport)\nexport class BatteryCCGet extends BatteryCC {}\n\n// @publicAPI\nexport interface BatteryCCHealthReportOptions {\n\tmaximumCapacity?: number;\n\ttemperature?: number;\n\ttemperatureScale?: number;\n}\n\n@CCCommand(BatteryCommand.HealthReport)\n@ccValueProperty(\"maximumCapacity\", BatteryCCValues.maximumCapacity)\n@ccValueProperty(\"temperature\", BatteryCCValues.temperature)\nexport class BatteryCCHealthReport extends BatteryCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BatteryCCHealthReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.maximumCapacity = options.maximumCapacity;\n\t\tthis.temperature = options.temperature;\n\t\tthis.temperatureScale = options.temperatureScale;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BatteryCCHealthReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\t// Parse maximum capacity. 0xff means unknown\n\t\tlet maximumCapacity: number | undefined = raw.payload[0];\n\t\tif (maximumCapacity === 0xff) maximumCapacity = undefined;\n\t\tconst {\n\t\t\tvalue: temperature,\n\t\t\tscale: temperatureScale,\n\t\t} = parseFloatWithScale(\n\t\t\traw.payload.subarray(1),\n\t\t\ttrue, // The temperature field may be omitted\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tmaximumCapacity,\n\t\t\ttemperature,\n\t\t\ttemperatureScale,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// Update the temperature unit in the value DB\n\t\tconst temperatureValue = BatteryCCValues.temperature;\n\t\tthis.setMetadata(ctx, temperatureValue, {\n\t\t\t...temperatureValue.meta,\n\t\t\tunit: this.temperatureScale === 0x00 ? \"\u00B0C\" : undefined,\n\t\t});\n\n\t\treturn true;\n\t}\n\n\tpublic readonly maximumCapacity: number | undefined;\n\n\tpublic readonly temperature: number | undefined;\n\n\tprivate readonly temperatureScale: number | undefined;\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\ttemperature: this.temperature != undefined\n\t\t\t\t\t? this.temperature\n\t\t\t\t\t: \"unknown\",\n\t\t\t\t\"max capacity\": this.maximumCapacity != undefined\n\t\t\t\t\t? `${this.maximumCapacity} %`\n\t\t\t\t\t: \"unknown\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(BatteryCommand.HealthGet)\n@expectedCCResponse(BatteryCCHealthReport)\nexport class BatteryCCHealthGet extends BatteryCC {}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kBAMO;AAWP,kBAQO;AACP,IAAAA,eAAsB;AACtB,IAAAA,eAAwD;AACxD,iBAMO;AACP,0BAMO;AACP,oCAQO;AACP,oBAAkB;AAClB,mBAIO;AACP,4BAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9B,MAAM,kBAAkB,OAAO,OAAO;EAC5C,GAAG,gBAAE,qBAAqB,2BAAe,SAAS;IACjD,GAAG,gBAAE,eACJ,SACA;MACC,GAAG,0BAAc;MACjB,KAAK;MACL,MAAM;MACN,OAAO;KACE;IAGX,GAAG,gBAAE,eACJ,SACA;MACC,GAAG,0BAAc;MACjB,OAAO;KACE;IAGX,GAAG,gBAAE,eACJ,mBACA;MACC,GAAG,0BAAc;MACjB,KAAK;MACL,MAAM;MACN,OAAO;OAER;MACC,YAAY;KACH;IAGX,GAAG,gBAAE,eACJ,eACA;MACC,GAAG,0BAAc;MACjB,OAAO;OAER;MACC,YAAY;KACH;IAGX,GAAG,gBAAE,eACJ,kBACA;MACC,GAAG,0BAAc;MACjB,OAAO;MACP,YAAQ,wCAA2B,kCAAqB;OAEzD;MACC,YAAY;KACH;IAGX,GAAG,gBAAE,eACJ,gBACA;MACC,GAAG,0BAAc;MACjB,OAAO;OAER;MACC,YAAY;KACH;IAGX,GAAG,gBAAE,eACJ,UACA;MACC,GAAG,0BAAc;MACjB,OAAO;OAER;MACC,YAAY;KACH;IAGX,GAAG,gBAAE,eACJ,eACA;MACC,GAA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,YAAS;WAAA;;;;;;;;AAAjD,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,24 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { type CCEncodingContext, type CCParsingContext } from "@zwave-js/cc";
|
|
2
|
+
import { CommandClasses, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type SupervisionResult, ValueMetadata, type WithAddress } from "@zwave-js/core/safe";
|
|
3
3
|
import { Bytes } from "@zwave-js/shared/safe";
|
|
4
4
|
import { POLL_VALUE, PhysicalCCAPI, type PollValueImplementation } from "../lib/API.js";
|
|
5
5
|
import { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext } from "../lib/CommandClass.js";
|
|
6
6
|
import { BinarySensorCommand, BinarySensorType } from "../lib/_Types.js";
|
|
7
7
|
export declare const BinarySensorCCValues: Readonly<{
|
|
8
8
|
state: ((sensorType: BinarySensorType) => {
|
|
9
|
-
readonly meta: {
|
|
10
|
-
readonly
|
|
11
|
-
readonly ccSpecific: {
|
|
12
|
-
readonly sensorType: BinarySensorType;
|
|
13
|
-
};
|
|
14
|
-
readonly writeable: false;
|
|
15
|
-
readonly type: "boolean";
|
|
9
|
+
readonly meta: Readonly<(ValueMetadata extends NonNullable<TBlueprint["meta"]> ? Readonly<{
|
|
10
|
+
readonly type: "any";
|
|
16
11
|
readonly readable: true;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
readonly writeable: true;
|
|
13
|
+
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
14
|
+
readonly type: "any";
|
|
15
|
+
readonly readable: true;
|
|
16
|
+
readonly writeable: true;
|
|
17
|
+
}>, ("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<{
|
|
18
|
+
readonly type: "any";
|
|
19
|
+
readonly readable: true;
|
|
20
|
+
readonly writeable: true;
|
|
21
|
+
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
22
|
+
readonly type: "any";
|
|
23
|
+
readonly readable: true;
|
|
24
|
+
readonly writeable: true;
|
|
25
|
+
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>)[K]] ? never : K]: (ValueMetadata extends NonNullable<TBlueprint["meta"]> ? Readonly<{
|
|
26
|
+
readonly type: "any";
|
|
27
|
+
readonly readable: true;
|
|
28
|
+
readonly writeable: true;
|
|
29
|
+
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
30
|
+
readonly type: "any";
|
|
31
|
+
readonly readable: true;
|
|
32
|
+
readonly writeable: true;
|
|
33
|
+
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>)[K]; } : never>;
|
|
34
|
+
readonly id: ValueIDBase;
|
|
22
35
|
readonly endpoint: (endpoint?: number | undefined) => {
|
|
23
36
|
readonly commandClass: (typeof CommandClasses)["Binary Sensor"];
|
|
24
37
|
readonly endpoint: number;
|
|
@@ -36,29 +49,81 @@ export declare const BinarySensorCCValues: Readonly<{
|
|
|
36
49
|
};
|
|
37
50
|
};
|
|
38
51
|
supportedSensorTypes: {
|
|
39
|
-
readonly id:
|
|
40
|
-
commandClass: (typeof CommandClasses)["Binary Sensor"];
|
|
41
|
-
property: "supportedSensorTypes";
|
|
42
|
-
};
|
|
52
|
+
readonly id: ValueIDBase;
|
|
43
53
|
readonly endpoint: (endpoint?: number | undefined) => {
|
|
44
54
|
readonly commandClass: (typeof CommandClasses)["Binary Sensor"];
|
|
45
55
|
readonly endpoint: number;
|
|
46
56
|
readonly property: "supportedSensorTypes";
|
|
47
57
|
};
|
|
48
58
|
readonly is: (valueId: import("@zwave-js/core/safe").ValueID) => boolean;
|
|
49
|
-
readonly meta: {
|
|
59
|
+
readonly meta: Readonly<(ValueMetadata extends NonNullable<TBlueprint["meta"]> ? Readonly<{
|
|
50
60
|
readonly type: "any";
|
|
51
61
|
readonly readable: true;
|
|
52
62
|
readonly writeable: true;
|
|
53
|
-
}
|
|
54
|
-
|
|
63
|
+
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
64
|
+
readonly type: "any";
|
|
65
|
+
readonly readable: true;
|
|
66
|
+
readonly writeable: true;
|
|
67
|
+
}>, ("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<{
|
|
68
|
+
readonly type: "any";
|
|
69
|
+
readonly readable: true;
|
|
70
|
+
readonly writeable: true;
|
|
71
|
+
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
72
|
+
readonly type: "any";
|
|
73
|
+
readonly readable: true;
|
|
74
|
+
readonly writeable: true;
|
|
75
|
+
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>)[K]] ? never : K]: (ValueMetadata extends NonNullable<TBlueprint["meta"]> ? Readonly<{
|
|
76
|
+
readonly type: "any";
|
|
77
|
+
readonly readable: true;
|
|
78
|
+
readonly writeable: true;
|
|
79
|
+
}> : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<Readonly<{
|
|
80
|
+
readonly type: "any";
|
|
81
|
+
readonly readable: true;
|
|
82
|
+
readonly writeable: true;
|
|
83
|
+
}>, ("type" | "readable" | "writeable") & keyof NonNullable<TBlueprint["meta"]>> & TBlueprint["meta"]>)[K]; } : never>;
|
|
84
|
+
readonly options: Readonly<(import("@zwave-js/cc").CCValueOptions extends NonNullable<TBlueprint["options"]> ? {
|
|
85
|
+
readonly internal: false;
|
|
86
|
+
readonly minVersion: 1;
|
|
87
|
+
readonly secret: false;
|
|
55
88
|
readonly stateful: true;
|
|
89
|
+
readonly supportsEndpoints: true;
|
|
90
|
+
readonly autoCreate: true;
|
|
91
|
+
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
92
|
+
readonly internal: false;
|
|
93
|
+
readonly minVersion: 1;
|
|
56
94
|
readonly secret: false;
|
|
95
|
+
readonly stateful: true;
|
|
96
|
+
readonly supportsEndpoints: true;
|
|
97
|
+
readonly autoCreate: true;
|
|
98
|
+
}, ("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"]> ? {
|
|
99
|
+
readonly internal: false;
|
|
57
100
|
readonly minVersion: 1;
|
|
101
|
+
readonly secret: false;
|
|
102
|
+
readonly stateful: true;
|
|
58
103
|
readonly supportsEndpoints: true;
|
|
59
104
|
readonly autoCreate: true;
|
|
60
|
-
|
|
61
|
-
|
|
105
|
+
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
106
|
+
readonly internal: false;
|
|
107
|
+
readonly minVersion: 1;
|
|
108
|
+
readonly secret: false;
|
|
109
|
+
readonly stateful: true;
|
|
110
|
+
readonly supportsEndpoints: true;
|
|
111
|
+
readonly autoCreate: true;
|
|
112
|
+
}, ("stateful" | "secret" | "internal" | "minVersion" | "supportsEndpoints" | "autoCreate") & keyof NonNullable<TBlueprint["options"]>> & TBlueprint["options"]>)[K]] ? never : K]: (import("@zwave-js/cc").CCValueOptions extends NonNullable<TBlueprint["options"]> ? {
|
|
113
|
+
readonly internal: false;
|
|
114
|
+
readonly minVersion: 1;
|
|
115
|
+
readonly secret: false;
|
|
116
|
+
readonly stateful: true;
|
|
117
|
+
readonly supportsEndpoints: true;
|
|
118
|
+
readonly autoCreate: true;
|
|
119
|
+
} : import("alcalzone-shared/types").Simplify<import("alcalzone-shared/types").Omit<{
|
|
120
|
+
readonly internal: false;
|
|
121
|
+
readonly minVersion: 1;
|
|
122
|
+
readonly secret: false;
|
|
123
|
+
readonly stateful: true;
|
|
124
|
+
readonly supportsEndpoints: true;
|
|
125
|
+
readonly autoCreate: true;
|
|
126
|
+
}, ("stateful" | "secret" | "internal" | "minVersion" | "supportsEndpoints" | "autoCreate") & keyof NonNullable<TBlueprint["options"]>> & TBlueprint["options"]>)[K]; } : never>;
|
|
62
127
|
};
|
|
63
128
|
}>;
|
|
64
129
|
export declare class BinarySensorCCAPI extends PhysicalCCAPI {
|
|
@@ -94,7 +159,7 @@ export declare class BinarySensorCCReport extends BinarySensorCC {
|
|
|
94
159
|
persistValues(ctx: PersistValuesContext): boolean;
|
|
95
160
|
type: BinarySensorType;
|
|
96
161
|
value: boolean;
|
|
97
|
-
serialize(ctx: CCEncodingContext): Bytes
|
|
162
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
98
163
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
99
164
|
}
|
|
100
165
|
export interface BinarySensorCCGetOptions {
|
|
@@ -104,7 +169,7 @@ export declare class BinarySensorCCGet extends BinarySensorCC {
|
|
|
104
169
|
constructor(options: WithAddress<BinarySensorCCGetOptions>);
|
|
105
170
|
static from(raw: CCRaw, ctx: CCParsingContext): BinarySensorCCGet;
|
|
106
171
|
sensorType: BinarySensorType | undefined;
|
|
107
|
-
serialize(ctx: CCEncodingContext): Bytes
|
|
172
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
108
173
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
109
174
|
}
|
|
110
175
|
export interface BinarySensorCCSupportedReportOptions {
|
|
@@ -114,7 +179,7 @@ export declare class BinarySensorCCSupportedReport extends BinarySensorCC {
|
|
|
114
179
|
constructor(options: WithAddress<BinarySensorCCSupportedReportOptions>);
|
|
115
180
|
static from(raw: CCRaw, ctx: CCParsingContext): BinarySensorCCSupportedReport;
|
|
116
181
|
supportedSensorTypes: BinarySensorType[];
|
|
117
|
-
serialize(ctx: CCEncodingContext): Bytes
|
|
182
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
118
183
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
119
184
|
}
|
|
120
185
|
export declare class BinarySensorCCSupportedGet extends BinarySensorCC {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/BinarySensorCC.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\tCommandClasses,\n\ttype EndpointId,\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 type {\n\tCCEncodingContext,\n\tCCParsingContext,\n\tGetValueDB,\n} from \"@zwave-js/host/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): Bytes {\n\t\tthis.payload = Bytes.from([this.value ? 0xff : 0x00, this.type]);\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated\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): Bytes {\n\t\tthis.payload = Bytes.from([this.sensorType ?? BinarySensorType.Any]);\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated\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): 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\t// eslint-disable-next-line @typescript-eslint/no-deprecated\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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": ";;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