FAQ
TL;DR: If your RTL8710BX plug sees 14 networks but "Connection failed; ret=-1", check hardware and follow the ESPHome/LibreTiny fixes below. This FAQ covers board mapping, IRQ edits, calibration, and Wi‑Fi recovery for BL0937 power monitoring. [Elektroda, t2004dd, post #21086091]
Why it matters: It helps makers quickly fix power metering and Wi‑Fi issues on low-cost RTL8710BX smart sockets used with ESPHome.
Quick facts:
- Typical street price seen: about €2.50 for an RTL8710BX smart socket during sales. [Elektroda, Raufaser, post #21033002]
- Board mapping tip: t102-v1.1 name may not drive the relay; board: wr2 works with pin P15. [Elektroda, SteIta, post #21014302]
- HLW8012 model BL0937 can bootloop without an IRQ CHANGE workaround in LibreTiny. [Elektroda, so_meone, post #21013707]
- Useful calibration starters: voltage_divider ≈ 531 and current_resistor = 0.001 Ω; adjust to a known load. [Elektroda, SteIta, post #21014302]
- A case with 14 networks found still failed STA; removing a solder short fixed Wi‑Fi. [Elektroda, t2004dd, post #21086091]
Quick Facts
- Typical street price seen: about €2.50 for an RTL8710BX smart socket during sales. [Elektroda, Raufaser, post #21033002]
- Board mapping tip: t102-v1.1 name may not drive the relay; board: wr2 works with pin P15. [Elektroda, SteIta, post #21014302]
- HLW8012 model BL0937 can bootloop without an IRQ CHANGE workaround in LibreTiny. [Elektroda, so_meone, post #21013707]
- Useful calibration starters: voltage_divider ≈ 531 and current_resistor = 0.001 Ω; adjust to a known load. [Elektroda, SteIta, post #21014302]
- A case with 14 networks found still failed STA; removing a solder short fixed Wi‑Fi. [Elektroda, t2004dd, post #21086091]
How do I get BL0937 power monitoring working on RTL8710BX in ESPHome?
Use the hlw8012 sensor with model: BL0937, then address the IRQ CHANGE issue in LibreTiny and calibrate. The workaround stops bootloops caused by the pulse-counter interrupt handling on this platform. After applying it, readings worked, then were tuned via calibration. [Elektroda, so_meone, post #21013707]
How do I apply the LibreTiny IRQ workaround to stop bootloops?
Follow this quick How-To:
- Find wiring_irq.c in your PlatformIO LibreTiny core folder for RTL8710Bx.
- Replace the unsupported CHANGE case with a single-edge (e.g., IRQ_RISE) event.
- Rebuild and flash your ESPHome firmware.
As one note says, "CHANGE interrupts not supported"; using RISE unblocks the driver. [Elektroda, so_meone, post #21015321]
Which ESPHome board should I select so the relay works?
Select board: wr2 for now. The labeled t102-v1.1 target may not drive the relay on P15 due to mapping issues. Using wr2 keeps the relay functional while you set up power monitoring and calibration. [Elektroda, SteIta, post #21014302]
What HLW8012 pin mapping works on the T102_V1.1 plug?
A working map reported: sel_pin: 14 (inverted: true), cf_pin: 0, cf1_pin: 12. Set model: BL0937 on the hlw8012 component. Use an update interval around 10s during testing, then tune as needed. [Elektroda, SteIta, post #21014302]
Does change_mode_every: "never" fix the HLW8012 bootloop?
No. Setting change_mode_every: "never" did not stop the bootloop in this device. The issue comes from unsupported CHANGE interrupts; apply the LibreTiny IRQ workaround instead to stabilize the sensor. [Elektroda, so_meone, post #21013707]
How do I calibrate voltage and current on BL0937?
Start with voltage_divider ≈531 and current_resistor = 0.001 Ω. Use a known resistive load to compare readings, then nudge values until voltage and wattage match. Lower divider lowers voltage. Higher current_resistor lowers wattage. Re-check after warm-up for stability. [Elektroda, SteIta, post #21014302]
Why does Wi‑Fi say "Connection failed; ret=-1" after scanning many networks?
This can be hardware. One board found 14 networks yet failed to connect until a solder ball short on a chip leg was removed. Inspect under magnification, clean bridges, and retry association. "Connection failed; ret=-1" cleared after the fix. [Elektroda, t2004dd, post #21086091]
My MAC may be wiped. How can I restore Wi‑Fi?
Reflash the original stock firmware first to restore the partition holding the MAC. Confirm it associates, then reflash ESPHome. Some routers reject devices with invalid or missing MACs, so restoring it can resolve STA failures. [Elektroda, SteIta, post #21083152]
How do I flash back the original 2MB dump?
It is not OTA or UF2. Flash the full 2MB binary exactly as you did initially, using the same flasher and offsets. After booting stock, verify Wi‑Fi, then proceed with ESPHome again if desired. [Elektroda, SteIta, post #21085028]
The web UI won’t load reliably. Which web_server version should I use?
Use web_server: version 1 on this device. Reports indicate "version 2/3 doesn't work" here, while v1 serves reliably for setup and diagnostics. Switch to v1 if you hit stability issues. [Elektroda, SteIta, post #21014302]
Is MQTT supported on this RTL8710BX build?
A user noted "mqtt: not implement on this board" in their configuration. If you need MQTT, confirm current LibreTiny support or use the ESPHome API until MQTT is available on your target. [Elektroda, SteIta, post #21014302]
How can I track daily, weekly, and monthly energy in ESPHome?
Use the integration sensor on BL0937_Power with multiply 0.001 for kWh. Reset daily, weekly, and monthly via SNTP on_time triggers. This avoids flash wear while giving rolling totals for consumption analysis. [Elektroda, SteIta, post #21014302]
What PlatformIO settings worked for building this plug?
Use platform = libretiny, board = wr2, framework = arduino in your platformio.ini. Pair this with your ESPHome YAML and rebuild after core edits, like the IRQ workaround. [Elektroda, so_meone, post #21013707]
It still bootloops after power loss. Any recovery tips?
Try a two-step flash: first a minimal config, then add HLW8012. Press the Factory Reset button entity, power-cycle, and wait. One report needed 2–4 hours before the device stabilized and came online again. [Elektroda, SteIta, post #21014302]