Xiaomi Motion Sensor Aqara - How to Test?

Good evening,

I have a Xiaomi Aqara Human Motion Sensor and had it working after many painful nights. I had to use the catch-all method on my Hub v3. I bought it for my girlfriend so after I tested it I took it to her house. It actually shows up in her app but it doesn’t work when creating automations. I have removed and replaced it several times.

Is there a way to check and see if it has dropped off? The lux never changes after connecting no matter what I do. The battery showed 97% but I replaced it to be sure. It seems once it’s detected on her v2 hub it just does off? I never even see anything in the Live Logs when I move in front of it and the device lux/battery never updates (sometimes the battery goes to 0% until I remove and reconnect it).

Any help is appreciated as this worked before :frowning:

What Zigbee repeaters are you using at her house?

I just bought an IKEA Smart Plug today( I found out it is a repeater. That is the only one) and paired it next to it in her bedroom where she needed it and it seems to be working. I am wondering if the lack of statuses is normal or random for it’s communication schedule. I am wanting to browse the handler now to see if I can increase the refresh rate of the sensor even if sacrificing battery life. It’s strange that when I ask for help it starts working :frowning:

Is it possible to reset hardware to less than 60s?

Also, if the hardware is in the 60s range, and 3s before reset I walk around in the dark, does it reset to 60s ? This would make an infinite loop if motion in the room never truly ceases.

How many Smartthings hubs do you have? One at your place and one at her’s?

After you paired the motion sensor successfully at your home, you took the sensor to her and paired it after a reset of the sensor?

Or did you bring the sensor to her home and expect it to work immediately?

Grtn Ben

1 Like

I re-paired it at her place. I think I finally got it to work last night. It just seems like it is very finicky. The humidity/temp sensor paired up right away and worked immediately.

I do have a question regarding the device handler though. There are two 120s resets. The first one:

// The sensor only sends a motion detected message so the reset to no motion is performed in code

…seems to indicate that it forces a no-motion state after a set time since there is no true -stop-motion signal. What is the difference between this and the second reset interval of 120s that states it checks while in “motion active” state?

Once it has detected motion the sensor stops looking for sixty seconds so it wouldn’t know about the second movement.

1 Like

The first is a timer being set when motion has been detected. The second is the command the timer runs.

As you state, the sensor only reports when motion has been detected. That isn’t unusual for motion detectors. It is down to the DTH to turn it into a binary state. Personally I always use 60 seconds to coincide with the sensor becoming active again and leave any further delays for apps.

1 Like

Thank you both this helps me understand how these sensors work. As I am not there to test things often (I wish I had ordered more to keep at my house now), I am curious about another way it may or may not function.

I have it set so 5 minutes after the sensor turns on the light it turns it off if no motion is detected. If motion is detected after 60s, I would wager the motion resets and would continue to keep the light on as needed, right?

Also, this is linked to a Google home. If someone turns the lights on by voice command, but the sensor is in the doorway away from the active area of the room, but a motion event is detected, I would assume it would attempt to turn them on. Since they are already on, no big deal, but then it would enact the 5 minute countdown to turn off, correct?

This would be an obstacle I would need to get past in order to make sure that the lights don’t turn off time to time when they were manually turned on. I suppose it would be better for the sensor to be in the active area of the room but then I still need to test it with a ceiling fan running and movement in the dark such as watching TV or tossing and turning during sleep. Are motion sensors a bad idea for a bedroom or is there an automation setup I am missing?

Yes, that is correct. Each time motion is reported by the sensor a new reset period is started by the device handler.

Yes indeed.

Yes, you need to get inventive. Solutions can involve location modes, virtual switches and simulated motion sensors and will vary according to your particular setup and how perfect a solution you want to accept.

A simple example would be to have Google Home turn on/off a virtual switch when you ask it to turn the lights on/off and have SmartThings turn the actual lights on/off in response. Then only let the motion sensor automations run if that virtual switch is off.

Personally I quite like simulated motion sensors as you can add them alongside the real motion sensors in Smart Lighting automations. Smart Lighting sees motion active when any of the sensors becomes active, but only sees inactive when they are all inactive (you may see people saying things to the contrary but that is how it works for me). It is arguably more of a faff to handle but it just appeals to me as the motion control logic stays the same, and simple, and the all the fudging is about faking motion and takes place elsewhere.

