Xiaomi Human / Body / Motion Sensor - Timeout

Maybe, but in mi home app motion get detected every 5 seconds on modified sensor and not modifed sensor still take long time before detecting movement again. So seems like contacts are fine?

I think I have solved my problems with automations not always working correctly: I have moved my Tradfri-hub to a better, more central location. Since then I have not experienced any problems :slight_smile:

I got my second motion sensor today. Both are Aqara, my old one did only send every 2min, the new one spams it nonstop. They are both Model Q11LM and even have the same CMIT ID.
Only difference it may have is a) joining the zigbee2mqtt network, I have to do multiple tries until im in. Probably a long press or some special kind of combination swiched that? b) zigbee2mqtt v1.0 - dont know if related but “{{ ‘on’ == trigger.payload_json.occupancy }}” worked on the old one. for the new one i had to replace “on” with true. Even the mqtt log shows the same just a different order.

You’ve pressed the button to trigger the 5sec mode for some hours. Could you check the interval tomorrow again?

I have been struggling with the same problem and have hacked a solution that works pretty well for me.
I was using the sensor to control lights in the cooking area of our kitchen. I had timer set to nine minutes triggered by the motion sensor, but that became a problem when you are in the area preparing food as the motion sensor never leaves the on state and never restarts the timer, so the light goes off after nine minutes when the timer ends. You then have to go away for a couple of minutes for it to turn on again. To solve this I made another automation that runs every five minutes and restarts the timer if state of motion sensor is on. Its not elegant, but it works for now.

How about switching the lights off when the movement sensor switches to off?

I tried the timer-idea and have abandoned it again for the above principle. I also noticed that the sensor does not switch off when there is frequent movement. Which is good because then the lights stay on as long as the switch stays on.

A slightly better option is to give the chance to the movement sensor to detect movement again. I use this:

trigger:
      platform: state
      entity_id: binary_sensor.motion_sensor_158xxxxxxxx
      to: 'off'
      for:
        minutes: 3

So the lights stay at least 5 minutes on (the usual 2 minutes from the sensor plus 3 more minutes after no movement).

Yes, But if you enter in the three minutes wait after switching to off state the sensor state will be on and light go off and do not switch on again before you leave the area for some minutes so the sensor can change state?

I tried that option as well but then there is still the chance that the motion sensor gets triggered before the automation turns off the light. Resulting in dark room until the dead-time of the sensor is finished and starts sensing motion again. I’ve had this happen to me several time on one evening :frowning:

From my experience, what works best is to let the sensor off-to-on switch on the light and the sensor on-to-off switch off the light.

I just wanted my lights to stay on longer in this zone. And have more options for this automation. Some places I just use the the sensor to trigger when the lights go on, and turn them off at a certain time (bedtime). And in bathroom areas I just use hue sensors and avoid this problem completely. Well worth the extra cost IMHO.

trigger:
      platform: state
      entity_id: binary_sensor.motion_sensor_158xxxxxxxx
      to: 'off'
      for:
        minutes: 3

This will for you. It only trigger after 3 minute of no motion. Any motion within the 3min will reset the timer.
I have this all over the house.
The only problem is the motion sensor can track well in bath room. taking bath halfway it goes off even I run around in the bathroom, it wont come back.
The humidity seems to blinded the sensor

I think you got it wrong. The automation only turn off the light after 3 minutes after the motion sensor reports no movement (which means 3 minutes after the 2 minutes dead-time AND there’s no further movement). As long as there’s movement in those 3 minutes the automation is reseted and the light continues on. So, if you leave the area before the 2 minutes dead-time and return after the 2 minutes but still before 3 minutes “off” state, the sensor will detect movement again and the automation is reseted.

@tyjtyj, I have run into something similar in the Bathroom when in the shower. One I think after time the humidity effects the senors electronics, because I had a sensor that seemed to stop working, but if I moved it closer to the gateway it would start working again. This happend with 2 sensors. So, I replaced it with a new sensor and covered the sensor in plastic, and that problem has not occurred again. Second thing, when in the shower the sensor could not see me so the lights would go out, so I got a window/door sensor and attached it to the door, and when the door is closed I make it so the light can’t be turned off, works well.

I had the same problem, my solution was a Xiaomi temp/humidity sensor above the shower, when it detects a rise in humidity, the timeout for the lights is set to be longer.

1 Like

You can actually change this behaviour in the device configuration through zigbee2mqtt:

https://koenkk.github.io/zigbee2mqtt/configuration/device_specific_configuration.html

Hi all,

Did anyone tried to see is the timout can be changed using zigbee2mqtt?

Thank you in advance

No it can’t as it is by sensor design. Read the many threads on this topic.

I have two of these sensors deployed in hallways. They turn on lights when I stumble to the bathroom or kitchen in the middle of the night. The 2 minute timeout is fine with me.

Sorry. I didn’t find what you mentioned when I searched in the topic.

Yes, it can.

You modify the configuration.yaml file under /share/zigbee2mqtt/ and add the following under the occupancy/motion device:

occupancy_timeout: 10

See here:

https://koenkk.github.io/zigbee2mqtt/configuration/device_specific_configuration.html

Don’t forget to restart the addon after making the change.

1 Like