logo elektroda
logo elektroda
X
logo elektroda

[RTL8710BX] [T102_V1.1] [BL0937] Getting power monitoring to work

so_meone 4791 15
ADVERTISEMENT
  • #1 21013707
    so_meone
    Level 2  
    Posts: 3
    espHome profile and documentation here https://devices.esphome.io/devices/Digitaling-20A-Power-Monitor-RTL8710BX-t102-v1.1

    Old post below:

    I have some of these plugs https://www.elektroda.com/rtvforum/topic4032920.html that I would like to use.
    So far I have managed to get espHome to work and switch the leds/relays. However, I have not been able to get the power monitoring (via the BL0937) to work.

    Using the hlw8012 (https://esphome.io/components/sensor/hlw8012.html) sensor in ha results in a boot loop.

    To get the relay to work, I had to use board: wr2 instead of t102-v1.1.
    Both issues are mentioned here. https://github.com/libretiny-eu/libretiny/issues/247

    As also mentioned in that post, the hlw8012 driver causes the device to boot loop because of some irq CHANGE problem. Setting change_mode_every: "never" does not solve this.

    My yaml: https://pastebin.com/B8LEbxge
    platformio.ini definition:
    [env]
    platform = libretiny
    board = wr2
    framework = arduino

    I would appreciate any hints on how to get the BL0937 to work on the RTL8710BX.

    Added after 31 [minutes]:

    https://github.com/libretiny-eu/libretiny/issues/155#issuecomment-1826470433

    This fixes the issue. Its working now.
    (Still getting wrong values but thats probably a calibration issue.)

    Heres my findings and working config for espHome
    https://deploy-preview-670--esphome-devices.n...italing-20A-Power-Monitor-RTL8710BX-t102-v1.1
  • ADVERTISEMENT
  • #2 21014302
    SteIta
    Level 6  
    Posts: 8
    Rate: 1
    I have it with Esphome.
    Unfortunately the platform is still hard, every now and then it goes into bootloop, when the power is removed, you have to make it do one or two bootloop cycles, unplug and reattach, then after a few more cycles it comes back online.

    
    ################             PART 1   for flashing                                     ############################
    #                             calibration is not perfect                        #
    substitutions:
      devicename: plug-meter-2 #change 
      deviceID: plug_meter_2 #change 
      restore_mode: RESTORE_DEFAULT_ON  # mode for when power is turned on
      wifi_update_interval: "60s"       # how often to report wifi signal strength
      hlw8012_voltage_divider:  "531"   # LOWER VALUE GIVES LOWER VOLTAGE old value 533
      hlw8012_current_resistor:  "0.001" # HIGHER VALUE GIVES LOWER WATTAGE 
      current_multiply: "1.0"
    
    esphome:
      name: $devicename
      friendly_name: $deviceID
    
    rtl87xx:
      board: wr2 # not correct but working relay P15
      #board: t102-v1.1 # true name but the relay P15 not working (bug?)
      #board: generic-rtl8710bn-2mb-788k #used for testing
    
    # Enable logging
    logger:
      #level: VERY_VERBOSE
      
    # Enable Home Assistant API
    api:
      encryption:
        key: "Put your"
    
    ota:
      password: "Put your"
    
    wifi: 
      #fixed ip doesn't work ?
      ssid: !secret wifi_ssid
      password: !secret wifi_password
      power_save_mode: LIGHT
      use_address: Put your
      fast_connect: True
    
      # Enable fallback hotspot (captive portal) in case wifi connection fails
      ap:
        ssid: "Put your"
        password: "Put your"
    
    captive_portal:
    
    web_server:
      version: 1 # version 2/3 doesn't work
    
    #mqtt: # not implement on this board
    #  broker: !secret mqtt_broker
    #  username: !secret mqtt_username 
    #  password: !secret mqtt_password
    
    
    
    debug:
      update_interval: 30s
    
    text_sensor:
      - platform: debug
        reset_reason:
          name: Reset Reason
      - platform: libretiny
        version:
          name: LibreTiny Version
      - platform: wifi_info
        ip_address:
          name: IP Address
        ssid:
          name: SSID
        bssid:
          name: BSSID
        mac_address:
          name: MAC Address
        scan_results:
          name: Scan Results
    
    button:
      - platform: factory_reset
        entity_category: DIAGNOSTIC
        icon: mdi:lock-reset
        name: "Restart with Factory Default Settings"
        id: Reset
    
      - platform: safe_mode
        entity_category: DIAGNOSTIC
        icon: mdi:restart-alert
        name: "Safe Mode"
        internal: false
    
    binary_sensor:      
      - platform: gpio
        pin: P18
        name: $devicename button
        id:   ${deviceID}_button
        device_class: window
        # when button is pressed, toggle the switch on/off
        on_press:
          then:
            - switch.toggle: ${deviceID}_relay  # toggle the relay / switch
        internal: True
    
    
    light:              
      - platform: status_led
        entity_category: DIAGNOSTIC
        name: $devicename Switch state Led Blue
        id:   ${deviceID}_led
        pin:
          number: P5
          inverted: true
        restore_mode: $restore_mode 
        #internal: True
    
    switch:        
      - platform: gpio
        pin: P15
        icon: mdi:power-socket-eu
        name: $devicename relay
        id:   ${deviceID}_relay
        restore_mode: $restore_mode   # default when power is turned on
        # synchronise the LED with the relay
        on_turn_on:
          then:
            - light.turn_on: ${deviceID}_led
        on_turn_off:
          then:
            - light.turn_off: ${deviceID}_led
      - platform: restart
        #entity_category: DIAGNOSTIC
        name: $devicename Restart
    
    sensor:
      - platform: wifi_signal         # report wi-fi signal strength from this end
        name: $devicename WiFi Signal
        id:   ${deviceID}_wifi_signal
        update_interval: 120s    # how often to report wifi signal strength 
      - platform: uptime
        name: Uptime
        device_class: "duration"
        unit_of_measurement: s
        accuracy_decimals: 0
        update_interval: 120s
    ################             PART 2   for flashing                                     ############################
    # part 2 add this part after flashing the first part,
    #1 Flash part 2
    #2 Press "Restart with Factory Default Settings"
    #3 powercicle,some time you have to wait 2 to 4 hours to get it back online and working
      - platform: hlw8012
        model: BL0937
        sel_pin:   # returns Voltage and Current periodically
          number: 14
          inverted: true
        cf_pin: 0
        cf1_pin: 12
        current: # wait for expose in HomeAssitant on reboot!
          name: $devicename Current
          id: "Current"
          accuracy_decimals: 3
          filters:
            - multiply: ${current_multiply}
        voltage:
          name: $devicename Voltage
          id: "Volt"
        power:
          name: $devicename Power
          id: BL0937_Power 
          accuracy_decimals: 2
        update_interval: 10s
        voltage_divider:  $hlw8012_voltage_divider    
        current_resistor: $hlw8012_current_resistor 
        
    # config 1
    #  - platform: total_daily_energy
    #    name: $devicename Total Daily Energy
    #    power_id: BL0937_Power
    #    unit_of_measurement: 'kWh'
    #    state_class: total_increasing
    #    icon: mdi:lightning-bolt-circle
    #    device_class: energy
    #    accuracy_decimals: 3
    #    filters:
          # Multiplication factor from W to kW is 0.001
    #      - multiply: 0.001  
    
    # config 2
      - platform: integration
        name: "Daily Consumption"
        id: "total_energy_day" 
        sensor: BL0937_Power
        time_unit: h
        device_class: "energy"
        state_class: "total_increasing"
        icon: mdi:lightning-bolt-circle
        unit_of_measurement: kWh
        accuracy_decimals: 3
        restore: false #If true, save the reading to the flash memory to prevent data loss in case of power loss
        filters:
          - multiply: 0.001
      - platform: integration
        name: "Weekly Consumption"
        id: "total_energy_week"
        sensor: BL0937_Power
        time_unit: h
        device_class: "energy"
        state_class: "total_increasing"
        icon: mdi:lightning-bolt-circle
        unit_of_measurement: kWh
        accuracy_decimals: 3
        restore: false #If true, save the reading to the flash memory to prevent data loss in case of power loss
        filters:
          - multiply: 0.001
      - platform: integration
        name: "Monthly Consumption"
        id: "total_energy_month"
        sensor: BL0937_Power
        time_unit: h
        device_class: "energy"
        state_class: "total_increasing"
        icon: mdi:lightning-bolt-circle
        unit_of_measurement: kWh
        accuracy_decimals: 3
        restore: false #If true, save the reading to the flash memory to prevent data loss in case of power loss
        filters:
          - multiply: 0.001 
    
      - platform: template
        name: $devicename Power Factor
        lambda: |-
          return id(BL0937_Power).state / (id(Volt).state * id(Current).state);
        update_interval: 5s
        accuracy_decimals: 2
        unit_of_measurement: "CosPhi"
        icon: "mdi:angle-acute"
        filters:
          - or:
            - throttle: 60s
            - delta: 3.0
      - platform: template
        name: $devicename Apparent Power
        lambda: |-
          return id(Volt).state * id(Current).state;
        update_interval: 5s
        accuracy_decimals: 1
        unit_of_measurement: "VA"
        icon: "mdi:speedometer"
        filters:
          - or:
            - throttle: 60s
            - delta: 3.0
    
    time:
      - platform: sntp
        id: sntp_time
        timezone: Europe/Rome #change
        servers:
         - 0.pool.ntp.org
         - 1.pool.ntp.org
         - 2.pool.ntp.org
        on_time:
          # Every Month at specified day
          - seconds: 0
            minutes: 0
            hours: 0
            days_of_month: 1
            then:
              - sensor.integration.reset: total_energy_month #Reset power integrator
          # Every Week at specified day
          - seconds: 0
            minutes: 0
            hours: 0
            days_of_week: MON
            then:
              - sensor.integration.reset: total_energy_week #Reset power integrator
          # Every Day at specified hour
          - seconds: 0
            minutes: 0
            hours: 0
            then:
              - sensor.integration.reset: total_energy_day #Reset power integrator 
    #  - platform: homeassistant
    #    id: homeassistant_time
    
  • #4 21015085
    SteIta
    Level 6  
    Posts: 8
    Rate: 1

    I haven't figured out how to implement it, do I need to recompile libretiny?
  • ADVERTISEMENT
  • #5 21015321
    so_meone
    Level 2  
    Posts: 3
    Just find the file wiring_irq.c and modify it.
    It should be in "%userprofile%\.platformio\platforms\libretiny@1.4.1\cores\realtek-amb\arduino\src\wiring_irq.c" (or something similar depending on os and version of libretiny used)
    Theres a #if block which throws the error at line 64.
    Editing it to use IRQ_RISE(or FALL) instead of failing works around this problem with pulse_counter, it will probably change the returned pulse count as well but this is handled by the calibration.

    Before:
    #if LT_RTL8720C
    			event = IRQ_FALL_RISE;
    #else
    			LT_W("CHANGE interrupts not supported");
    #endif


    After:
    #if LT_RTL8720C
    			event = IRQ_FALL_RISE;
    #else
    			event = IRQ_RISE; //hack
    #endif
  • #6 21016145
    SteIta
    Level 6  
    Posts: 8
    Rate: 1
    Ok, i changed the file, but i'm not able to using PlatformIO, Then I'll try in a few days.
    You've looked at my yalm, it works pretty well.
    User interface displaying data for device plug_meter_2, including energy consumption, automations, and events.
  • ADVERTISEMENT
  • #7 21033002
    Raufaser
    Level 10  
    Posts: 47
    Help: 3
    Rate: 14

    Hi.

    I order this RTL8710BX smart socket for 2,50€ in sale a few days ago and it arrived today. I was surprised, that it has this rather exotic chip. So I am in for some testing. And hopefully OpenBeken development for this chip will continue someday :)

    [RTL8710BX] [T102_V1.1] [BL0937] Getting power monitoring to work [RTL8710BX] [T102_V1.1] [BL0937] Getting power monitoring to work [RTL8710BX] [T102_V1.1] [BL0937] Getting power monitoring to work
  • #8 21082804
    t2004dd
    Level 5  
    Posts: 11
    Rate: 8

    >>21015008
    Hi!
    I have T102-V1.1 with RTL8710BX chip. According ESPHome boards list T102-V1.1 has RTL8710BN chip. BX clocked at 62.5 MHz (instead of 125 MHz for BN). I think this is important or?
    I don't know, if this is reason, but board can not connect to WIFI.
    [I][wifi:303]: WiFi Connecting to 'ov593'...
    E [33.201] WIFI: Connection failed; ret=-1
    [W][wifilt:117]: esp_wifi_connect failed! 4
    [E][wifi:349]: wifi_sta_connect failed!
    [W][wifi_lt:286]: Event: Disconnected ssid='' bssid=00:00:00:00:00:00 reason='Unspecified'
    Do you have any idea?
  • #9 21083152
    SteIta
    Level 6  
    Posts: 8
    Rate: 1

    It would seem to be a problem of MAC address, wrapped with flash, this is deleted. I also find it when I switch from ESPHome to OpenBeken, with other devices. You should try reflashing the original firmware, rebooting to see if it connects, and reflashing ESPHome.
  • #10 21084393
    t2004dd
    Level 5  
    Posts: 11
    Rate: 8

    Do you mean re-flash back original FW and find MAC address in it?
    In ESPHome FW I have:
    [21:18:51][C][wifi:038]: Setting up WiFi...
    [21:18:51][C][wifi:051]: Starting WiFi...
    [21:18:51][C][wifi:052]:   Local MAC: D8:D6:68:AA:C0:17

    Btw, AP is working and I can connect to it from PC and open WEB site vers. 1 by 192.168.4.1.
  • #11 21084641
    SteIta
    Level 6  
    Posts: 8
    Rate: 1

    Yes, because sometimes it happens that the partition with the MAC address is deleted, and then the router rejects the connection.
    It would appear that your MAC is intact.
    In some of my devices, it happened instead that on ESPHome I put an address but the router assigned another one.
    You could also try restarting the router, or not configuring any address on ESPHome, and having it assigned by the router.
  • #12 21084715
    t2004dd
    Level 5  
    Posts: 11
    Rate: 8

    I read the original FW, but it is 2MB, just the size of the external flash memory. I don't know how to write it back. Could you please give me some tips? Seems it is not OTA or UF2 format and just binary image of the memory or ltchiptool is working with full dumps too ?
  • #13 21085028
    SteIta
    Level 6  
    Posts: 8
    Rate: 1

    No ota, no uf2.
    The bin file is exactly, You can flash it like you did the first time:
    Screenshot of ltchiptool software for firmware flashing.
  • ADVERTISEMENT
  • #14 21085092
    t2004dd
    Level 5  
    Posts: 11
    Rate: 8
    1) I flashed back original FW. See log attached. Found in WIFI list AP and managed connect to it.
    2) Flashed again ESPHome with YAML described in this topic. The same result, I can not connect to WIFI and boards reloads non stop.
    
    [I][wifi:303]: WiFi Connecting to 'ov593'...
    E [     32.873] WIFI: Connection failed; ret=-1
    [W][wifi_lt:117]: esp_wifi_connect failed! 4
    [E][wifi:349]: wifi_sta_connect_ failed!
    [W][wifi_lt:286][wifievent]: Event: Disconnected ssid='' bssid=00:00:00:00:00:00 reason='Unspecified'
    [D][hlw8012:076]: Got power=0.0W, current=0.0A
    [D][sensor:093]: 'Current': Sending state 0.00000 A with 2 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    [D][hlw8012:076]: Got power=0.0W, current=0.0A
    [D][sensor:093]: 'Current': Sending state 0.00000 A with 2 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    [D][hlw8012:076]: Got power=0.0W, current=0.0A
    [D][sensor:093]: 'Current': Sending state 0.00000 A with 2 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    [D][hlw8012:082]: Got power=0.0W, voltage=0.0V
    [D][sensor:093]: 'Voltage': Sending state 0.00000 V with 1 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    [I][wifi:303]: WiFi Connecting to 'ov593'...
    E [     42.408] WIFI: Connection failed; ret=-1
    [W][wifi_lt:117]: esp_wifi_connect failed! 4
    [E][wifi:349]: wifi_sta_connect_ failed!
    [W][wifi_lt:286][wifievent]: Event: Disconnected ssid='' bssid=00:00:00:00:00:00 reason='Unspecified'
    [D][hlw8012:082]: Got power=0.0W, voltage=0.0V
    [D][sensor:093]: 'Voltage': Sending state 0.00000 V with 1 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    [D][hlw8012:082]: Got power=0.0W, voltage=0.0V
    [D][sensor:093]: 'Voltage': Sending state 0.00000 V with 1 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    [D][hlw8012:082]: Got power=0.0W, voltage=0.0V
    [D][sensor:093]: 'Voltage': Sending state 0.00000 V with 1 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    [D][hlw8012:082]: Got power=0.0W, voltage=0.0V
    [D][sensor:093]: 'Voltage': Sending state 0.00000 V with 1 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    [D][hlw8012:082]: Got power=0.0W, voltage=0.0V
    [D][sensor:093]: 'Voltage': Sending state 0.00000 V with 1 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    [I][wifi:303]: WiFi Connecting to 'ov593'...
    E [     51.941] WIFI: Connection failed; ret=-1
    [W][wifi_lt:117]: esp_wifi_connect failed! 4
    [E][wifi:349]: wifi_sta_connect_ failed!
    [W][wifi_lt:286][wifievent]: Event: Disconnected ssid='' bssid=00:00:00:00
    LwIP_DHCP: dhcp stop.
    Deinitializing WIFI ...:00:00 reason='Unspecified'
    
    WIFI deinitialized[W][wifi_lt:286][wifievent]: Event: Disconnected ssid='' bssid=00:00:00:00:00:00 reason='Unspecified'
    [D][hlw8012:082]: Got power=0.0W, voltage=0.0V
    [D][sensor:093]: 'Voltage': Sending state 0.00000 V with 1 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    [D][sensor:093]: 'Power': Sending state 0.00000 W with 1 decimals of accuracy
    [D][sensor:093]: 'Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
    
    
    
    Attachments:
    • RTL81xx_orig.txt (9.49 KB) You must be logged in to download this attachment.
  • #15 21085309
    SteIta
    Level 6  
    Posts: 8
    Rate: 1

    You have to double-check everything from the beginning, even the most trivial things.
    Have you reassembled the socket? (I have a couple of plugs with different chips and one of them only connected after I reassembled it, I don't remember if it was this chip).
    Try separating and networking on your 2.4/5 GHz router.
    Double-check your password and network name.
    Try editing esphome yaml as well:
    
    wifi: 
      ssid: !secret wifi_ssid  # your
      password: !secret wifi_password  # your
      power_save_mode: LIGHT
      use_address: 192.168.43.100 # assigned by your router
      fast_connect: True
    web_server:
      version: 3 # or 1 or 2
    mdns:
    text_sensor:
    # if You can log in on the web server you can see if you have the Mac
      - platform: debug
        reset_reason:
          name: Reset Reason
      - platform: libretiny
        version:
          name: LibreTiny Version
      - platform: wifi_info
        ip_address:
          name: IP Address
        ssid:
          name: SSID
        bssid:
          name: BSSID
        mac_address:
          name: MAC Address
        scan_results:
          name: Scan Results

  • #16 21086091
    t2004dd
    Level 5  
    Posts: 11
    Rate: 8
    LibreTiny has example PinScan with WIFI connection. I flashed it and I have the same bad result.

    WIFI initialized
    I [      0.264] WIFI: Starting WiFi scan
    I [      0.270] WIFI: Waiting for results
    I [      1.573] WIFI: Scan finished
    I [      1.577] WIFI: 14 networks found
    I [      1.581] WIFI: Connecting to BSSID: 60:E3:27:4F:D4:1B SSID: ov593 Channel: 13 (-52)
    I [      1.589] WIFI: Connecting to ov593 (bssid=0x10016938)
    E [      8.943] WIFI: Connection failed; ret=-1
    E [     18.957] WIFI: Connecting failed (6)
    WiFi connection failed, retrying in 5s
    



    Added after 1 [hours] 10 [minutes]:

    We can close my issue. I examined the board under a microscope and found a ball of solder on one of the chip legs. I removed it and everything worked. Thanks for your help.

Topic summary

✨ The discussion revolves around the challenges faced in implementing power monitoring on the RTL8710BX-based T102_V1.1 smart plug using ESPHome and the BL0937 sensor. Users report issues with boot loops when using the hlw8012 sensor, attributed to IRQ CHANGE problems. Workarounds include modifying the wiring_irq.c file to change interrupt handling. Some users successfully managed to connect to WiFi after reflashing the original firmware and troubleshooting hardware connections. The conversation also touches on the differences between RTL8710BX and RTL8710BN chips, and the importance of ensuring the MAC address is intact for WiFi connectivity.
Generated by the language model.

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:

Quick Facts

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:
  1. Find wiring_irq.c in your PlatformIO LibreTiny core folder for RTL8710Bx.
  2. Replace the unsupported CHANGE case with a single-edge (e.g., IRQ_RISE) event.
  3. 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]
Generated by the language model.
ADVERTISEMENT