Skip to main content
Version: v3

CALORIE

Creating Sensors

const calorie = hmSensor.createSensor(hmSensor.id.CALORIE)

console.log(calorie.current)
console.log(calorie.target)

CALORIE instance

calorie: object

PropertiesDescriptionType
currentCurrent calorie consumption in kcalnumber
targetTarget calorie consumption in kcalnumber

Registering sensor instance callback events

calorie.addEventListener(event, callback: Callback)

The events of CHANGE

The value of event

hmSensor.event.CHANGE

Callback

() => void

The example of events

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