Aqara motion sensor does not work all the time

Hello,

I am a HA newbee and i have started with something simple but i looks like its not that simple at all.
I bought a Aqara motion sensor and a Aqara light bulb and i put it in the Toilet (not literally of course :slight_smile: ).
Most of the time it works but 1 out of 10 to 15 times the light does not turn on.
This is the code i use:

  • id: ‘1650757920382’
    alias: WC licht uit dmv motion sensor
    description: ‘’
    trigger:
    • type: no_motion
      platform: device
      device_id: 3be706f57521a38b28677d78a984d2de
      entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_ias_zone
      domain: binary_sensor
      for:
      hours: 0
      minutes: 1
      seconds: 0
      condition: []
      action:
    • type: turn_off
      device_id: d22d0afe59a14d03e5fbe1666146f891
      entity_id: light.lumi_lumi_light_aqcn02_light
      domain: light
      mode: restart
  • id: ‘1650761683158’
    alias: WC licht aan dmv motion sensor
    description: ‘’
    trigger:
    • type: motion
      platform: device
      device_id: 3be706f57521a38b28677d78a984d2de
      entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_ias_zone
      domain: binary_sensor
      for:
      hours: 0
      minutes: 0
      seconds: 0
      condition: []
      action:
    • type: turn_on
      device_id: d22d0afe59a14d03e5fbe1666146f891
      entity_id: light.lumi_lumi_light_aqcn02_light
      domain: light
      mode: single
  • id: ‘1650766193108’

I hope someone can help me!
Thanks
Rob

Hi,
You don’t mention what type of motion sensor you are using, nor the technology used - but let’s guess at Zigbee and a PIR:
https://www.aqara.com/en/products.html?cat_id=Sensor

The automation.yaml code you post (hint: add code fences to add formatting) logic looks fine, apart from perhaps minutes: 1 being a very short period, and type: no_motion possibly not matching the actual sensor output (but you say the issue is intermittent - so unlikely to be that). The only other thing is mode: restart.

My suggestion is to use the HASS History log to understand what the motion sensor is really doing. Intermittent issues are more likely to be real-world physical sensor issues than code race conditions.

Have a read of a recent thread discussing issues with false-triggering of an IKEA Zigbee PIR motion sensor to see an example log history, and the fix:

As an example to compare, here is one of my Zigbee PIRs (N.B. this sensor reports on and off)

- id: '123456'
  alias: Bedroom 20mins OFF
  description: Bedroom 20mins OFF
  trigger:
  - platform: state
    entity_id: binary_sensor.pir_ewelink_1234_ias_zone
    to: 'off'
    for:
      minutes: 20
  condition: []
  action:
  - service: light.turn_off
    data: {}
    target:
      device_id: 1234123412341234

If this helps, :heart: this post!

1 Like

Thank you for your detailed answer James! I will dive in to it tomorrow (middle of the night now here).
The sensor I have is this one.

Greetings,
Rob

1 Like

Hi James,

“hint: add code fences to add formatting” Thanks i will do that next time!

I set the 1 minute to 3 minutes. My idea was that when a person is on the toilet he or she won’t really move around but he or she will move a little (breathing should be ennough i thought) and that way the triggers will keep on comming, settting the ‘turn on’ time to 1 minute on and on til some leaves the toilet. But we found out that it does not work that way in real live)

The whole day it worked fine but just now it happend again. My son opened the toiletdoor and the light did not turn on, i wil look into the history and i wil make a screenshot of it.
As you will see the sensor just does not detect anything, it even takes about a minute before the motion sensor detects my son in this area after i manually ran the code.

As you can read below i am working on this issue in another topic. My knowledge of coding and HA just is not good (yet:)).

It does not really trigger false, it won t trigger every time there is motion when someone opens the door and walks in.

If you want to, please take a look at the topic i made about it.

Greetings,
Rob

I have several Aqara motion sensors, and yes, on some occasions mine don’t work either. However, it’s more like 1 in 50 times, so they only thing I’ve done is put 2 in the bathroom where it matters to my use case. Overkill, but I’m lazy.

Did you pair the sensor with it in place, or in another room? Aqara sensors are known to stick with the one router/co-ordinator, whereas you would want it to be paired with the light in the same room. If it’s instead paired with your main co-ordinator, it may be losing the connection occasionally. Re-pairing it in place would fix this.

And breathing won’t be enough to trigger a PIR sensor. For this you would need a much more expensive mm-wave sensor that is externally powered. Given the cost of electricity use, just leave the light on for 30 minutes. Or put in a door sensor and turn the light off after determining if the door was closed “before” or “after” (no motion → door open → motion = “before”).

2 Likes

PIR sensors work with a grid of sensitivity (Fresnel lens zones), so trigger best when a body moves across the grid.

  • Try mounting the sensor to the side, not straight on to increase cross-grid movement
  • Try mounting high on the opening side of a door, NOT pointed at 90deg.
  • If all else fails, add a magnetic door sensor
    • Magnet detects the door opening - light ON
    • PIR turns the light OFF after 5mins of no motion

My living room uses both door and PR sensors for exactly this reason.

In the future, microwave + PIR sensors may offer both fast detection AND occupancy (a combination used in the security industry for years using (PIR AND uW) rather than (PIR OR uW) trigger logic):

If this helps, :heart: this post!

1 Like