logo elektroda
logo elektroda
X
logo elektroda

[Zigbee] The cheapest thermometer ZY-ZTH02 - opinion, interior, firmware change

@GUTEK@ 1386 10

TL;DR

  • A very cheap Aliexpress Zigbee temperature and humidity sensor, ZY-ZTH02, was tested and torn down after being bought for under PLN8 per unit.
  • Inside sits a Telink TLSR8251 MCU with exposed programming pads, plus a GXHT40 clone sensor instead of Sensirion SHT40, mounted off-center in the housing.
  • Temperature differences between units were about 0.5°C, but humidity discrepancies could exceed 20%, showing the sensor quality was the main problem.
  • Firmware from ZBeacon TH01 / pvvx ZigbeeTLc was flashed with a programmer after OTA update failed, and the device joined Zigbee2MQTT as TH01-z.
  • Zigbee2MQTT needed a manual external converter to add calibration and reporting-interval options, and the factory firmware was saved for rollback.
Generated by the language model.
ADVERTISEMENT
This content has been translated flag-pl » flag-en View the original version here
📢 Listen (AI):
  • White temperature and humidity sensor with thermometer and droplet icon, plus a small blue LED
    Hello,
    until recently, the prices of devices on Zigbee were higher compared to equivalents on WiFi. Nowadays they have evened out and even dropped. Unfortunately, the build quality has also dropped. Initially, a ready-made module containing a chip supporting a particular type of network was used for communication. Over time, the chip itself began to be mounted directly on the device board - often without even the pads for programming it. The next stage involved maximum "slimming down" of the design: a minimum number of components, lower-quality subassemblies and sometimes even circuit clones.
    And this is exactly what we are dealing with here. But one step at a time...

    I recently bought on Aliexpress extremely cheap temperature and humidity sensors powered by two AAA batteries and communicating via Zigbee. The price of one unit was less than PLN8 - and that's probably their only advantage.
    AliExpress order screenshot showing a Zigbee 3.0 temperature and humidity sensor listing

    Even before the package arrived, some rather interesting comments started appearing on the product page. Standard ones like " ***** are great! but I haven't checked yet " and " * crap, doesn't work! ", suggesting that some buyers had not read that the device required a Zigbee gateway. Others began to appear, with very poor range, self-disconnection, and incorrect indications. There was even one with pictures of the device board, which.... was about 1/3 the size of those in older versions.

    Eventually, the thermometers arrived. A standard cardboard box, and in it: a brief manual, foam with adhesive tape for assembly, a key for the reset button and the device itself.
    Right out of the box, you can see that this is budget equipment. The plastic gives the impression of being of inferior quality - it is not perfectly white, rather slightly creamy and seems to be softer.
    Zigbee temperature and humidity sensor kit with device, box, manual, mounting tape, and reset pin tool

    After inserting the rechargeable batteries, I paired the device with the Zigbee2MQTT I was using. The sensor was detected without any problems and reported itself as ZY-ZTH02.
    The Z2M detected the basic entities:
    - temperature
    - humidity
    - battery percentage
    - battery voltage
    - signal level

    Zigbee2MQTT device page showing a white sensor and details for model ZY‑ZTH02 Zigbee2MQTT screenshot showing sensor values: battery, temperature, humidity, voltage, and link quality.

    At this stage everything looked correct.
    The only thing I noticed was the use of a blue LED instead of a red one. Blue LEDs require a higher voltage, so I'm curious to see how this LED will behave with heavily discharged batteries.
    White temperature and humidity sensor with thermometer and droplet icons on a wooden surface

    The temperature and humidity readings update very quickly - presumably the measurement is sent every time the value changes. This will have an impact on battery life, but for now it is difficult to assess how much.

    Of course, I also took a look inside. The thermometer comes apart very easily, it just snaps on either side. Inside is a small blue plate - already familiar to me from the photos in the comments.
    However, I was now able to read what components were used there. The main circuit is most likely the original Telink TLSR8251 in a 48-leg case. And on the board itself, the soldering points needed for its programming have been brought out.
    The situation with the temperature and humidity sensor is much worse. Instead of the Sensirion SHT40 chip, its Chinese equivalent GXHT40 was used, labelled G40 or GV4, depending on the model. In addition, the sensor was placed at the side edge of the board rather than centrally opposite the holes in the housing.


    According to the documentation, the performance of the GXHT40 is only marginally worse than the original. In practice, it unfortunately looks worse.
    Cover page of Sensirion SHT4x datasheet with sensor renderings and key specifications Screenshot of GXHT4x datasheet page with feature list and a functional block diagram

    The differences in temperature readings between the units purchased were around 0.5°C, so still acceptable. In the case of humidity, on the other hand, discrepancies could exceed 20%.
    Admittedly, Zigbee2MQTT enables calibration of the readings, but such differences are a good indication of the quality of the sensors used.
    Screenshots showing temperature and humidity readings from multiple Zigbee sensors

    This is basically where I could have ended. However, I decided to check whether alternative software was available, such as ZigbeeTlc .
    It turned out that there is firmware for a device also reporting as ZY-ZTH02 , but this is a completely different design - with a TLSR8258-based ZTU module and CHT832x sensor.
    After reviewing other models, I found a very similar device - ZBeacon TH01 . The manufacturer uses the BT3L module, which contains the TLSR8250 chip. It differs from the TLSR8251 mainly in the lack of I2S audio support, while the other parameters are the same.

    The temperature sensor was also compatible, as the original SHT4x. It remained to check that the same pins were used. I measured to which legs the SCL and SDA lines were connected, as well as the button and LED. Here was probably the biggest surprise, as everything matched!
    - pin: 22 - PB4 - SCL
    - pin: 2 - PA0 - SDA
    - pin: 11 - PB5 - button (connect to gnd)
    - pin: 31 - PC3 - led (colour blue)

    So you can try uploading new software. To play with, I took the copy with the largest scatter of indications. The OTA update unfortunately failed - there was a non-response error. I don't know if this was due to a bad file header or a lack of OTA support on this unit.

    This left the programmer. As with previous devices on Telink, I used TlsrComSwireWriter and a USB-TTL adapter for the CP2102. I first ripped the original firmware so that I could have a return.
    PCB of a Zigbee sensor with TLSR8251 chip and labeled pads: 3V3, GND, SWS, UART_TX, UART_RX, RST

    I then uploaded the file ZBTH01_v0134.bin and rebooted the device. The LED started flashing - but it looked more like a CPU reboot than a pairing mode. On the factory fw the LED then flashed quickly evenly. However, I clicked on Z2M connecting a new device and this was added as TH01-z. Unfortunately, it turned out once again that Z2M does not have a ready-made configuration for this firmware. So I had to add it manually in external_converters .

     
    const {Zcl} = require("zigbee-herdsman");
    const m = require("zigbee-herdsman-converters/lib/modernExtend");
    
    const gutek_zcl = {
        enableDisplay: m.binary({
            name: "enable_display",
            valueOn: [true, 0],
            valueOff: [false, 1],
            cluster: "hvacUserInterfaceCfg",
            attribute: {ID: 0x0106, type: Zcl.DataType.ENUM8},
            description: "Whether to enable the device display.",
        }),
        temperatureDisplayMode: m.enumLookup({
            name: "temperature_display_mode",
            lookup: {celsius: 0, fahrenheit: 1},
            cluster: "hvacUserInterfaceCfg",
            attribute: "tempDisplayMode",
            description: "The unit of the temperature displayed on the device screen.",
        }),
        comfortSmiley: m.binary({
            name: "comfort_smiley",
            valueOn: [true, 0],
            valueOff: [false, 1],
            cluster: "hvacUserInterfaceCfg",
            attribute: {ID: 0x0002, type: Zcl.DataType.ENUM8},
            description: "Whether to show a comfort indicator on the device screen.",
        }),
        comfortTemperatureMin: m.numeric({
            name: "comfort_temperature_min",
            cluster: "hvacUserInterfaceCfg",
            attribute: {ID: 0x0102, type: Zcl.DataType.INT16},
            description: "Minimum temperature that is considered comfortable (default 20.00°C).",
            unit: "°C",
            valueMin: -50.0,
            valueMax: 120.0,
            valueStep: 0.01,
            scale: 100,
        }),
        comfortTemperatureMax: m.numeric({
            name: "comfort_temperature_max",
            cluster: "hvacUserInterfaceCfg",
            attribute: {ID: 0x0103, type: Zcl.DataType.INT16},
            description: "Maximum temperature that is considered comfortable (default 25.00°C).",
            unit: "°C",
            valueMin: -50.0,
            valueMax: 120.0,
            valueStep: 0.01,
            scale: 100,
        }),
        comfortHumidityMin: m.numeric({
            name: "comfort_humidity_min",
            cluster: "hvacUserInterfaceCfg",
            attribute: {ID: 0x0104, type: Zcl.DataType.UINT16},
            description: "Minimum relative humidity that is considered comfortable (default 40.00%)",
            unit: "%",
            valueMin: 0,
            valueMax: 100,
            scale: 100,
        }),
        comfortHumidityMax: m.numeric({
            name: "comfort_humidity_max",
            cluster: "hvacUserInterfaceCfg",
            attribute: {ID: 0x0105, type: Zcl.DataType.UINT16},
            description: "Maximum relative humidity that is considered comfortable (default 60.00%).",
            unit: "%",
            valueMin: 0,
            valueMax: 100,
            scale: 100,
        }),
        temperatureCalibration: m.numeric({
            name: "temperature_calibration",
            cluster: "hvacUserInterfaceCfg",
            attribute: {ID: 0x0100, type: Zcl.DataType.INT16},
            description: "Offset to add/subtract to the reported temperature (default 0°C).",
            unit: "°C",
            valueMin: -50.0,
            valueMax: 50.0,
            valueStep: 0.01,
            scale: 100,
        }),
        humidityCalibration: m.numeric({
            name: "humidity_calibration",
            cluster: "hvacUserInterfaceCfg",
            attribute: {ID: 0x0101, type: Zcl.DataType.INT16},
            description: "Offset to add/subtract to the reported relative humidity (default 0%).",
            unit: "%",
            valueMin: -50.0,
            valueMax: 50.0,
            valueStep: 0.01,
            scale: 100,
        }),
        measurementInterval: m.numeric({
            name: "measurement_interval",
            cluster: "hvacUserInterfaceCfg",
            attribute: {ID: 0x0107, type: Zcl.DataType.UINT8},
            description: "Configure sensor measurement interval (default 10 seconds).",
            unit: "s",
            valueMin: 3,
            valueMax: 255,
        }),
    };
    
    module.exports = [
        {
            zigbeeModel: ["TY0201-z"],
            model: "TS0201",
            vendor: "Tuya",
            description: "Temperature and Humidity Monitor (pvvx/ZigbeeTLc)",
            extend: [
                m.temperature({reporting: {min: "10_SECONDS", max: "1_HOUR", change: 10}}),
                m.humidity(),
                gutek_zcl.enableDisplay,
                gutek_zcl.temperatureDisplayMode,
                gutek_zcl.temperatureCalibration,
                gutek_zcl.humidityCalibration,
                gutek_zcl.measurementInterval,
                m.battery({
                    voltage: true,
                }),
            ],
            ota: true,
        },
        {
            zigbeeModel: ["TH01-z"],
            model: "TH01-2-z",
            vendor: "ZBeacon",
            description: "Temperature and Humidity Sensor (pvvx/ZigbeeTLc)",
            extend: [
                m.temperature({reporting: {min: "10_SECONDS", max: "1_HOUR", change: 10}}),
                m.humidity({reporting: {min: "10_SECONDS", max: "1_HOUR", change: 50}}),
                gutek_zcl.temperatureCalibration,
                gutek_zcl.humidityCalibration,
                gutek_zcl.measurementInterval,
                m.battery({
                    voltage: true,
                }),
            ],
            ota: true,
        },
    ];
    


    After adding the configuration, additional options appeared:
    - temperature calibration
    - humidity calibration
    - setting the reporting frequency
    Zigbee2MQTT screenshot showing temperature, humidity, and calibration sliders
    For clarification I would like to add that these calibrations work at the device level, i.e. the corrected values are already sent out. In addition to this, the Z2M itself has calibration options in the "Specific settings" tab, but those there simply improve the Z2M.

    I am testing one piece for now and it looks like the firmware is working fine. It will also be possible to assess the battery life against the factory firmware after more time.

    Do I recommend these thermometers? Rather not. It's better to look for a model with an original sensor, although with cheap electronics from China it's often a lottery anyway - you never know what the manufacturer has actually put in.

    Attached, I add the ripped factory firmware.
    Attachments:
    • zth02-kopia.zip (113.16 KB) You must be logged in to download this attachment.

    Cool? Ranking DIY
    About Author
    @GUTEK@
    Level 31  
    Offline 
    @GUTEK@ wrote 1558 posts with rating 365, helped 163 times. Live in city Gliwice. Been with us since 2005 year.
  • ADVERTISEMENT
  • #2 21855897
    sq3evp
    Level 39  
    Interesting, I was planning to buy and replace my Mija 2 sensors.
  • ADVERTISEMENT
  • #3 21856039
    @GUTEK@
    Level 31  
    These Mija 2's work very well, especially if you have the older versions because they started messing with the sensor in these new ones too: https://github.com/pvvx/ZigbeeTLc/issues/258
    Also, it is best to reprogram them to Zigbee and not change them, possibly add a case to power them with 2xAAA.
  • #4 21856207
    keseszel
    Level 26  
    These sensors do not work on Zigbee but on Tuya. On Zigbee they are invisible. I have two of these and could not pair them with Zigbee. On top of that they overestimate the temperature measurement by 3.9° C . I don't know about the humidity, because I wasn't interested in it.
  • #5 21856216
    roman106
    Level 27  
    keseszel wrote:
    These sensors do not run on Zigbee but on Tuya

    Zigbee is the protocol and Tuya, the ecosystem (platform). Zigbee devices are not compatible between platforms (there are exceptions).
  • #6 21856331
    @GUTEK@
    Level 31  
    It is exactly as the previous speaker writes, the devices can be on Zigbee, WiFi or some other protocol. And work or not with Tuya, eWelink or Home Assistant.

    >>21856207 I was looking at your topic and in my opinion you have a different thermometer, notice, different logo on the case, also inside there are probably different guts. Since it works without a gateway it is very possible that it is on WiFi though. It would be best if you took one apart and uploaded a photo. It will be clear what it is.
    And as for calibration, I don't think it's possible in the Tuya app.
    And one more thing, battery-powered devices only connect to the network to send an update (if they were to stay connected all the time the batteries would die in a few days). Also, disconnecting the gateway momentarily doesn't necessarily show you that it is also disconnected. Here it would have to be longer. Alternatively, disconnect the gateway, chuck in the thermometer and press the button on it to send an update, you will see if the temperature changes in the app.
  • ADVERTISEMENT
  • #7 21856681
    marycyś
    Level 12  
    In theory, the GXHT40 is compatible with the SHT40, so you can swap and improve the quality significantly.
  • ADVERTISEMENT
  • #8 21858663
    popek9
    Level 14  
    I have a couple of these sensors at home on BT and Zigbee, 2 of them I put outside to have temperature measurement outside. Unfortunately for the last few months they only work when the temperature is above 0 °C. In the ad, the temperature measurement range in one listing was from -10 to 50 °C and in another from -20 to 60 °C

    Generally the sensors are cool, I did not notice any great divergence in the measurements, the differences between the sensors were max 0.2 °C and 0.5 % humidity. At a price of up to PLN10 I think you will not get anything better, and the extra charge for the more expensive company xiaomi is not worth it.
  • #9 21858679
    sq3evp
    Level 39  
    popek9 wrote:
    For the price up to PLN10 I don't think you'll get anything better, and the premium on the more expensive xiaomi branded ones is not worth it.

    PLN10 is a good price - I have a couple of Xaiomi Mija 2's, but bought from majnfriends for PLN10 d0 PLN25 with postage. A long time ago, even before the "C19 pandemic" - then in PL they were min 50 zł each.
  • #10 21858882
    @GUTEK@
    Level 31  
    marycyś wrote:
    Theoretically the GXHT40 is compatible with the SHT40, so you can swap and improve the quality significantly.

    In fact I even confirmed this by uploading the firmware from pvvx, which is under SHT40 and also reads the values from GXHT40 correctly.

    popek9 wrote:
    I have several pieces of such sensors at home on BT and Zigbee, 2 pieces I put outside to have temperature measurement outside. Unfortunately for the last few months they only work when the temperature is above 0 °C. In the ad, the temperature measurement range in one bid was stated as -10 to 50 °C and in another from -20 to 60 °C

    Generally the sensors are cool, I did not notice any great divergence in the measurements, the differences between the sensors were max 0.2 °C and 0.5 % humidity. At a price of up to PLN10 I think you will not get anything better, and the extra charge for the more expensive company xiaomi is not worth it.

    Meaning you don't have exactly those, just similar ones. What is inside is unknown.
    Both the original SHT40 and the Chinese ones according to the specifications should measure temperatures down to -40°C. It is just not yet known what the Chinese might have tampered with in the firmware. I put mine outside a couple of days ago to still check the humidity measurement, as it varies more outside than indoors. The frost is gone, so all I managed to record was about -1°C.
    If you want to play around, you can take one of those thermometers that don't show negative temperatures apart and look for it, maybe it's one of the versions supported by the firmware: https://github.com/pvvx/ZigbeeTLc
    Might work better than the factory fw.

    Even the Xiaomi Mija 2 comes in several hardware versions and from what I have found they can also have a replacement instead of the original SHT40, only that maybe in a better design.
  • #11 21865026
    keseszel
    Level 26  
    Thanks for the hint with these protocols or apps. Mine was supposed to work with Zigby. Now I know it's Tuja. I'm slipping on the subject as I'm a curious greenhorn. I need to check if the sensors lie through again, as there seems to be less measurement error after restarting. I'll compare with a regular thermometer.
📢 Listen (AI):
ADVERTISEMENT