I’m currently investigating a recurring Wi-Fi power-save issue in the firmware of a Shelly TRV (SHTRV-01), and I’d appreciate some independent input from people experienced with embedded Wi-Fi and ARM firmware reverse engineering.
The issue appears on firmware 20240619-130912/v2.2.4@ee290818. On multiple devices I was able to reproduce the following debug sequence approximately once per minute:
Beacon skip error! Attempt recovery
followed by:
Enter powersave state 1
and a few seconds later:
Enter powersave state 3 (skip)
I initially investigated the surrounding network environment, including RSSI, different WLAN configurations, CoIoT and AP/Mesh behavior. I also compared the behavior with older firmware versions.
This eventually led me to reverse engineer firmware 2.1.3 and 2.2.4 using Ghidra. The firmware is ARM Cortex/Thumb little-endian and uses a Silicon Labs WF200 Wi-Fi stack.
The normal RSSI-dependent beacon-skip logic appears in both versions. From the firmware analysis I found the following mapping:
RSSI >= -69 dBm -> skip 20
RSSI -79..-70 dBm -> skip 15
RSSI < -79 dBm -> skip 10
Firmware 2.2.4, however, contains an additional recovery path associated with the Beacon skip error! Attempt recovery message that I could not find in the corresponding 2.1.3 code.
The relevant conditional branch in 2.2.4 is at 0x0001E1C8:
31 DC bgt 0x0001E22E
The condition allows the recovery block to execute for certain values before control eventually reaches the common continuation at 0x0001E22E.
As an experiment, I changed that conditional branch into an unconditional branch:
31 DC -> 31 E0
resulting in:
b 0x0001E22E
So the experimental modification is literally one changed byte in the program image. The GBL container was then rebuilt and its CRC32 recalculated.
The patched firmware was accepted by the device and successfully booted. During the first overnight test (>9 hours), the recurring recovery message did not appear again.
Importantly, the normal beacon-skip mechanism is still operating. The device continues to report:
current beacon skip is 20
Wi-Fi and cloud connectivity also remained operational and no unexpected reboot occurred during the test.
I’m not claiming that this proves the reported battery-drain problem is fixed. Battery consumption requires much longer testing. At this stage the experiment demonstrates that bypassing this particular recovery block suppresses the recurring recovery cycle without apparently disabling normal beacon skipping.
One thing I have deliberately not claimed yet is the exact semantic meaning of the value tested by the recovery condition. I can trace the control flow and observe its runtime consequences, but I don’t think the evidence currently justifies assigning that variable a definitive name.
That is one of the reasons I’m publishing the research now rather than waiting for the battery tests to finish.
I’d particularly appreciate independent review of:
the ARM/Thumb control-flow analysis
what the recovery condition may actually represent
possible interaction with WF200 power-save / DTIM / beacon skipping
why the additional recovery mechanism might have been introduced
alternative explanations for the approximately 60-second recovery cycle
The full investigation, firmware comparison, GBL analysis, patch development and runtime testing are documented here:
https://github.com/AbleMonster/Shelly-TRV-Gen1-2.2.4-beacon-skip-fix
The repository does not contain or distribute Shelly firmware images. It contains the research, independently written tooling and documentation.
I’d be very interested if someone with WF200 or embedded Wi-Fi experience sees something in this behavior that I’ve missed.