
Some time ago I showed the Sonoff THR320D thermostat with display and presented the possibilities of the eWeLink application. This time I will continue discussing this product, but here I will focus on its interior and on changing its firmware to Tasmota, so as to completely free it from the cloud and pair it with Home Assistant on our terms.
Previous topic:
[ESP32] Thermostat with display and WiFi - Sonoff THR320D - eWeLink application
Information about purchasing the product is in the previous topic, so let's start with the inside.
THR320D interior
This product is distinguished by its solid construction. There are no breakable hooks. Unscrew the screws:


At first glance it's not that bad, there are some protections at the input, there is even a varistor, a filter capacitor, you can also see a relay, a programming connector and a small transformer with a characteristic Y capacitor, i.e. there is a flyback power supply inside..


There is no WiFi module inside, ESP32 is located directly on the PCB, you can see the flash memory right next to it:

The PCB can be removed and we will see the display controller and the WiFi antenna:


The display supports TM1621:



We also see details of the power supply section and the LP3667 controller:

A simplified diagram of such a converter:

In the corner I also see a step down converter generating 3.3V for ESP, you can also tell it by the presence of a choke, by the way, it's interesting that they put so many ceramic capacitors there:


The already mentioned WiFi antenna:

ESP:

The photo above also shows programming pads, but there are only 4...
Firmware change
You need to start with the fact that IO0 is located on the button, so we solder 4 wires, not 5. As standard, a USB to UART converter (RX and TX) and ground and power supply (3.3V). To load the firmwarwe, first press the button and then connect the programmer's power supply so that IO0 is at low level while the device is booting.
Then you can upload Tasmota, e.g. using the online installer:
How to easily install Tasmota - online installer tasmota.github.io/install via a web browser
However, I used esptool myself:



The THR320D template is available online:
{"NAME":"Sonoff THR320D","GPIO":[32,0,0,0,226,9280,0,0,0,321,0,576,320,9184,9216,9312,0,0,9313,9248,0,1,0,3840,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}
GPIO roles:
- GPIO00 - Button 1
- GPIO04 - Relay 3
- GPIO05 - TM1621 DAT
- GPIO13 - Led_i 2
- GPIO15 - LedLinks
- GPIO16 - Led_i 1
- GPIO17 - TM1621 CS
- GPIO18 - TM1621 WR
- GPIO19 - Relay_b 1
- GPIO22 - Relay_b 2
- GPIO23 - TM1621 RD
- GPIO27 - Output Hi
Template activation:

Then you need to select the roles for the GPIO sensors, because there may be different sensors, I only checked with DS18B20:

Result:

Of course, the display still works, the template takes into account its operation, although now it no longer displays anything about humidity like the original firmware:


And the temperature in the photo is high because I heated the sensor with a lamp to test:

Everything seems to be working.
Summary
I already mentioned it in the previous part, but I highly praise all IoT products that are able to operate completely without WiFi, and the ability to read the current temperature from this display without reaching for the phone is certainly a step in the right direction. The button on the housing also increases the possibility of "physical" control, although we will not change the schedules, but it is not that important.
Of course, uploading Tasmota is only the first step, you still need to configure Home Assistant, but that shouldn't be a problem. Automatic HASS Discovery from Tasmota alone should do the trick.
In one of the next topics, I plan to discuss how we can use our Sonoff THR320D together with HA, e.g. to control heating, but that will come later...
To sum up - I recommend this product. Has anyone reading this already used it?
Cool? Ranking DIY Helpful post? Buy me a coffee.