Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tammorgan_flint wrote:Is there any command in the Tuya protocol to change the polling time? If this is the case, we could try to see if it's implemented in the MCU's firmware
Send module command
Note:
“Send command” is an asynchronous processing protocol. When the MCU receives the control packet, it responds to the module about the reception and controls the device according to the command. The MCU status response is shown in the status reporting of the MCU.
For example, the module sends the following command:
Field Length (byte) Description
Header 2 0x55aa
Version 1 0x00
Command word 1 0x09
Data length 2 It depends on the type and number of the “command data unit”
Data N See the “Status data unit” section
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder
The module sends the control command: (The system switch corresponds to DP 3, uses Boolean data type, and the value of 1 indicates power-on)
55 aa 00 09 00 05 03 01 00 01 01 13
Response from the MCU:
Field Length (byte) Description
Header 2 0x55aa
Version 1 0x00
Command word 1 0x09
Data length 2 0x0000
Data 0 None
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder
ACK response form the MCU:
55 aa 03 09 00 00 0b
morgan_flint wrote:Regarding battery discharging, let's see if @p.kaczmarek2 can take a look at the information in my previous post to see if the "closing message" that the WiFi module is sending to the MCU is adequate.
auntlydia wrote:I have tested now with fully charged 1.2V AAA rechargeable batteries. After only 3 days the device was out of sufficient power and kept then rebooting every now and then, and in consequence lost its time setting. I suppose at some point the power is enough to supply the display and sensor, but not to establish a frequent WiFi connection. Have others similar results? I will test with the same batteries with original Tuya firmware and see if there is a difference. Compared to TH01 sensor, which lasts several weeks or even months with fresh batteries with openbk, this is a huge difference.
morgan_flint wrote:I finally could repair my scope yesterday, so I'll take a new look at the communication between U3 and U8.
spin55 wrote:Unless there is an error, the command to send would be: 55aa00090008110200040000000524 for a reporting interval of 5 minutes.
And TuyaMCU should answer with: 55aa030900000b.
spin55 wrote:The problem of battery depletion seems to be related to the type of base technology, which is why Zigbee is much more efficient for battery-powered devices because this type of module consumes much less in Tx mode than conventional WiFi.
morgan_flint wrote:I had also tried sending it with realterm, but if I pasted 55AA00090008110200040000000524 to Realterm
morgan_flint wrote:I agree Zigbee would be more efficient, but I also think there's a problem with the terminating sequence sent by OBK to the MCU, as I said here, because with OBK the module remains connected for a long time each time it's powered on by the MCU (more than a minute) while with the original FW it goes off just after the communication with the MCU ends (about 10 seconds).
morgan_flint wrote:I also have looked WiFi for low power protocol for the last message sent to the module (55AA000B00000A) and it's response (55AA000B000201505D). The first one is "MCU obtains the strength of the connected router" (I understand the MCU asks the module for the signal strength) and the response from the module is "Module returns current value of strength (80)". None of these seem to have any meaning in the "normal" protocol, nor could I find the meaning of the last answer (repeated three times) of the module with the OBK FW (55AA000800010008), being this one the more similar one (55 aa 00 08 00 00 07, Query DP status).
So, probably, the MCU is waiting for the strength signal data and receives instead a query it doesn't understand, so remains a long time waiting for the answer without disconnecting the module, until it finally gives up
morgan_flint wrote:I had tried also that, but if I hit "send numbers" nothing happens, and if I hit "send ascii" I get the same result as of pasting directly to the terminal...
I must have something wrong with my configuration
spin55 wrote:Como conectas UART Usb con placa??
Conectas Tx y Rx de USB a Tx y Rx de módulo WiFi??.
spin55 wrote:I forgot to tell you that to prevent the WiFi module from interfering with the USB connection when you want to carry out the test with batteries inserted, you have to set the CEN pin of the module to GND.
p.kaczmarek2 wrote:So it seems that we have to send one extra packet to get sleep earlier?
spin55 wrote:Unless there is an error, the command to send would be: 55aa00090008110200040000000524 for a reporting interval of 5 minutes.
And TuyaMCU should answer with: 55aa030900000b.
p.kaczmarek2 wrote:it's 1.17.302
TL;DR: For TH08/TH08B owners who want OpenBeken without killing battery life, the key fix is low-power Tuya handling: battery life improved from 3 days to nearly 2 months, and one contributor confirmed, "the MCU turns off the module as soon as the last packet from the module is received" after the protocol fix. [#20802807]
Why it matters: This FAQ turns a 9-page reverse-engineering thread into a practical flashing, recovery, and configuration reference for BK7231/BK7238-based TH08 sensors.
| Option | Power behavior reported in thread | Typical result |
|---|---|---|
| Original Tuya firmware | about 6 weeks to nearly 2 months on batteries | Best battery life, cloud-dependent |
| Early OpenBeken builds | about 3 days on 3xAAA NiMH | Functional, but poor low-power handling |
| Updated OpenBeken after low-power packet fix | about 2 weeks on alkalines with level still high, or close to original behavior | Best cloud-free compromise |
Key insight: The TH08 is not a simple Wi-Fi sensor. A separate TuyaMCU controls sensor reads, LCD updates, and power to the Wi-Fi module, so flashing and battery life both depend on handling that MCU correctly. [#20723152]
startDriver TuyaMCU, startDriver tmSensor, startDriver NTP, ntp_setServer ..., ntp_timeZoneOfs ..., setChannelType 1 temperature_div10, linkTuyaMCUOutputToChannel 1 val 1, setChannelType 2 Humidity, linkTuyaMCUOutputToChannel 2 val 2, setChannelType 3 ReadOnlyLowMidHigh, linkTuyaMCUOutputToChannel 3 val 3. For some variants, adding tuyaMcu_defWiFiState 4 solved missing reports. [#20893860]55AA001000070101090400010026 after a short delay, for example with delay_s 2 followed by uartSendHex ... in autoexec.bat. Another contributor confirmed that packet switched the display from °F to °C reliably on their unit. [#21550660]tuyaMcu_sendState. [#21385904]NTP_CheckForReceive: Error while receiving server's msg; switching to a valid reachable server resolved the wrong 1970/2070 display time. Also set the correct offset manually, because OpenBeken in this thread did not yet auto-handle DST, so Portugal needed 0 or 1, while Spain used 1 or 2 depending on season. [#21074347]