cflurin / xiaomi-mqtt

A Bridge between the Xiaomi Mi Smart Home Gateway and the Mqtt broker.
Apache License 2.0
50 stars 14 forks source link

Motion sensor timing #5

Open iChUdY opened 6 years ago

iChUdY commented 6 years ago

Hi, on motion from human body sensor:

{"cmd":"report","model":"motion","sid":"158d0001643xxx","short_id":64906,"data":{"status":"motion"}}

after 120 sec:

{"cmd":"report","model":"motion","sid":"158d0001643xxx","short_id":64906,"data":{"no_motion":"120"}}

Any chance to change no_motion time to lower value and again motion preparedness? Or how to make lower motion time in HomeKit?

I discover one think.. if i change icon motion sensor in Mi Home App to firts icon then msg {"status":"motion"} can deliver before than {"no_motion":"120"}, but no change {"no_motion":"120"} to lower value... 40s in this case.

Thanks

cflurin commented 6 years ago

Hi, this is a xiaomi feature, it takes 120 sec until you get the "no_motion" report. I use a trigger-node in node-red sending the msg "motion" and wait for 30 sec to send "no_motion".

iChUdY commented 6 years ago

Ok thats works fine. Thx.

Xiaomi sensor immediately after paired to gateway have 5s trigger. I set trigger in node-red to 5s and set trigger time direct in HomeKit automation πŸ‘ŒπŸ» Ideal solution πŸ‘ŒπŸ»

Post my node-red for others. Thats easy πŸ‘πŸ»

22918a40-d704-468f-8c74-2fbecf0b0033

[{"id":"7dd7a76f.343a28","type":"mqtt in","z":"1167ebf5.1b2944","name":"","topic":"xiaomi/from","qos":"2","broker":"54d352a8.88492c","x":110,"y":160,"wires":[["89f0dd4.60b32a"]]},{"id":"89f0dd4.60b32a","type":"switch","z":"1167ebf5.1b2944","name":"Motion bedroom","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"{\"cmd\":\"report\",\"model\":\"motion\",\"sid\":\"158d0001643xxx\",\"short_id\":187,\"data\":{\"status\":\"motion\"}}","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":330,"y":160,"wires":[["a79a615.d5581a"]]},{"id":"a79a615.d5581a","type":"trigger","z":"1167ebf5.1b2944","op1":"{\"name\":\"motion_bedroom\",\"characteristic\":\"MotionDetected\",\"value\":1}","op2":"{\"name\":\"motion_bedroom\",\"characteristic\":\"MotionDetected\",\"value\":0}","op1type":"json","op2type":"json","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":520,"y":160,"wires":[["9ba87ba4.41a5b8","557403f4.88d584"]]},{"id":"9ba87ba4.41a5b8","type":"mqtt out","z":"1167ebf5.1b2944","name":"","topic":"homebridge/to/set","qos":"","retain":"","broker":"54d352a8.88492c","x":730,"y":160,"wires":[]},{"id":"557403f4.88d584","type":"debug","z":"1167ebf5.1b2944","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":260,"wires":[]},{"id":"b75e3556.77ff38","type":"comment","z":"1167ebf5.1b2944","name":"XIAOMI GATEWAY","info":"","x":130,"y":60,"wires":[]},{"id":"271ca925.b42ce6","type":"comment","z":"1167ebf5.1b2944","name":"ONLY BEDROOM SID","info":"","x":340,"y":60,"wires":[]},{"id":"fb674f59.dfe7f","type":"comment","z":"1167ebf5.1b2944","name":"HOMEKIT MSG","info":"","x":540,"y":60,"wires":[]},{"id":"5622814d.2b0338","type":"comment","z":"1167ebf5.1b2944","name":"HOMEBRIDGE","info":"","x":720,"y":60,"wires":[]},{"id":"75d57da3.60727c","type":"comment","z":"1167ebf5.1b2944","name":"ONLY MOTION MSG","info":"","x":340,"y":100,"wires":[]},{"id":"54d352a8.88492c","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""}]

cflurin commented 6 years ago

Hi, Thank you for your feedback.

iChUdY commented 6 years ago

Its no works.

Xiaomi FAQ: β€œOne hour after it is connected to the network (Newly added to the network mode), the Motion Sensor is triggered once every 5 seconds. If it is not triggered within an hour, it automatically enters Normal User Mode. It is then triggered once every minute.”

When set trigger-node to 30s then 0-30s is on motion and 30-60s sensor no scan motion report. Unfortunately no way to shorten one minute trigger :( or is?

Ideal solution is the Motion Sensor is triggered once every 5 seconds like newly added, but no way to this. Grr..