Help Needed: Creating TUYA Firmware on ESP32 to Simulate Buttons via GPIOs Controlling 4N25

Hello everyone,

I know this forum is dedicated to Home Assistant, and many here have extensive experience with IoT and ESPHome. I’m working on a project where I want to use an ESP32 to simulate button presses on an old appliance (a dishwasher). The idea is to use the ESP32’s GPIOs connected to 4N25 optocouplers, which are wired in parallel with the existing buttons (microswitches) on the appliance’s PCB. By activating the GPIO, the 4N25 simulates a button press for 500ms.

I’ve validated this setup at home using the same hardware but with ESPHome to control my old dishwasher. I soldered wires directly to the appliance’s PCB and managed to control the main functions via Home Assistant.

Now, my goal is to integrate this system with the Tuya platform so that I can control the buttons remotely through the Tuya Smart app, effectively turning the appliance into a smart device.

I’m seeking help to:

  • Develop firmware that controls the ESP32 GPIOs to activate the 4N25 optocouplers, keeping them on for 500ms before turning them off.
  • Integrate the ESP32 with the Tuya platform, allowing commands to be sent via the Tuya Smart app.
  • Configure the necessary Data Points (DPs) for each button I want to control (currently, there are five different buttons).

I understand that Home Assistant isn’t specifically focused on Tuya, but I believe the community here might be able to help or suggest alternatives to achieve this goal.

I’m using the following projects as references:

  1. How to Make Smart Home Project With Tuya IoT Platform
  2. Tuya IoT with ESP8266 & Arduino
  3. Controlling Home Device (DVD) via Tuya Link SDK and ESP32

Could anyone help me with tips, code examples, or guidance on how to develop this firmware? Any assistance would be greatly appreciated!

Thank you!

I believe it’s not that easy to get a device on Tuya.
I would never even attempt it, first because Tuya has demonstrated several times they are not willing to be part of our ideology.
Second reason is that you will be breaching their servers and using their platform, I have doubts their lawyers will like that.
Third reason is that you will probably need some API key so this whole idea seems to be a dead end in my view.

So why not just keep it in ESP-Home?
If that is because you don’t have outside access to HA then you could just make a port forward rule in the router so that you can only access the ESP-Home node.
Or just automate the button press based on time and energy cost or whatever you have on mind.

I don’t think it seems like a good idea to try and force your way on someone else’s platform without their consent.
It just sound very costly, even if nothing breaks they can and probably will blame you for something that might not have happened and you need to pay for it.

Hi Antonio Schneider,

To use the Tuya Platform, you need to buy Tuya hardware. With that you get license for the name and the App and all that. Start with a Tuya chip, not an esp.

this is kinda why consumers hate Tuya. It is a bunch of products that Tuya has sold chips and licensed firmware for and is built by dozens of random manufacturers around the world to varying degrees of product quality.