Step by step guide to use the switch in a WiFi + MQTT + Node-RED + Apple Home (HomeKit) environment without using SONOFF/itead software or servers.
- Consider backing up the original firmware before flashing anything (see below)
- You may use everything provided here for free (at your own risk)
- Did all of that using macOS Sonoma
- I ended up using tasmota instead of ESPHome because my HomeAssistant installation in Docker does not support addons :/
- Wall switch from itead.cc: 3 Gang, EU/86 model
- USB Adapter from Amazon: UART-TTL USB Adapter
- At least 3 hands (seriously, have someone help you with this)
- Running macOS I easily used Homebrew to install the esptools via the terminal
brew install esptool
- The switch consists of three main components:
- The high-voltage back section containing the relays
- The logic board section housing the ESP32 microcontroller
- The removable white front plate, which is the user interface for daily operation
- Caution: Before proceeding, shut off the power supply. Then disconnect all wiring from the high-voltage section. This is for safety precautions, even though we won't be working on this part. For flashing, we only need the logic board section. The high-voltage section and front plate are not required for this process.
- Disassembly steps:
- Separate the logic board section from the high-voltage back section.
- (Optional) Remove the front plate if it's attached to prevent scratching during work.
- Carefully open the logic board section: a. Locate and remove the four small screws securing the cover. b. Gently lift the cover to expose the logic board.
- Connect the wires to your UART-TTL USB Adapter like explained here by chris2172
- I wanted to backup the firmware provided on the switch. I found a guide for this here at hobbytronics.pk, but for older switches (with 1MB/4MB firmware). So needed a way to find out the proper size of the T5 firmware. Thanks to Claude 3.5 I came up with this chip-info command:
esptool.py --port /dev/cu.usbserial-1440 flash_id
- Result: The flash size is not 1MB or 4MB but 8MB
esptool.py v4.7.0
Serial port /dev/cu.usbserial-1440
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting...
Detecting chip type... ESP32
Chip is ESP32-D0WDR2-V3-V3 (revision v3.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 54:43:b2:71:b9:2c
Uploading stub...
Running stub...
Stub running...
Manufacturer: 5e
Device: 4017
Detected flash size: 8MB
Hard resetting via RTS pin...
- With the help of my lovely wife ❤️ I could easily plug in the UART-TTL USB adapter while holding a cable connected from the GROUND PIN to the BOOT solder point (pink wire). The switch is now in boot mode. So we can run the following terminal command:
esptool.py --port /dev/cu.usbserial-1440 read_flash 0x00000 0x800000 ~/Desktop/image8M.bin
- This took a couple of minutes but provided a nice firmware backup file I renamed properly afterwards: sonoff-tx-ultimate-t5-3c-86-original-firmware-2024-06-28.bin
- Note: You can relieve the cramp in (your?) third hand a little by removing the pink wire once the reading has started and you are sure everything works.
- I decided to use the web installer route for installing tasmota so I did not have to download the proper firmware from a selection of 100s of variations and get URLs, files, paths and stuff right. The web installer does all that for me.
- First I unplugged the USB adapter again, reapplied the pink wire (thanks again, ❤️) and plugged the USB adapter in again.
- Then I flashed the firmware by following the nicely guided web assistant.
- After flashing Tasmota, we want to connect the switch to your home network
- The device will create its own WiFi access point named "tasmota-XXXXXX" where XXXXXX is a unique identifier. Connect to this "tasmota-XXXXXX" network
- Once connected, you should automatically be redirected you to the Tasmota configuration page (usually at http://192.168.4.1). If not, open a web browser and navigate to this address manually.
- On the configuration page, you'll see a "Configure WiFi" section. Enter the SSID and the password for your home WiFi in the second field. Click "Save" to apply these settings.
- The switch will restart and attempt to connect to your home network. If successful, the switch will disappear from the available WiFi networks list. If not, it will revert to Access Point mode after a few minutes, allowing you to try the configuration process again.
- To find your switch on your home network you need it's IP. Check your router's connected devices list for a new device i.e. the switch named something with "tasmota". For that I use LanScan, a network scanner app.
- Enter it into a web browser to access the Tasmota web interface.
- At this point, you have two options:
- Reassemble and connect to mains power:
- Unplug the USB adapter and disconnect all wires.
- Carefully reassemble the switch.
- Connect the reassembled switch to mains power.
- This approach allows for a more realistic setup during configuration.
- Continue with an "open" configuration:
- Keep the logic board exposed.
- Proceed with the configuration process while the device remains disassembled.
- Choose this if you want to make further modifications to the firmware, i.e. go back to the stock firmware.
- Reassemble and connect to mains power:
- For this guide, we'll proceed with the reassembled switch connected to mains power.
- From the web interface, select Configure → Configure Other. This brings you to this screen:
- The line of text below "Template" will look different when installing Tasmota for the first time. Here we need to enter the proper template string.
- Get it from this website: templates.blakadder.com
- Be sure to select the proper model (1/2/3/4-Gang) as well as US or EU versions. Just use the search function in the menu and enter
Sonoff TX Ultimate T5
to see all models. - Copy the string provided in the Details page below the text Configuration for ESP32
- For my switch model (sonoff-tx-ultimate-t5-3c-86) it is:
{"NAME":"TX Ultimate 3","GPIO":[0,0,7808,0,7840,3872,0,0,0,1376,0,7776,0,225,224,3232,0,480,3200,0,0,0,3840,226,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"Backlog Pixels 28"}
- Enter the string in the edit field where it says Template
- Choose names that help you identify all parts of the switch later: Device Name for the switch and the Friendly Names for the relays. In my case, 1-3 are the actual relays and friendly name 4 is a virtual switch for the LEDs around the switch.
- Click the Save button and the switch will reboot. This will provide the following web interface where you can play around a bit with the color sliders for the LEDs and hear the relays when you click the Toggle buttons.
- Note: A physical interaction with the switch (i.e., touching it) will not do anything yet!
- To get touch, haptics and sound to behave like in the stock firmware we have a lot to do. First, let's enable touch, thanks to blakadder.com for the original guide and the files.
- Download the touch driver file txultimate.be
- In the Tasmota web interface navigate to Tools → Manage File system
- Upload the file to the switch by selecting Choose file then select the previous downloaded txultimate.be, finally click Start Upload. You will then see the file in the list below the Upload button.
- The touch driver needs to be loaded on startup.
- So select Create and edit new file.
- In the File edit box enter the text
/autoexec.be
. - In the edit area below delete the prefilled text (newfile.txt) enter
load("txultimate.be")
instead. It should look like this:
- Select Save. This is how it should all look like:
- Restart the switch from the main menu. This will load the touch driver, enabling it to recognize touch events.
- Caution: Ensure you do not touch any high-power components such as the exposed screws form the screw-terminals. Especually if the device is in a test setup on your desk, consider using insulation tape to cover any exposed conductive parts.
- To verify the touch driver works, navigate to Tools → Console and touch the switch. Observe the RESULT topic in the log for confirmation. You should find log-lines like this:
11:21:19.216 Touch event: 0 pos: 1
11:21:19.314 bytes('AA5501020101BF04')
11:21:19.316 Short press zone: 1
11:21:25.364 bytes('AA55010202000568F0')
11:21:25.366 Touch event: 0 pos: 5
11:21:25.414 bytes('AA5501020105FF80')
11:21:25.416 Short press zone: 5
11:21:29.314 bytes('AA55010202000A991F')
11:21:29.316 Touch event: 0 pos: 10
11:21:29.414 bytes('AA550102010A0E6F')
11:21:29.416 Short press zone: 10
- There are events firing based on where, how and how long you touch the switch. e.g. pos 1 is the left switch, pos 5 the middle one and pos 10 the right one.
- Again, note that there are no "default" actions set in the firmware/config (yet). So touching only results in events in the log, no sound, no light, no haptics, no relay that changes.