Please read TuyaMCU article to understand the terminology and configuration process.
To have best results with this type of device I strongly recommend compiling a stripped down binary. There’s an unofficial binary, compiled from current development release. Flash at your own risk.
If you’re using battery power you need to prevent the device from going to sleep by actuating the reed switch constantly (approximately every 5 seconds) during the configuration.
Change device to a TuyaMCU module (or apply the provided template, result is the same)
Switch the device to battery powered sensor mode (fnId 51):
Disable multipress button options to prevent a device reset or Wi-Fi AP config mode, disable Power Cycle recovery, turn on TuyaReceived publish to MQTT and set switchmode to follow instead of toggle
Backlog SetOption1 1; SetOption65 1; SetOption66 1; SwitchMode 1
TuyaMCU for the following configuration:
Rule1 ON TuyaReceived#Data=55AA00050005650100010171 DO publish2 stat/%topic%/STATUS open ENDON ON TuyaReceived#Data=55aa00050005650100010070 DO publish2 stat/%topic%/STATUS close ENDON ON
Don’t forget to turn on the rule: