logo elektroda
logo elektroda
X
logo elektroda

Integrating Atorch DT20HBW with Home Assistant - advice needed.

pexicele 5724 10
Best answers LABEL_AI_GENERATED

How can I integrate an Atorch DT20HBW into Home Assistant, especially to monitor DC-side voltage, current, power, and battery data as a beginner?

Focus on the CB2S Wi‑Fi module first; similar Atorch/TuyaMCU devices are commonly handled by flashing the BK7231T-based module, and you should make a full backup before flashing [#21440152][#21440325] For a practical Home Assistant solution, one user successfully converted three DT20HBW units to ESPHome using `bk72xx` with `board: cb2s`, UART on TX1/RX1 at 115200, and Tuya entities mapped to datapoints for current, power, voltage, battery percentage, temperature, totals, and relay/config controls [#21495594] That YAML also exposes useful settings such as over/under-voltage, over-power, over-temperature, display brightness, refresh interval, and alarm status, so it gives you both monitoring and control in HA [#21495594] If you are flashing hardware, the USB port on the device may only appear as HID; one user reported removing the small Wi‑Fi Tuya module and programming it directly with a serial-to-USB adapter instead [#21629925]
AI summary based on the discussion. May contain errors.
ADVERTISEMENT
  • Identify likely UART pads for Home Assistant integration

    #1 21438964
    pexicele
    Level 4  
    Posts: 7
    Hello
    (my first topic- don't throw rocks)

    I need to integrate one device in Home Assistant, the device name is Atorch DT20HBW:
    https://www.youtube.com/watch?v=VEQWkEoxd1M
    https://www.aliexpress.com/item/1005007168934...ml?spm=a2g0o.cart.0.0.378f4ae4TWJZOA&mp=1

    I was able to identify some of its chips:
    -CB2S
    -RN8209C
    -CH582M

    I see also some available solder connections on the PCB: V / G / D- / D and PB22(?)
    Image of a PCB with visible RN8209C and CH582M chips and solder points.

    Can someone please advise what the best approach will be for a beginner?
    I'm asking since I could not find info for CH582M chip so far...
    (sorry for my English)
    Atorch DT20HBW device displaying battery capacity test with smartphone app.
    AI: Can you provide more details about your current Home Assistant setup, such as the version you are using and any existing integrations?
    I'm using Home Assistant mainly for monitoring my off-grid solar system (4 x growatt 6000es inverters, 75kwh Lifepo4 15s battery (diy), 15kwp solar panels) already integrated in HA: LK3 tinycontroller, 5 x TOMZN 63W AC energy meters, Hyundai heat pump, DIY wireless BMS homemade, etc.
    AI: What specific functionality or outcome are you hoping to achieve by integrating the Atorch DT20HBW with Home Assistant?
    I need to monitor the energy on the DC side (solar panels, battery, Home lights (all of my home lights work on 48V DC).
  • ADVERTISEMENT
  • ADVERTISEMENT
  • Tuya flashing needed for faster DT20HBW updates

    #3 21440310
    pexicele
    Level 4  
    Posts: 7
    Thanks, in fact I just started reading those, I never flashed a tuya chip till now, luckily I have two of these DT20HBW devices.
    At this moment one of them has a new isolated dc-dc attached (18-75v to 5v) and monitors the solar battery using tuya integration, refresh rate makes this solution almost unusable since I had to calculate SOC based on current sensor value.
    From what I see in those tutorials is not that simple for me to identify all sensor data but someone has to do that so wish me luck.
  • Helpful post
    #4 21440325
    divadiow
    Level 38  
    Posts: 5236
    Help: 450
    Rate: 920
    good luck. don't forget to take full backup before flashing :)
  • Helpful post

    Esphome config for three DT20HBW units

    #5 21495594
    f3nix
    Level 11  
    Posts: 3
    Help: 1
    Rate: 2
    Hi.
    I have converted 3 pieces to esphome.

    
    substitutions:
      name: dt20hbw-1
      friendly_name: dt20hbw-1
      device_description: "Monitor and control Atorch DT20HBW"
    
    esphome:
      name: ${name}
      friendly_name: ${friendly_name}
      comment: ${device_description}
      project:
        name: "f3nix.esphome-dt20hbw"
        version: 0.9.2
      platformio_options:
          platform_packages:
          - framework-arduino-api @ https://github.com/f3nix/ArduinoCore-API#ringbuffer-buffer
      build_path: "../config/esphome/${name}_build"
     
    bk72xx:
      board: cb2s
      framework:
        version: latest
        loglevel: debug
    
    # Enable logging
    logger:
      baud_rate: 0
      # level: VERY_VERBOSE
    
    # Enable Home Assistant API
    api:
    
    ota:
      - platform: esphome
    
    wifi:
      ssid: !secret wifi_ssid
      password: !secret wifi_password
    
      # Enable fallback hotspot (captive portal) in case wifi connection fails
      ap:
        ssid: "dt20hbw-1 Fallback Hotspot"
        password: !secret wifi_ap_password
    
    captive_portal:
    
    web_server:
      port: 80
      version: 3
    
    time:
      - platform: homeassistant
        id: homeassistant_time
    
    uart:
      tx_pin: TX1
      rx_pin: RX1
      baud_rate: 115200
      debug:
        direction: BOTH
        dummy_receiver: false
    
    debug:
      update_interval: 30s
    
    # Register the Tuya MCU connection
    tuya:
      id: "tuyadevice"
      time_id: homeassistant_time
    
    text_sensor:
      - platform: debug
        reset_reason:
          name: "Reset Reason"
    
      - platform: libretiny
        version:
          name: "LibreTiny Version"
    
    sensor:
      - platform: uptime
        name: "Uptime"
    
      - platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
        name: "WiFi Signal dB"
        id: wifi_signal_db
        update_interval: 60s
        entity_category: "diagnostic"
    
      - platform: "tuya"
        name: "Current"
        sensor_datapoint: 18
        unit_of_measurement: "A"
        device_class: current
        state_class: measurement
        accuracy_decimals: 3
        filters:
          - multiply: 0.001
    
      - platform: "tuya"
        name: "Power"
        sensor_datapoint: 19
        unit_of_measurement: "W"
        device_class: power
        state_class: measurement
        accuracy_decimals: 2
        filters:
          - multiply: 0.01
    
      - platform: "tuya"
        name: "Voltage"
        sensor_datapoint: 20
        unit_of_measurement: "V"
        device_class: voltage
        state_class: measurement
        accuracy_decimals: 2
        filters:
          - multiply: 0.01
    
      - platform: "tuya"
        name: "Battery percentage"
        sensor_datapoint: 103
        unit_of_measurement: "%"
        device_class: battery
        state_class: measurement
        accuracy_decimals: 1
        filters:
          - multiply: 0.1
    
      - platform: "tuya"
        name: "NTC temperature"
        sensor_datapoint: 122
        unit_of_measurement: "°C"
        device_class: temperature
        state_class: measurement
        accuracy_decimals: 1
        filters:
          - multiply: 0.1
    
      - platform: "tuya"
        name: "CPU temperature"
        sensor_datapoint: 135
        unit_of_measurement: "°C"
        device_class: temperature
        state_class: measurement
        accuracy_decimals: 0
    
      - platform: "tuya"
        name: "Discharge current"
        sensor_datapoint: 111
        unit_of_measurement: "A"
        device_class: current
        state_class: measurement
        accuracy_decimals: 3
        filters:
          - multiply: 0.001
    
      - platform: "tuya"
        name: "Discharge power"
        sensor_datapoint: 112
        unit_of_measurement: "W"
        device_class: power
        state_class: measurement
        accuracy_decimals: 3
        filters:
          - multiply: 0.001
    
      - platform: "tuya"
        name: "Total electricity"
        sensor_datapoint: 123
        unit_of_measurement: "kWh"
        device_class: energy
        state_class: measurement
        accuracy_decimals: 3
        filters:
          - multiply: 0.001
    
      - platform: "tuya"
        name: "Total capacity"
        sensor_datapoint: 133
        unit_of_measurement: "Ah"
        device_class: energy
        state_class: measurement
        accuracy_decimals: 3
        filters:
          - multiply: 0.001
    
      - platform: "tuya"
        name: "Resistance"
        sensor_datapoint: 134
        unit_of_measurement: "Ω"
        state_class: measurement
        accuracy_decimals: 2
        filters:
          - multiply: 0.01
    
    switch:
      - platform: "tuya"
        name: "Real time data refresh switch"
        switch_datapoint: 101
    
      - platform: "tuya"
        name: "Relay switch"
        switch_datapoint: 102
    
      - platform: "tuya"
        name: "Data zero"
        switch_datapoint: 113
        id: data_zero
        on_turn_on:
          - delay: 100ms
          - switch.turn_off: data_zero
    
      - platform: "tuya"
        name: "Wi-Fi device reset"
        switch_datapoint: 114
        id: wifi_reset
        on_turn_on:
          - delay: 100ms
          - switch.turn_off: wifi_reset
    
      - platform: "tuya"
        name: "Factory reset"
        switch_datapoint: 115
        id: factory_reset
        on_turn_on:
          - delay: 100ms
          - switch.turn_off: factory_reset
    
      - platform: "tuya"
        name: "Exit device backend"
        switch_datapoint: 116
        id: backend
        on_turn_on:
          - delay: 100ms
          - switch.turn_off: backend
    
    # button:
    #   - platform: template
    #     name: "Data zero"
    #     on_press:
    #       - lambda: |-
    #           id(tuyadevice).set_boolean_datapoint_value(113, true);
    #           id(tuyadevice).set_boolean_datapoint_value(113, false);
    
    #   - platform: template
    #     name: "Wi-Fi device reset"
    #     on_press:
    #       - lambda: |-
    #           id(tuyadevice).set_boolean_datapoint_value(114, true);
    #           id(tuyadevice).set_boolean_datapoint_value(114, false);
    
    #   - platform: template
    #     name: "Factory reset"
    #     on_press:
    #       - lambda: |-
    #           id(tuyadevice).set_boolean_datapoint_value(115, true);
    #           id(tuyadevice).set_boolean_datapoint_value(115, false);
    
    #   - platform: template
    #     name: "Exit device backend"
    #     on_press:
    #       - lambda: |-
    #           id(tuyadevice).set_boolean_datapoint_value(116, true);
    #           id(tuyadevice).set_boolean_datapoint_value(116, false);
    
    number:
      - platform: tuya
        name: "Display brightness"
        number_datapoint: 108
        min_value: 1
        max_value: 9
        step: 1
        entity_category: config
    
      - platform: tuya
        name: "Standby brightness"
        number_datapoint: 109
        min_value: 0
        max_value: 9
        step: 1
        entity_category: config
    
      - platform: tuya
        number_datapoint: 110
        name: "Standby time"
        unit_of_measurement: "s"
        min_value: 3
        max_value: 99
        step: 1
        mode: box
        entity_category: config
     
      - platform: tuya
        name: "Over voltage protection"
        number_datapoint: 104
        unit_of_measurement: "V"
        min_value: 0.00
        max_value: 420.00
        multiply: 100
        step: 1
        mode: box
        entity_category: config
    
      - platform: tuya
        name: "Over temperature protection"
        number_datapoint: 105
        unit_of_measurement: "°C"
        min_value: 0.1
        max_value: 150.0
        multiply: 10
        step: 1
        mode: box
        entity_category: config
    
      - platform: tuya
        name: "Over power protection"
        number_datapoint: 106
        unit_of_measurement: "W"
        min_value: 1
        max_value: 252000
        step: 1
        mode: box
        entity_category: config
    
      - platform: tuya
        name: "Low voltage protection"
        number_datapoint: 119
        unit_of_measurement: "V"
        min_value: 0.00
        max_value: 420.00
        multiply: 100
        step: 1
        mode: box
        entity_category: config
    
      - platform: tuya
        name: "100% battery voltage"
        number_datapoint: 117
        unit_of_measurement: "V"
        min_value: 0.00
        max_value: 450.00
        multiply: 100
        step: 1
        mode: box
        entity_category: config
    
      - platform: tuya
        name: "0% battery voltage"
        number_datapoint: 120
        unit_of_measurement: "V"
        min_value: 0.00
        max_value: 450.00
        multiply: 100
        step: 1
        mode: box
        entity_category: config
    
      - platform: tuya
        name: "Data refresh interval time"
        number_datapoint: 125
        unit_of_measurement: "s"
        min_value: 1
        max_value: 90
        step: 1
        mode: box
        entity_category: config
    
      - platform: tuya
        name: "Mini measure Amp"
        number_datapoint: 121
        unit_of_measurement: "mA"
        min_value: 2
        max_value: 99
        step: 1
        mode: box
        entity_category: config
    
    select:
      - platform: tuya
        name: "Device language"
        enum_datapoint: 107
        optimistic: true
        options:
          0: "Chinese"
          1: "English"
        entity_category: config
    
      - platform: tuya
        name: "Device interface"
        enum_datapoint: 118
        optimistic: true
        options:
          0: "Front measurement interface"
          1: "Background setting interface"
          2: "Large font interface"
        entity_category: config
    
      - platform: tuya
        name: "Alarm sign"
        enum_datapoint: 132
        optimistic: true
        options:
          0: "off"
          1: "ovp"
          2: "lvp"
          3: "opp"
          4: "otp"
        entity_category: diagnostic
    
      - platform: tuya
        name: "Diverter size"
        enum_datapoint: 136
        optimistic: true
        options:
          0: "30A"
          1: "100A"
          2: "200A"
          3: "300A"
          4: "400A"
          5: "500A"
          6: "600A"
          7: "1000A"
        entity_category: config
    
    .
    Greetings,
    Matthew
  • ADVERTISEMENT
  • #6 21504915
    pexicele
    Level 4  
    Posts: 7
    trillions of thanks Matthew, it is working on my devices !
  • Need USB-to-TTL UART and download mode

    #7 21628994
    markinNZ
    Level 2  
    Posts: 2
    Hi,

    I am new to flashing devices and so sorry if my question is simple. But can you please explain a basic overview of how I can flash ESPHome-dt20hbw to use ESPHome on this device? I have tried connecting the USB port on the device to both my HA server and Windows PC, but it seems to only see a HID device. Is there a way I can get it to load as a COM or ttyUSB port or I am doing it completely wrong and need to get a USB to TTL UART and solder it to the board? Perhaps I'm missing a step to put the board into download mode as using the factory method of holding down "-" button while powering on doesn't change anything.

    Thank you!

    Mark
  • #8 21629925
    pexicele
    Level 4  
    Posts: 7
    Hi Mark

    I had extracted the mini Wi-Fi Tuya module (located in a corner of the motherboard) and I programmed this module via serial-USB adapter (in my case an ESP01 USB programmer -modified)


    Good luck
    Viorel
  • ADVERTISEMENT
  • #9 21643690
    markinNZ
    Level 2  
    Posts: 2
    >>21629925 Thanks for your reply. Aha, it's as I had suspected. Probably more trouble than it's worth for me. But at least I'm not going down a dead-end path. :)
  • Clarifying Home Assistant integration and chipset options

    #10 21701067
    johnhowardlay
    Level 2  
    Posts: 2
    From what I’ve found, the DT20HBW comes with a relay switch add-on and works through Tuya, but it doesn’t seem to have direct support in Home Assistant. Some users mentioned trying TinyTuya for local control, while others went further and flashed it with ESPHome for full integration.
    I’m curious to know:
    Did you manage to get reliable data (voltage, current, power) into Home Assistant?
    Were you able to control the relay locally without relying on the Tuya cloud?
    If you flashed it, what chipset did you encounter (CB2S, RN8209C, CH582M) and what tools did you use?
    Any YAML configs or working examples you can share?
    My main goal is to track battery health, get a construction cost estimate for adding smart monitoring, and automate the relay based on voltage thresholds.

Topic summary

LABEL_AI_GENERATED
Discussion about integrating the Atorch DT20HBW power monitor into Home Assistant. The device was identified as using a CB2S Tuya Wi‑Fi module, RN8209C metering IC, and CH582M, with solder pads for V/G/D-/D and PB22. The recommended approach was to focus on the CB2S and follow methods used for similar TuyaMCU devices, including OpenBK7231T resources. The original poster later reported using Tuya integration with poor refresh rate and then successfully flashing one unit after reading Tuya flashing guides. Another contributor shared an ESPHome configuration for converting multiple DT20HBW units to ESPHome on the CB2S/BK72xx platform, which worked on the devices. Later questions clarified that the USB port only enumerates as HID and that flashing requires extracting the Wi‑Fi module and programming it via a serial-to-USB adapter/UART, rather than using the device’s USB port directly.
AI summary based on the discussion. May contain errors.
ADVERTISEMENT