Hey there,
I created a blueprint for the “wasp in the box” principle. This project is inspired by the App Daemon script wernerhp/ha.appdaemon.wasp.
Why?
I wanted to solve the problem: “The lights in my bathroom should stay on as long as I am in the room. No matter if I move or not.”
For that, the “wasp in the box” principle can be applied. It’s works as the following:
Imagine a wasp that is flying. As long as it flies, there is movement. Now put this wasp inside a box. As long as the box is closed, you know that the wasp cannot escape. It is only required to register movement of the wasp inside the box once. When you open the box, the wasp can escape.
This principle can be applied for e.g. a bathroom. As long as the door is closed and movement was detected once, the light can stay on. The only way for you to leave the room, is to open the door (or escape through the window, if you’re adventurous )
I use this blueprint as my daily driver in my bathroom. And it works pretty great. Also, special cases like directly closing the bathroom door behind you after leaving does not result in a false occupancy detection.
Requirements
The blueprint requires some helpers to work:
- Occupancy Helper (input_boolean) – This helper saves the occupancy state and can be used as a trigger of e.g. your light automation.
- Last Motion Helper (datetime) – This helper saves when the last movement was detected by the motion sensor or motion sensor group. This is necessary to prevent a false occupancy when you directly close the door behind you.
How to set up
- If you have multiple motion sensors, please create a group for them. The same also applies if you have multiple door sensors.
- Create two helpers (input_boolean, datetime) in the helpers section
- Import the blueprint
- Select the helpers and groups/sensors.
- Set a name
- Profit.
You can find the code here: https://community.home-assistant.io/t/occupancy-blueprint/477772 · GitHub