This year, Xiaomi launched a batch of hygrometers with a clone of the STH4x sensor.
These are the MJWSD06MMC and LYWSD03MMC hygrometers with sensors labeled "G40."
According to the documentation for the STH4x and GXHT4x sensors, the only difference is the minimum supply voltage.
However, hygrometers with sensors labeled "G40" experience occasional random dropouts in measurement values.
The problem has been identified...
This primarily affects firmware versions with Zigbee. In the Zigbee SDK, the process of waking up the chip is located in the closed part of the libraries. The BLE version does not experience any dropouts. The BLE version uses a patch in the SDK procedure to initialize the GPIO when the chip wakes up from sleep mode.
The original Xiaomi firmware for hygrometers with "G40" has some differences.
When connected to a BLE connection with the original firmware, it is impossible to determine which sensor is used in the hygrometer.
Eliminating dropouts requires a different approach to sensor polling, as the transition from sleep mode to active mode on the TLSR8xxx causes short "0" pulses on the GPIO pins, which affects the G40 sensors. As a result, the cycle of requesting a measurement, waiting for a measurement, and actually reading the measurement values of the G40 sensors via I2C cannot be performed with the chip transitioning to sleep.
Processing the measurement wait without sleep mode increases battery consumption by approximately 20%.
Currently, the solution is implemented using a different firmware version, which increases battery consumption.
https://github.com/pvvx/ZigbeeTLc/raw/refs/heads/master/bin/1141-020d-01333001-Z06MMC_g40.zigbee
( pvvx/ATC_MiThermometer#762 )
This year, Xiaomi launched a batch of hygrometers with a clone of the STH4x sensor.
These are the MJWSD06MMC and LYWSD03MMC hygrometers with sensors labeled "G40."
According to the documentation for the STH4x and GXHT4x sensors, the only difference is the minimum supply voltage.
However, hygrometers with sensors labeled "G40" experience occasional random dropouts in measurement values.
The problem has been identified...
This primarily affects firmware versions with Zigbee. In the Zigbee SDK, the process of waking up the chip is located in the closed part of the libraries. The BLE version does not experience any dropouts. The BLE version uses a patch in the SDK procedure to initialize the GPIO when the chip wakes up from sleep mode.
The original Xiaomi firmware for hygrometers with "G40" has some differences.
When connected to a BLE connection with the original firmware, it is impossible to determine which sensor is used in the hygrometer.
Eliminating dropouts requires a different approach to sensor polling, as the transition from sleep mode to active mode on the TLSR8xxx causes short "0" pulses on the GPIO pins, which affects the G40 sensors. As a result, the cycle of requesting a measurement, waiting for a measurement, and actually reading the measurement values of the G40 sensors via I2C cannot be performed with the chip transitioning to sleep.
Processing the measurement wait without sleep mode increases battery consumption by approximately 20%.
Currently, the solution is implemented using a different firmware version, which increases battery consumption.
https://github.com/pvvx/ZigbeeTLc/raw/refs/heads/master/bin/1141-020d-01333001-Z06MMC_g40.zigbee
( pvvx/ATC_MiThermometer#762 )