Well I guess having a motion sensor pointing at your bed that turns the lights full on in the middle of the night is a bad idea, but if you choose to disable the motion sensors when you are intending to sleep the same arrangement isn’t such a problem. If you have motion detectors arranged so they don’t detect movement in bed but do detect you getting up in the night and you have them triggering courtesy lights so you can see where you are going, then that might be considered to be a very good idea indeed.

1 Like

Hi. I own over 40 Xiaomi / Aqara devices, including a number of Aqara Motion Sensors, have worked extensively on and currently maintain the collection of device handlers of theGitHub/bspranger/Xiaomi repository, and have spent countless hours researching on and testing my Xiaomi / Aqara devices. So let me see if I can help clear up a few things.

Yes. Aqara motion sensors send a “check-in” to the hub every 50-60 minutes. That message contains the battery voltage data used by the driver to produce the battery level event.

If you aren’t seeing any battery report events / log entries in the third hour after pairing or at any time afterwards, then the Xiaomi / Aqara device has dropped off the network. Xiaomi / Aqara devices are supposed to supply an initial message with battery voltage during pairing, but for unknown reasons that message isn’t received or passed on to the device handler. After pairing, in my experience and from reading user reports, the first or second check-in messages can sometimes be missed somehow, before they start on a consistent and regular basis. So it’s best to wait 3 hours.

First off, it’s important to understand that Lux reports from an Aqara Motion Sensor only occur when motion is detected. But if the sensor is still connected you are placing light in front of it and not seeing the lux value change when motion is detected, then there’s either a problem with ZigBee connection or much more likely a hardware issue.

The best way to know if it’s still connected is to look for Live Log entries.

So this tells me that the device isn’t connected / has dropped its connection.

The IKEA Tradfri Outlet is known to work great as a repeater with Xiaomi / Aqara devices. I have one myself and have done plenty of testing with it. However, I would double-check whether there are actually any other ZigBee repeater-based devices at your girlfriend’s with all of the trouble you’re describing. Pretty much any ZigBee device that plugs into the wall and isn’t battery-powered will be a repeater, with the exception of some kinds of ZigBee bulbs (such as Sengled bulbs).

There is absolutely no way to increase the “refresh rate” (reporting interval) of Xiaomi / Aqara devices. They are programmed in hardware to do what they do and do not respond to any ZigBee commands normally used to change the reporting interval. This is probably because they were designed to work only with an Xiaomi / Aqara gateway hub, and not any other hub. In fact pretty much all issues with Aqara / Xiaomi devices being used with a SmartThings Hub stem from the fact that they aren’t meant to be used that way.

Still, plenty of people have managed to get and keep them working, like myself.

When an Aqara Motion Sensor is first paired, it is in a “test” mode which resets motion detection about every 4-5 seconds. This “test” mode lasts 2-3 hours, and after that the sensor resets motion detection after 60 seconds. There is no way to change this behavior without modifying the hardware. One person figured out a hardware “hack” which involves bridging two contact points on the sensors PCB.

No. The sensor’s hardware never sends any message to indicate motion is no longer detected. So this has to be accomplished in software - using the settings of the device handler. If you are using the bspranger device handler, the code starts its own timer to send a motion inactive event after a specific amount of time.

The default is supposed to be 60 seconds (to match the behavior of the hardware) but the last contribution to the device handler was to change the default timer to 120 seconds (though this wasn’t reflected in the text for the preference setting):

In my experience changing the Motion Reset setting to 65 seconds is about the best minimum that can be used. Here’s what happens with a setting of 65 if there is motion for 2 minutes:

  1. The sensor detects motion
  2. The device handler creates a motion detected event and starts a motion reset timer of 65 seconds
  3. 60 seconds later, the sensor’s hardware resets and detects motion again
  4. The device handler resets its motion reset timer to 65 seconds
  5. 60 seconds later, the sensor’s hardware resets but no motion is detected
  6. 5 more seconds later, the device handler motion reset timer finishes and creates a motion inactive event

