Xiaomi Human / Body / Motion Sensor - Timeout

Thats true. But in these 2 minutes you see no motion in HA. But you see it in the protocoll in the mihome.app.
Its nearly impossible so relize a usefull motion detection like this.

For example.
I go into my kitchen -> motion detection -> lights on.
I grap a glass of water and leave and switch manually off the light.
The next motion only triggers in 2 minutes, so in this time my wife can only go in with no light or have to switch manually in.
That suxx

Just don’t turn off the light within the 2 minutes. It turns off by automation. If your wife enters the kitchen the light remains on. Do you try to safe the power of two minutes?

I have been told off by my partner for exactly the same problem :smile:! The delay in detecting no motion is less of a problem, the problem is the delay is re-detecting motion.

Thats it.
Sure I can wait this 2 minutes, because I know how its working. But my kids and my wife dont want to think about this. It just must work with no issues!

I‘m using a zwave motion detection device. This have a blind time of 8 seconds and works perfect. But its far more expensive.

Hmm… I understand the significance now. Lets hope the gateway firmware gets an update some day. For now it’s a firmware issue and cannot be improved.

1 Like

I agree that it would be nice to have faster updates. In the meantime, you could simply add a delay of about 1 minute or so before the lights switch off. In general, I don’t turn off my light immediately after an event (precisely to avoid such situations).

Hi, is it possible to listen for events from the motion sensor (like the Xiaomi button does) or do you just have to look for the state change in your automations?

I think someone in smartthings forums was able to change the timeout value. Is this also possible for homeassistant?
Here is the github page:

And the relevant forum:

@sendorm Did you read the description of the “motion reset feature”:

input "motionReset", "number", title: "Number of seconds after the last reported activity to report that motion is inactive (in seconds). \n\n(The device will always remain blind to motion for 60seconds following first detected motion. This value just clears the 'active' status after the number of seconds you set here but the device will still remain blind for 60seconds in normal operation.)", description: "", value:120, displayDuringSetup: false

This doesn’t improve the situation.

This is what got me rolling actually. It states that the information provided in the description is wrong.

@a4refillpad @ArstenA
Wayne, Brian,
I have found out that at least the Aqara Motion Sensors (not tried the original Xiaomi yet) do NOT stay blind to motion for 60 seconds. Well unless this is intentional coding of course. The Sensors do actually report motion far more frequently, to the value you set.
if you set the motionreset time in the Config page via the ST app, click ‘Done’ and then press the pairing button on the Motion Sensor a couple of times, waiting a few seconds between then this value will sync up to the sensor and hey presto you have far more control over the sensor.
It may be worth amending the text in the DH to this effect as it does state that the sensor will remain blind for 60 seconds which is not the case of course.
Thanks!

I thought this might be worth investigating.

1 Like

I’ve read the whole topic but still got no idea; is it possible to change the frequency from 120 to 60 or lower or not? If so, how?

The period for consecutive motion triggers is 60 seconds. But as I’ve learned from other forums, if you press the button on the sensor, it goes into test mode. In the test mode the time out for consecutive motion triggers is 5 seconds. But this mode only goes on for 2 hours.
So in essence, no you can not lower the 60 seconds period.
From gearbest site:

Thank you for the clarification @sendorm, appreciated! So why is the interval 120 in Home Assistant and not 60?

It’s up to 120 seconds due to a combination of firmware limitations and HA polling time.

Has anyone noticed the same? I have noticed this already several times!
I have changed my automation-scripts to include a timer (on motion-detect start a timer and turn on the light, on motion-detect when the light is still on, restart the timer, and, when the timer has finished, turn off the light) but the problem is still there.

I am assuming that this is a “bug” in HA?
In my mind I think this happens: the automation-function receives a new trigger (motion-detect) but cannot process it because another triggered process (timer finished) is ongoing?
And there is not a waiting-queue that keeps the new trigger until it can be processed?

Actualy this is related to xiaomi motion sensor… It keeps ‘on’ state for 2 minutes.
What I did is to keep my light on when sensor is ‘on’ and turn light off when sensor is ‘off’, something like this:

- id: '1101'
  alias: hodnik rasvjeta on
  trigger:
  - platform: state
    entity_id: binary_sensor.motion_sensor_1
    to: 'on'
  condition:
    condition: time
    after: 06:30:00
    before: '21:30:00'
  action:
    service: light.turn_on
    entity_id: light.hodnik
    
- id: '1102'
  alias: hodnik rasvjeta off
  trigger:
  - platform: state
    entity_id: binary_sensor.motion_sensor_1
    to: 'off'
  condition:
    condition: state
    entity_id: binary_sensor.motion_sensor_1
    state: 'off'
  action:
    service: light.turn_off
    entity_id: light.hodnik

The problem with these sensor’s is the 120 seconds reset time, its hard coded, nothing you can do about it.

So if you have a timer that is anything less than that to turn off lights, it always going to run into problems.

My hallway lights dim to 50% after 30 seconds of no motion, then after 60 seconds, they turn off, but I wouldn’t be able to use the Xiaomi sensor to do this, as it would take 120 seconds before I could set them to dim, which is too long for the hallway lights, so I use a Hue sensor in there, as it has a 10 second reset time.

I just rigged up a £1.50/$2 PIR sensor to a Sonoff S20 plug, and that works over MQTT, so can set a time out of 1 second if needed.

1 Like

I have a Xiaomi motion sensor in my ensuite and it seems to be working fine with the below automation set at only 1 minute. Note that the alias says 2 minutes because the sensor stays on for 1 minute, plus the automation waits a further minute. I have all my lights set for a 2 minute total off-delay.

alias: Ensuite light OFF after 2mins
initial_state: 'on'
trigger:
  - platform: state
    entity_id: binary_sensor.motion_sensor_158d0001ad43db
    to: 'off'
    for:
      minutes: 1
action:
  - service: homeassistant.turn_off
    entity_id: light.ensuite_light

this is my ‘on’ automation… but in writing this I’m starting to wonder if maybe I’m just not in the room long enough to see the issue being discussed… since the one trigger is only going to work once the sensor has turned off first…

alias: Ensuite light auto ON motion
initial_state: 'on'
trigger:
  - platform: state
    entity_id: binary_sensor.motion_sensor_158d0001ad43db
    to: 'on'
condition:
  condition: or
  conditions:
  - condition: sun
    after: sunset
    after_offset: '-00:10:00'
  - condition: sun
    before: sunrise
    before_offset: '-00:30:00'
action:
  service: light.turn_on
  data_template:
    entity_id: light.ensuite_light
    brightness: >
      {%- if now().strftime('%H')| int >= 21 %}
        13
      {%- elif now().strftime('%H')| int < 5 %}
        13
      {%- elif now().strftime('%H')| int >= 5 %}
        255
      {%- endif %}

actually no, I dont have an issue since my total light on-time is greater than the Xiaomi sensor timeout. No wonder it works ok. I’ll shut up now!

@INTEL, @Cee, @ sparkydave, I had noticed the delay of 2 minutes and have worked around it by setting the timer to more than 2 minutes.

But, I think I understand what you mean: if I enter the room at the exact moment the light goes off, the light will stay off for 2 minutes due to the reported 2 minute delay of the xiaomi sensor. I cannot work around the delay in exactly that situation. If I would enter the room just before the light is turned off, or just after the light had been turned off, it would work normally. But this annoys me a bit as I seem to have the tendency to go into that room just when the light turns off :slight_smile:

Also, nice idea to turn the brightness down, something to add to my automation!