Aqara Motion Sensor Hack for 5 sec

I have same issues, planning to desolder the jumper.
I have also older model without the pushbutton. Is that working better with the jumper?

Just reported it as a bug here https://github.com/zigpy/zha-device-handlers/issues/523

There is also some people discussing about how the sensors work as expected if using DeConz, but exhibit the ghost trigger behavior with ZHA: Xiaomi Motion sensor with zha vs zha_new

Maybe if more people writes about this unexpected behavior, a fix can be developed for using our sensors with ZHA.

3 Likes

If it’s really a zha bug, not hardware issue is a good news.

From what I read, the hacked sensor works as expected with deconz and zha_new, but when used with zha it shows the false trigger issues… It seems that not a lot of people use this type of sensor, hacked, with zha…

It seems that there is a bug in the integration… The autor says that zha is reporting motion without traffic from the sensor. He is asking what is the last version where the sensor worked as expected, but I just got my sensors last week and they were behaving this way since the beggining. Maybe someone here can help us with this?
The bug report is in https://github.com/zigpy/zha-device-handlers/issues/523

I also did the hack just couple of weeks ago, so no help from me either.

Actually I just noticed you are talking about zha integration and thought first it’s the same, but I’m using zigbee2mqtt and getting same behaviour.

You can use this in the zigbee2mqtt configuration options:

device_options:
  occupancy_timeout: 5
  temperature_precision: 1
1 Like

That actually worked, no more false detections! I used set state python script earlier. Thanks!

Hi all,

what is the best way to reset the value to occupancy = no with hassio and node red? i dont find a good solution for me, can you give me a description of the solution?

Thank you

best regards

Mathias

@luetter I’m using 60 seconds occupancy=0. I have that configured with zigbee2mqtt, which works best for me. I don’t have a usecase where I want to switch on a light or something for a shorter period then 60 seconds, this is how I determined the time.

For me, none of the above methods work. I made the hardware modification to make the sensor update every 5 seconds. That worked. I can see in the log of my aqara gateway that the sensor recognizes every 5 seconds a new movement.

I used the python script to set the sensor state in home assistant to ‘off’. This worked, but after 5 seconds, the sensor state in home assistant will not turn to ‘on’ again even the sensor has regonized a movement (i can control it via the logs in the aqara gateway). I still have to wait 2 - 3 minutes before i can use the sensor in home assistant again.

Do i need to integrate the sensor via zigbee2mqtt or any other solution? Does the hack via the integration via the aqara gateway not work?

After a lot of testing I found a way to get this working for my setup by making changes in the source code for the motion sensor.

First, I changed the reset interval of the sensor to 10 seconds in this line.
Unfortunately this did not work. The sensor state has not been changed back to “off” within 10 seconds (i tooks about 3 minutes, dont now whats wrong there…)

Then I used the python script as mentioned above in my automation to manually reset the sensor state. This seems to work. The sensor state was reseted to “off”. But unfortunately no motion was recognized for the next 2 - 3 minutes.

Then, after a lot of logging, i found this line which seems to control if my automation gets triggered or not. I changed the return value to True. Now in combination with the python script everything works as expected.

Hopefully didnt break anything …

is use the aqara motion sensor hack within Deconz.
Is ZHA also useable with this hack? are there people who did this within ZHA?
I tried last year ZHA but i had issues with the motion sensors that they made false triggers.
dont know if that is already solved??

I think I found the solution to the ghost switches and posted here: https://github.com/zigpy/zha-device-handlers/issues/523#issuecomment-744746599

Basically the solution is to reset the state in ZHA, not in HA. This is the yaml to change the state (replace IEEE with the sensor address):

service: zha.set_zigbee_cluster_attribute
data:
  ieee: '00:15:8d...'
  endpoint_id: 1
  cluster_id: 1280
  cluster_type: in
  attribute: 2
  value: 0
3 Likes

Just used this code in my sensor reset routine in node red and it works flawlessly (at least for the last 30 minutes I’ve been testing it). No more ghost triggers even using a 5s reset delay! Thanks!!!

nice that was the number 1 reason i choose deconz over ZHA
but now fixed. going to test this in the future

Is there anyway to do this without the hardware hack? Just not confident in solder such a small board :frowning: I use Deconz and Conbee

The hardware hack is needed. You can use a 4B pencil, but soldering is more reliable.

Also a feedback from my side:

I did the hardware mod and use ZHA (with a zigbee dongle).
I also use Node Red and this simple json post with state off did the the job.
No appdaemon needed, no flickling of code.
Thanks for sharing!

And when I understand it correct the “ghost false positive” are also now fixed: