brandond / esphome-tuya_pir

ESPHome support for cheap WiFi PIR sensors
66 stars 21 forks source link

Not an issue actually, but question / discussion on MQTTs published by this PIR senso #20

Open seemebreakthis opened 3 years ago

seemebreakthis commented 3 years ago

I have the exact type of PIR sensor, but I flashed tasmota instead of ESPHome. Anyway this is the only place I've found that contains some info on the MQTT content, so I just want to chip in and ask some questions:

  1. Can confirm that each time motion is detected, the device will send to the ESP these four sets of messages:

55AA0002000001 - Command "02" with no value. Don't know what this is. 55AA0005000A65010001016604000101E2 - Command "05", followed by "65 01 00 01 01" (motion detected like u said), followed by "66 04 00 01 01" (battery high I assume, I have a new battery) then after a few seconds of stillness / no motion 55AA0002000001 - Command "02" with no value. Don't know what this is. 55AA0005000A65010001016604000101E2 - Command "05", followed by "65 01 00 01 00" (motion no longer detected like u said), followed by "66 04 00 01 01" (battery high)

So thanks to your analysis I know how to interpret the data and can take action on motion / battery low warnings.

  1. I have also seen this MQTT once so far, although I don't monitor too often plus my PIR has only been flashed with tasmota for a day or so:

55AA00EE000101EF - Command "238" with a single byte value of "01"

Any clue what this means?

(EDIT: For my device anyway, 66 04 00 01 03 means low battery. My device lasted about 2 more days after it started sending low battery signals. Then it died.)

ptrooms commented 3 years ago

Strange messages which I cannot directly relate to de Tuya PIR sensor battery. Perhaps you are reading the Door sensor (MCU) which does may/have the sequence: ... 66 04 00 01 xx - sensor battery level (xx --> low/mid/high)?

Nite: the message " 55AA0002000001 " = MQTT connected and data message will be send

Regular battery PIR message, here start only at first initial start is:

55AA00050005030400010213 (low) 55AA00050005030400010112 (fair) 55AA00050005030400010011 (good)

Perhaps the MCU is a newer version,please check this with TuyaSend command: 55AA0001000000 which should return a long hex/ascii formatted hex string, that translates to/like " mokkxxxxxxxxxxxx , version: 1.1.5 " Note 'xx....xx' is my serial number which is blanked out here,

seemebreakthis commented 3 years ago

As a matter of fact, the tasmota console interface displays a bunch of info every time my device wakes up when motion is detected - I believe this is the handshake with MCU - and the MCU product info is included every time. My interpretation is that the ESP and MCU does a bunch of info exchange each time the MCU wakes up the ESP. And the MCU transmits its product info probably due to the ESP sending 55AA0001000000 over to it as part of the handshake.

I also manually sent 55AA0001000000, and I got the same result. Translated here:

"P":"Okurono2XLVRV0fB","v":"1.1.0"

(Thanks for your info regarding 55AA0002000001, now I am certain I can ignore this message)

(Have you ever seen 55AA00EE000101EF ?)