Since you’ve settled on changing the setting to 300 seconds (5 minutes) just imagine the motion sensor possibly detecting motion during the device handler’s countdown and the device handler’s countdown is reset to 300 seconds again. Note that a repeat motion detected event will never happen because by default only events where the state changes (i.e., from detected to inactive) will be created.

2 Likes

Thank you, this has all been amazing information! This all makes much better sense now and will now researching more complex options. I like the concept of a virtual switch/sensor. As far as what I have been trying to do, I am considering ordering door sensors to simplify things so I don’t have to make things too complicated over there, as the motion seems like overkill for this particular task and the vibration sensors I already had don’t seem to pick up door acceleration consistently. This has definitely been a rabbit hole with a much deeper bottom than I expected. Time to order myself a full round of sensor and build a playground :slight_smile:

1 Like

Thank you for these details, I changed the DH code to 300s because at first glance I thought that was how I changed the timeout for the lights. I realized shortly after that the app has a spot for that and will change it to 65s as I like your reasoning on that. I still haven’t had much time to play with all of the sensor settings in the app but hope to start more this weekend now that this semester is over.

I am glad to know the Tradfri plugs are reliable repeaters as I had read several forum posts stating that the Xiaomi sensors could have issues with Zigbee repeaters in some cases. For $9.99 those plugs are a bargain. I was disappointed to see IKEA putting many of their ‘smart’ items on clearance this past weekend and hope it means they are either just clearing slow sellers or making room for newer products.

My next project will be tackling sms or other notifications. Again, I really appreciate the help!

2 Likes

I have a Fibaro Dimmer 2 module (Z-Wave) that has a night mode.

During the night, you can program the time span, the light is dim when switched on. I have choosen 1%.

You could make a rule that during the night, after trigger by the motion sensor, the light is on dim.

1 Like

Here a part of my sensor log at the Recently tab:

What is the “night mode” option? I was thinking about setting the lights to be dim and need to swap out some smart plugs for smart bulbs to make that happen.

The nightmode is an option in the Fibaro Dimmer 2 module.

Fibaro Dimmer 2 module

I have one module installed in the switch box, hard to install when there are many wires.

The other module I installed in another lamp fixture.

Here a screenshot from the Nightmode settings:

The module measures power consumption, soft start of the light, brightness control incl the Nightmode.

PS It is a Z-Wave device, but works fine with the SmartThings hub and Aqare button and sensor. I also have a Hue Dimmer Switch that controls the Fibaro Dimmer 2 module.

Check for the right Z-Wave frequency for USA or EU!

1 Like

After a week of leaving this motion sensor up, the one issue I have had was this:

Light is set to turn back off after 5 minutes in the app (after activation).

If someone is working in the room, the sensor can’t see them because they are not in the entrance pocket where the sensor is. If they enter the room and start working on schoolwork, work, etc, the light turns off after 5 mins.

The Google Home is used to turn the light on, then :

        A.  If the sensor detects movement it registers the event, the light is already on, and 
               then the light turns off when it is still needed on.
        B. Google was used to turn on the light within the 5 minute window of entering the 
              room so it still turns off after 5 minutes.

Obviously A is a placement issue. I think a door sensor would work better for this person’s needs anyway…but scenario B is the one I am wondering about. Are there any settings or whatnot that can make a status originating from a GH hold effect?

I have 3 of these sensors.
I can get them paired no problem at all.
This is a wealth of information in the post thanks, but after the 3 hours, sometimes sooner, I can’t get a damn thing out of any of the 3. There’s a Samsung ST plug socket active 6 feet from two of them where I set them up with the handler stated above (bspranger).
They’re about twenty feet from hub and router.

They’ve simply fallen off as far as any motion, I’ve never had a battery %, yet had lux on all.

I got them from AliExpress as a 2 pack, complained and the seller sent me a third free, insisting they were EU (I’m in uk) and work with ST. . and still no joy. Having managed to get even a d1 mini working as a cheap light sensor to stop motion lights working on bright evenings, I thought I’d figure this out but I’m stumped.

I’ve added them through app, is this where I’m going wrong? Is there some kind of self publish to get these to work?

Any advice really appreciated.
Many thanks.