This kit comes with a distance sensor.
At the millimeter level, it can detect if there are obstacles.
By using this, it can be used for detecting whether or not there is a person.
This time, let's do a simple program that raises the flag if it is nearby.
Distance sensor
The distance sensor is like the black eyes in front of your home kit.
It always measure the distance to the object in front of me.
This is a block that divides the distance into three stages and allows it to check whether there is something up close, near, or far away.
If you use a block, you can do this when it's nearby, and do it otherwise.
Program
The program is very simple.
Connect to obniz, put a connection block in iothomekit, and loop.
Check if there is something "close" in the loop using the block that checks the distance between the block and the previous one.
Set the flag to be raised if it is near, otherwise lowered.
If you run this program, the flag will rise when you bring your hand close to it, and the flag will drop when you release it.
Development
Some blocks allow you to get the distance as a number in millimeters.
This block contains the value of the distance measured by the current distance sensor as a number.
You can also use this and a block that compares numbers to program it to react at any distance you like.
Please try it.