Xiaomi Human / Body / Motion Sensor - Timeout

No, but it does tighten up the delay.

I’m using a 5sec timeout and it’s very apparent.

This is what is written:

Timeout (in seconds) after the occupancy: false message is sent

The total timeout isn’t 5 seconds. It’s the response time of the gateway to the no motion message from the sensor. Please provide full information, otherwise people get wrong expectations.

Ahh my mistake, I wasn’t aware this was how it was altering the behaviour. Thanks for the info!

I am using occupancy_timeout setting. I believe the wording in the documentation is probably not exactly correct. This setting specifies a timeout after which the

occupancy: false

mqtt message is sent. So the timer starts at the moment a sensor signals presence and then after the specified time the mqtt message is sent. If on the other hand zigbee2mqtt gets a new occupancy message from the sensor during the timeout then the timer is restarted.

Xiaomi sensors have 60 seconds hardware timeout and I set zigbee2mqtt occupancy_timeout to 61 seconds. This prevents getting occupancy: false and another occupancy: true immediately afterwards.

1 Like

I’ve (hardware) modified one of my motion sensors. The 5 seconds timeout is awesome. The HA assistant component needs some improvements because the sensor reports “motion” via MCAST very often now. “no_motion” isn’t reported (whenever). I’ve implemented/hardcoded a timeout of 5 seconds now.

1 Like

Please share how you’ve accomplished this! :slight_smile:

Are there JTAG headers you connect to on the device or something?

edit: just found this actually:

http://livebywant.tistory.com/13?category=703455 (translation required).

Correct. I tried this mod suggested by @tyjtyj here: Xiaomi Human / Body / Motion Sensor - Timeout

This code change is needed to use the modded motion sensor:

For example by downloading this file and copy it to config/custom_components/binary_sensnor/xiaomi_aqara.py. Restart HA and give it a try! :slight_smile:


What impact could this modified code have if I have mixed sensors (modified and unmodified)?

Has any one tested the mod with deconz?

How can I easily open the motion sensor?

The sensor can be opened easily. The bottom is a screw cap. Remove the battery and pull gently the grey holder. It’s clipped.

tried it with a pencil and didn’t seem to work, use ikea small pencil

I’ve tried this. It works great with the sensor that has the hardware change, but in breaks the logic for the sensor without hardware change.
The original sensor detects motion and goes back to no motion after 10 sec, even if there is still motion. And then detects motion again after ~1 minute from no motion

Correct. My patch changes the behavior for all sensors. At the moment you should modify all sensors or none.

I’ve made the hardware fix mentioned here and now sensor updates in 5 seconds. I’ve also updated the code to syssi’s version and that also works. It is also posible to use this new code with unmodded sensors. Just make the no motion time out time to be greater than 60-80 seconds. I am using 80 seconds with my automations and they work great.

The problem is after a period of no motion for about 1 hour (didn’t check this exactly), at the first motion detection the sensor connects to the lumi gateway and the sensor lights up blue. It is very annoying but also managed to fix it by changing the notification volume on the hub to zero.

It’s the same here. I didn’t notice at first.

That was sooo helpful! Thanks a lot!

Modified one of my sensors, and used ur component, it works brilliant! Thank you!
I did notice that chinese speaking lady now and then with this modification, but simply turning volume down on the gateway resolves that problem, sound work’s OK for other stuff i have automations in place.
Finally a xiaomi sensor without 2 minutes ON time! I will probably modify other sensors as well.

What kind of ZB network topologies are you guys testing this on?
I have 9 motion sensors and a further 33 devices. Did you notice a decrease in network efficiency/responsiveness when you increased the motion sensor’s reporting by 2400%?