Hello again! It's been a while since I last posted. Found this ultra-cheap house plant water pump from China and I was pretty determined to make it work with open source firmware, whatever is inside.
![[BK7231N / CB3S] Generic Tuya Water Pump flashing and setup OpenBK7231N_QIO_1.17.240.bin [BK7231N / CB3S] Generic Tuya Water Pump flashing and setup OpenBK7231N_QIO_1.17.240.bin](https://obrazki.elektroda.pl/2842963700_1694381412_thumb.jpg)
Turns out there's a CB3S inside along with some unlabeled custom MCU in a SOP16 package. Probably designed that way to facilitate battery powered mode, which the PCB does seem to be fully capable of doing but the pump plastic housing was refactored and modified for USB powering instead. The two buttons on the front panel are wired through the custom MCU which is connected only via P14 to the CB3S. Luckily the CB3S directly controls the two LEDs and the pump motor through P7 and P8.
Using hid_download_py I managed to upload OpenBeken to the module from the third attempt using the power-cycling method because of lack of hands to ground the reset pin.
sudo ./uartprogram /home/ivan/Downloads/OpenBK7231N_QIO_1.17.240.bin -d /dev/ttyUSB0 -w -s 0x0 -u

It took me some trial and error but eventually I figured out the two buttons could be utilized by listening for short click and long hold on the same input as it seems the custom MCU is simulating a single button on that input pin. Tapping the wifi button generates a long press event and tapping the pump power button generates a short click event. Pressing the buttons any other way doesn't produce any different events. That's just how the custom MCU behaves.
Adding
backlog AddEventHandler OnClick 14 ToggleChannel 1; AddEventHandler OnHoldStart 14 backlog OpenAP
Adding template as response to this post after I get a thread ID.



Added after 1 [minutes]:
Here's the template I am using:
{
"vendor": "Tuya",
"bDetailed": "0",
"name": "Tuya Generic Water Pump",
"model": "WIFI-V1.11",
"chip": "BK7231N",
"board": "WIFI-V1.11",
"flags": "1024",
"keywords": [
"CB3S",
"BK7231N",
"water",
"pump"
],
"pins": {
"7": "Rel;1",
"8": "WifiLED_n;0",
"14": "Btn;2"
},
"command": "backlog AddEventHandler OnClick 14 ToggleChannel 1; AddEventHandler OnHoldStart 14 backlog OpenAP",
"image": "https://obrazki.elektroda.pl/2842963700_1694381412_thumb.jpg",
"wiki": "https://www.elektroda.com/rtvforum/viewtopic.php?p=20728797#20728797"
}
Cool? Ranking DIY