Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can you turn off/deactivate Body Presence Sensor?

ANSWERED

It appears that the body presence detector is using up quite a bit of battery life. Is it possible to deactivate it when not required and then only turn it on when required to determine if the person is wearing it?

 

The API doesnt appear to have a deactivate command.

 

Thanks,

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

It really shouldn't be. The onreading event should only be called when the state changes, but I guess it's always running in the background, so that may have an impact.

 

Anyway, all sensors should support the stop() method, you could try using that when the display is off, then start() when the display is on.

 

import { display } from "display";

display.addEventListener("change", function() {
  if (display.on) {
    // start
  } else {
    // stop
  }
})

View best answer in original post

Best Answer
1 REPLY 1

It really shouldn't be. The onreading event should only be called when the state changes, but I guess it's always running in the background, so that may have an impact.

 

Anyway, all sensors should support the stop() method, you could try using that when the display is off, then start() when the display is on.

 

import { display } from "display";

display.addEventListener("change", function() {
  if (display.on) {
    // start
  } else {
    // stop
  }
})
Best Answer