Aqara Motion Sensor - Ikea Trådfri

Hi all!

I bought my Homey early 2019 a few weeks ago and up to now I really enjoy using only 1 app instead of 7 to control my home :slight_smile:

In the kitchen I have an Aqara Motion Sensor which I use in combination with some Ikea Trådfri lamps. The idea is to switch all the lights on in the kitchen when there is motion detected. The flow is: when motion sensor sees something and it’s after sunset; turn on the lamps. No problems so far.

However, this motion sensor checks (based on what your preference is) between 60 till 86400 seconds for motion. I use 60 seconds. I now have a flow that the lights turn off in case there is no motion detected. This works, but the lights in my kitchen will go off, and directly on when i’m still in the kitchen after 60 seconds.

Any tips/tricks to prevent this off and on switching?


Are you moving in the sensor’s field of view during those 60 seconds?

Yes, I do. Looks like the motion sensor switches automatically to no motion detected after the 60 sec. Then immediately back to motion detected. The lights also react like this -> off after 60 sec and immediately on again.

Your flow is much to simple, you have to use a countdown or logic cards. Maybee this post can help you: Kitchen light goes of

1 Like

Try setting a higher value (65 or 70 seconds). Perhaps (not sure, can’t test myself) the value you can set is the timeout period, not the grace period.

If that’s the case, setting the timeout to exactly the same value of the grace period (which might be fixed to 60 seconds), what happens is:

  • the sensor triggers at time 0, sends a “motion detected” message, and goes to sleep for 60 seconds
  • after 60 seconds, the timeout has expired (the 60 seconds that you configured) so it sends a “no motion detected anymore” message
  • however, when it sees motion at that time it will immediately send a “motion detected” message again

So it first sends “no motion detected anymore” followed by “motion detected”.

If you increase the timeout, this will happen:

  • the sensor triggers at time 0, sends a “motion detected” message, and goes to sleep for 60 seconds
  • the sensor wakes up, notices that the timeout hasn’t been reached yet (that will happen at 65 seconds, so it still has to wait 5 seconds), so doesn’t send a “no motion detected anymore” message
  • if the sensor sees motion in the period of 5 seconds, it will reset the timeout back to 65 seconds, send another “motion detected” message, and goes to sleep for 60 seconds; otherwise, it will send a “no motion detected” message after 5 seconds since it woke up again
1 Like


First load the App named Chronograph. Than you have to make 2 Flows…

1st Flow (Light goes on) :
-motion sensor detect motion

  • it is after sunset
    -Turn light on
    -Start or replace Timer (Chronograph) - give the timer a name and a run time.

2nd Flow: (turn the light of)

  • Timer (type your name you gave it in Flow one) has finished
    -Turn the Light of

The Timer starts every time new, if the motion sensor detect motion. So the light will go out first if the sensor detects no more motion in the room.


This was the issue! I changed it to 65 and now it works like a charm. Thanks for this Robert!

And also thanks for the other tips, I’m learning a lot :slight_smile:



I wonder how you added the motion sensor to Homey. Via the internal Zigbee network?

The reason why I am asking this is that I have configured my Aqara motion sensor via deCONZ on a Raspberry Pi. I do not get it managed that the lights will remain on as long as I have motion in front of the sensor.

In the deCONZ Homey app you can set a “No motion timeout” but I wonder if this overrules the deCONZ setting. I don’t think so. When you make timeout changes in the deCONZ settings these will be undone when restarting the RPi.

(Aqara Window/Door sensors are working perfect via deCONZ. They report instantly.)

Maybe that other people are facing the same problem and can point me into the right direction to solve this.



The motion sensor can be added to Homey via the Aqara & Xiaomi ZigBee app, which can be found in the Homey appstore. With the system you use I have no experience.

In the meantime I also found out that you can hack the motion sensors. This makes it possible to report motion every 5 seconds. The hack was pretty easy and can be done with a regular pencil. On YouTube you can find instruction videos. Perhaps this works for you?

Thanks Wolter! I will have look into this.

I only see videos to do it with solder. Not with the pencil is it just drawing in the two points(color it) or make a line between them or something? Do you need to repair/reboot the device? Are the settings you need to change in the app?

I think that’s the default for deCONZ, it doesn’t store these settings anywhere so they get reverted back to their default when you reboot/restart. For Aqara sensors, the default timeout (duration) is 90 seconds.

I use Home Assistant myself, and I have a script that runs during started to set the timeout to 5 seconds for all of my sensors.

It’s just a connection made wich a pencil line. This video is with soldering, but the same works with pencil. It’s a Chinese instruction, but the video is very clear:

Let’s hope there aren’t any Koreans following this community then :stuck_out_tongue_winking_eye:

1 Like

Haha oeps :stuck_out_tongue:

Thnx for the reply I am going to look in to it. I am also pretty curious how you set you’re flows for on and of after this.(countdown app?) Or just the timer in the settings I see in the sensor you need to enable the hack in homey.

Maybe you can show me a sample of you’re sensor settings and flows I would really appreciate it!

I made the flows like below. It’s in Dutch but I think the principle is for everybody understandable. I added a countdown timer which ensures that the lamp will stay on for at least 40 seconds. When there is still motion detected after 40 seconds the lamp will reset the timer and the lamp remains on for another 40 seconds. If no motion detected; it will switch off. I use a hacked sensor for this because it’s in this case needed to reset the motion alarm earlier than the default 60 seconds.

When you would like to use a hacked sensor you can change this in the settings of the motion sensor itself: