Aqara Motion Sensor Hack for 5 sec

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 with 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, aquara 2 motion sensor

Today, for the experiment, I removed the jumper i had previously soldered in the motion sensor. Connected automation with a python script that clears the binary sensor after 5 seconds and made a series of observations. Script automation works just like with a soldered jumper. So there is no sense in this jumper. But there is a false triggering a minute after the actual motion is detected. I will have to abandon the script and use the default behavior of the sensor (

I think there is just no hardware solution, setting the state of a binary sensor does nothing with the hardware itself…

It’s the hardware at the end that needs to send a new state , regardless the state of the binary sensor

Could you share the node red flow you’re using to do this please?

It’s not possible with a software setting/automation/configuration… Only possible by modifying the hardware

I’ve already soldered the jumper to my sensors but they don’t seem to be reseting in home assistant every 5 seconds. I’m using ZHA what do I need to do after soldering the jumper?

1 Like

they you could use this example :

1 Like

Thanks that did the trick. Everything working as expected now.

The state script is no longer available. I would very much appreciated if you could share your node red flow

Here you have, although you have a more complete script on hacs:

#--------------------------------------------------------------------------------------------------
# Set the state or other attributes for the entity specified in the Automation Action
#--------------------------------------------------------------------------------------------------

inputEntity = data.get('entity_id')
inputStateObject = hass.states.get(inputEntity)
inputState = inputStateObject.state
inputAttributesObject = inputStateObject.attributes.copy()

newState = data.get('state')
if newState is not None:
    inputState = newState
    
newIcon = data.get('icon')
if newIcon is not None:
    inputAttributesObject['icon'] = newIcon

hass.states.set(inputEntity, inputState, inputAttributesObject

Thank you sir!

Do you have the repo for HACS? Or is it already there? I couldn’t find anything.

I still use the automation.yaml solution wich resets it every 15 seconds. However some sensors have experienced false positive trigger suddenly lately… I noticed it triggers ever 110 minutes (exactly by the minute) a false positive…

I forgot to share Node Red flow, just in case yo need it:

[{"id":"8d5644fa.b4b938","type":"server-state-changed","z":"64c31825.2bb9f","name":"Sensor entrada","server":"f7110cd.9a9c9f","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.sensor_entrada_movimiento","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":140,"y":460,"wires":[["f9fed3f2.c89fb8","3c400ae8.1c9fa6"],[]]},{"id":"f9fed3f2.c89fb8","type":"stoptimer","z":"64c31825.2bb9f","duration":"5","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":320,"y":460,"wires":[["d68441a1.498688"],[]]},{"id":"d68441a1.498688","type":"ha-api","z":"64c31825.2bb9f","name":"","server":"f7110cd.9a9c9f","debugenabled":false,"protocol":"http","method":"post","path":"states/binary_sensor.sensor_entrada_movimiento","data":"{\"state\":\"off\"}","dataType":"json","location":"payload","locationType":"msg","responseType":"json","x":470,"y":460,"wires":[["6c8994d1.03f574"]]},{"id":"f7110cd.9a9c9f","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
2 Likes

The repository is already in HACS Automation Scripts: https://github.com/pmazz/ps_hassio_entities

I have experienced the same problem, sometimes they trigger false positives. I think they do it randomly but haven’t investigated if they do it on a fixed time. It’s a shame they don’t have an option to set the sensivity to fix this problem.

Doesn’t work for me at all any longer.

Initial trigger turn it on, then off after 5 seconds but then won’t trigger again for 2 minutes, even though the Xiaomi app triggering

You can use this AppDaemon app to reset the sensor state after 5 seconds.
Should be available on HACS in the next couple of days or you can install manually.

1 Like

Yes, but hardware mod is still needed? Setting state in HA is not enough, if no new trigger motion comes from hardware…

Yes, this works in conjunction with the hardware mod. The hardware mod makes the device report motion every 5s, but the state in HA remains on for up to 300s before resetting to off. The app resets it after 5s, so together the motion sensors in HA work great every 5s.

1 Like

Manually installed yesterday and it is working perfectly, thank you so much!

Is this working with deconz only because i use zha and it does not work?

This is maybe a bit unrelated, but:

I’ve just added the Aqara Motion Sensor via ZHA and I get (next to temperature and battery) two sensors:

  • IAS Zone
  • Occupancy.

IAS Zone clears after exactly two minutes (known, I read most of the above :wink: ). But occupancy then cleared after 10 minutes.

What is the difference between these two? I just can’t find it anywhere on the interwebbs… Thanks!