“Wasp mode” is a generic term for lights management in a room with one or more doors and one or more motion / occupancy sensors.
The idea behind a wasp mode sensor goes like this:
- When a door is open or a sensor detects presence / motion / occupancy, the lights are turned on for a brief period of time.
- When all doors are subsequently closed, if presence / motion / occupancy remains or reactivates, wasp mode is turned on, and all lights remain on until the next time a door is open.
- Once everyone exits the room (irrespective of door state), all lights are turned off after a while.
I’ve devised a Node-RED wasp mode subflow which you can use to create a Home Assistant sensor entity. This sensor entity can then be used to drive your automations and turn lights on / off. Its inputs are Node-RED HA entities of the opening, motion or occupancy sensors class (detected by name in msg.topic
). Its primary output is a msg
whose payload says on due to...
or off due to...
, with occupancies and openings as attributes of the msg
object; two more outputs emit messages when the light is meant to go from off to on, or from on to off. The timeout can be adjusted with the subflow property “delay” — you will want to bump this to more than 3 minutes for lazy sensors like the IKEA TRADFRI ones, but ideally it is always longer than the time it takes for the sensor to flip from “occupancy detected” to “occupancy clear” (or motion equivalent).
The flow is here:
Here’s how it looks like:
You can then hook this to a Node-RED HA sensor entity, such that this entity appears in Home Assistant. You can also directly drive automations from Node-RED if you so choose. The post linked above has examples.