Xiaomi Human / Body / Motion Sensor - Timeout

I used this method and everything seemed to be working fine. The sensor is reset after 5 seconds and is ready for operation again. But after motion detection and reset after 5 seconds, there are repeated false motion detection after 30 seconds and after 100 seconds . I replaced the python script by rest_command but the result was repeated. I think the sensor sends out three motion detection signals within 2 minutes of motion detection. Maybe I have a defective sensor?
I run hassio 0.105.5 on rpi3b+ with HUSBZB-1 and zha integrations

I don’t see any strange behaviour on any of my sensors, no false motions detected so far.
Probably a defective sensor.

I used this automation before without the mod and had issues of it not sensing motion after 5s. I did the mod now and applied this automation. These together seem to work! I did the mod today, but noticed the lux levels refreshed every 5s, but the motion state not. I saw your comment and applied this automation as well and now it seems to work. After 5s the motion stops and I can trigger it straight away :slight_smile:

Gonna keep testing to make sure it actually works properly.

1 Like

There is no software mod possible, it’s the hardware that’s needs to register

I have as well the Xiaomi sensors mod and the sensors have been working great but now I’m as well experiencing that the sensor cleans it’s state after 5 minutes instead of the specified 15 seconds that I have configured for deCONZ. It’s strange to me that this happens every 1 week and only for some sensors which seem to be affected randomly. Do you have any additional information about how to resolve this apart from re-pairing the device to the network?

Hi,
Any solution to connect this with the Xiaomi gateway? I did the hardware mod but seems that it’s not enough.

So just to be clear. The hardware mod AND the software mod are required to get this working?
I tried the software mod which resets the state to not detected after x seconds. But there is no new motion triggered for ±1.5 minutes.

pencil modded 2:
1 is working fine
1 other was continuously triggering.
:frowning:
Does anybody know of an economic zigbee movement snesor with shorter then 2 minutes reset time?

Hey @Sen, I am using ConBee 2 and I also looked for a solution to get the modification persistent. Using only the software mod (see post from @marcelod) worked for a moment. I thought that’s the final solution. BUT after a while I had the same phenomenon as described by @pergola.fabio. So the software mod was NOT persistent!

Finally I (1) did the hardware mod - see video (with a little bit of skill in handling the soldering iron not difficult) and (2) trigger the software mod at startup of HA.

Now it consistently works for me.

PS: I did it for four sensors in a row and all of them perfectly worked.

I had similar problems, I found out that the hardware pin connected to the plus side of the battery, wasn’t touching te battery most of the times. So the sensor was basically dead… Now i’ve bended the pin a little to the inside of the sensor and its touching the plus side of the battery really well. And now the sensor works like a charm!

@ZJAVA configuration.yaml or devices.yaml?

@syssi Since configuration for xiaomi gateway moved to integrations, how to enable this again?
I do have HW mod ofcourse, and it was working until now.

i’m in your same boat, last time home assistant changed something i was able to fix that in the python files but now i don’t have a clue on how to fix

Xiaomi Aqara Custom component is no longer working in last ha version.

The automation with the python script still works ! The Set state python script I mean is this one:

I successfully switched from @syssi custom_components to @critical2104 python script (i got the hardware mod on my sensors), now it works again!

A quick recap for anyone interested:

  • Enable python script component adding the string “python_script:” in your configuration.yaml

  • Create a folder named “python_scripts” in your home assistant folder

  • Get the python script file “set_state.py” linked in the quote @MiSSHeaDShoT reply and put it in the python_scripts folder

  • Create an automation like mine and adapt it to your needs:

  - alias: Xiaomi Sensor Fix
    trigger:
      - platform: state
        entity_id:
          - binary_sensor.bodysensor_cucina
          - binary_sensor.bodysensor_doccia
          - binary_sensor.bodysensor_entrata
          - binary_sensor.bodysensor_lavandino
        from: 'off'
        to: 'on'
        for: 00:00:05
    condition: []
    action:
      - service: python_script.set_state
        data_template:
          entity_id: "{{ trigger.entity_id }}"
          state: 'off'

Thank you guys for your help <3

edit: there’s a problem though: once the sensor correctly goes off after the custom time (like 5 or 10 seconds) it won’t turn on if triggered shortly after.
Did some tests and the sensor states are triggered correctly (checked in the xiaomi home app) but something is off with the python script, it works only the first time

4 Likes

I have migrated back to 0.111 just for this.

i did extensive tests and while the set_state python script works (it set the motion sensor off) and the modded sensor is effectively triggered every 5s, the automation won’t work after the first time and it goes like that:

  • Sensor is off
  • Sensor is triggered by movement, home assistant sensor state goes on
  • Python script force sensor state to off after n seconds
  • Home assistant state remain on off despite the modded sensor is triggered again (as seen from xiaomi home app logs)

Then i disabled the python script and the home assistant state remains on for 2 minutes, again like it’s totally ignoring the hardware mod of the sensor that, as i wrote before, is working perfectly.

So i think that home assistant python script alone can’t recognize the hardware mod without @syssi software mod that’s broken right now

1 Like

I have seen the same, this used to all work but now is broken, a shame as this used to be really handy for my automations.

Hoping there is a fix soon…

Here’s an AppDaemon app to to do the same.
Should be available on HACS in the next couple of days or you can install manually.

1 Like