Skip to main content
Version: v3

DISTANCE

Creating Sensors

const distance = hmSensor.createSensor(hmSensor.id.DISTANCE)

console.log(distance.current)

DISTANCE instance

distance: object

PropertiesDescriptionType
currentcurrent mileagenumber

Registering sensor instance callback events

calorie.addEventListener(event, callback: Callback)

The events of CHANGE

The value of events

hmSensor.event.CHANGE

Callback

() => void

The example of events

distance.addEventListener(hmSensor.event.CHANGE, function () {
console.log('The current distance is ' + distance.current + '\r\n')
})