Two different timers in one room


I’m new to Home Assistant and really need some hints, in how to achieve my goal.

  • Is it possible with AppDeamon?
  • Can I solve it with something else?
  • Is there a tutorial which covers my problem (see below) with states and variables,…?

This is my setup:

In my kitchen I have ZigBee lights, and if I enter the kitchen the first motion sensor in the door (IKEA)
starts a timer for 1 minute, this is usually enough to do something and then leave the kitchen again.

Then, I have a second motion sensor (IKEA), which points to the sitting area in the kitchen.
If this sensor is triggered a 10 minutes timer starts, because, if I decide to sit there I usually
don’t move enough for “a minute timer”.
Both timers control the same lights and the ten minute timer “overrides” the one minute timer.

Up to now, I use two IKEA motion sensors for this:

Both sensors a coupled, simply by pairing one to another (IKEA handles this even without the TRADFRI gateway). Thus the 10 minute timer overrides the 1 minute timer and the one minute timer controls the lights.
This already works, but I like to implement this “hidden” behavior in Home Assistant.

I think, I need something like a node which gets events from both motion sensors.
Each of them, pass the time and the source (motin1,motion2) into the node.
In the node there is some state handling, which implements the IKEA logic.
In the Home Assistant documentation I cannot find any solution for my problem.

I’m a bit lost, and ask myself how to implement this behavior?

Is it possible with AppDeamon?

Yes, but I found out, that this is too slow. The roundtrip Sensor->Raspi->Lights takes from a second, which is fast enough, to usually three seconds, and sometimes even to more. Maybe it has to do with some “wakeup” time for the rapsi 4 itsself. I haven’t figured it out, it did varied and I there was not a tutorial on how to measure the roundtrip time and identify the slow parts.
So, from my experience, using AppDaemon is overall much slower than a directly paired lights, at least for a “instant on” effect I cannot recommend it.
Direct pairing can be done with zigbee2mqtt too.

Can I solve it with something else?

For a “fast on” experience, I use
Binding on zigbee layer This describes how to add lights to groups and bind them on the zigbee layer. With the GUI in zigbee2mqtt this is easy to setup.

Unfortunately this showed some unexpected behaviour for the older Tradfri motion sensors:

  • They can only send to groups
  • The older motions sensors assign themself a random group after reset

random groups with IKEA motion sensor this solution is noticeable faster and , other than my experience with Appdeamonand the different roundtrip times, always the same speed.

Two sensors with different timing

I don’t know if this can be handled by AppDaemon, but having two motion sensors, one with 1 Minute the other with 5. My test show, that the 5 minute timer somehow overwrites the 1 minute timer, although they are invoked one minute first, five minute second. Or in short: Its works, and I dont know why.