Wakeup on sensor changes

"An external factor, such as a button being pressed or a person coming to the house, can trigger the release of Sleep. You can.

On the obnizBoard 1Y, io0 is a special pin that can be used to break the sleep state by changing the voltage on this pin.


obniz.onconnect = async function(){
  var tempsens = obniz.wired("LM61", { gnd:0 , output:1, vcc:2});
  var temp = await tempsens.getWait();
  console.log(temp);  //output tempeature

  obniz.sleepIoTrigger(true);  // wake up when rising edge on io0
}

sleepIoTrigger wakes up from sleep when io0 changes from 0V to 5V. When the button is not pressed, the voltage is 0V when the button is pressed, and when the button is pressed, the voltage is 5V. When the button is pressed, the sleep state is released and the device starts up. 

By devising a sensor, you can also create a program that will send a notification to slack when a door is opened to release sleep.

https://blog.obniz.com/en/make/obniz-board-1y-open-close-detection/