logo elektroda
logo elektroda
X
logo elektroda

[BK7231N/CBU] Flashing ESPHome on EPT Tech TLC2206/TLC2326

john34 2763 13
ADVERTISEMENT
  • #1 21083458
    john34
    Level 3  
    Hello!

    I recently purchased a tank level sensor (EPT Tech TLC2206) that has a Tuya CBU-IPEX board with a BK7231N SoC. I was hoping to flash ESPHome (or something local, other than Tuya) on it, but I'm struggling to get it recognized by any of the flashing tools. The whole board is covered in epoxy, which doesn't make things any easier.

    EPT Tech liquid level sensor set with smartphone app.
    https://www.aliexpress.com/item/1005005940048434.html

    Any help would be appreciated!

    Circuit board of the EPT Tech TLC2206 tank level sensor.



    Edit: Final update, including a TLC2236 flash: https://www.elektroda.com/rtvforum/topic4054399.html#21206092
  • ADVERTISEMENT
  • #2 21083504
    p.kaczmarek2
    Moderator Smart Home
    This is most likely a TuyaMCU device. It wont work if you just flash a new firmware. It requires futher configuration.

    I don't know how to do it in ESPhome and if it's supported or not, but here is my detailed TuyaMCU guide for OBK:
    TuyaMCU flashing, setup and configuration guide - configure dpIDs for Home Assistant
    I can help you with the setup step by step if you decide to take the approach I suggested.
    Helpful post? Buy me a coffee.
  • #3 21085969
    divadiow
    Level 34  
    Keep us posted! This one looks interesting
  • ADVERTISEMENT
  • #4 21086033
    p.kaczmarek2
    Moderator Smart Home
    I can see the extra coating on the board. It's used to secure the PCB against the moisture.
    Helpful post? Buy me a coffee.
  • #6 21109627
    p.kaczmarek2
    Moderator Smart Home
    We don't have that kind of device on forum often.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • Helpful post
    #8 21139441
    piotrszulc1
    Level 9  
    I've got this device and I was able to flash it using cloudcutter.
    It is indeed a tuyamcu device. You can use it in esphome, but currently it is not possible to set the height or alarm levels due to a bug in esphome (until this gets merged: https://github.com/esphome/esphome/pull/7024). I was able to make it work with my custom external component.
    Works nicely so far.
  • #9 21191143
    john34
    Level 3  
    >>21139441

    Do you recall the steps needed to flash it with ESPhome via CloudCutter? If I recall from when I tried originally, it said the device was not exploitable.
  • #10 21191155
    p.kaczmarek2
    Moderator Smart Home
    Many devices are patched now. Here is a list of tutorials showing how to flash Tuya devices:
    https://www.youtube.com/playlist?list=PLzbXEc2ebpH0CZDbczAXT94BuSGrd_GoM
    Look for BK7231 tutorials.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #11 21191171
    john34
    Level 3  
    p.kaczmarek2 wrote:
    Many devices are patched now. Here is a list of tutorials showing how to flash Tuya devices:
    https://www.youtube.com/playlist?list=PLzbXEc2ebpH0CZDbczAXT94BuSGrd_GoM
    Look for BK7231 tutorials.


    Thanks; I should have clarified. I'm not sure which profile to use with cloudcutter as one doesn't seem to exist for this unit specifically.

    Edit: Looks like it now exists. Yay! Will give that a shot and update.

    Added after 1 [hours] 19 [minutes]:

    piotrszulc1 wrote:
    I've got this device and I was able to flash it using cloudcutter.
    It is indeed a tuyamcu device. You can use it in esphome, but currently it is not possible to set the height or alarm levels due to a bug in esphome (until this gets merged: https://github.com/esphome/esphome/pull/7024). I was able to make it work with my custom external component.
    Works nicely so far.


    I was able to get this going as well. Looks like someone added the profile/model information to cloudcutter recently, and it worked.

    Would you mind sharing your YAML for Esphome? I'm not sure I'm interpreting the datapoints correctly, or if there's just an inherent inaccuracy in the reporting (as long as it's consistent is all that matters). Looks like distance is reported in centimetres from datapoint 22 - but I get different results with liquid vs solid.
  • #12 21192328
    piotrszulc1
    Level 9  
    @john34
    My whole yaml consists of many packages, so pasting here only the relevant part.
    Also note that I'm using my external component (uyat) to workaround the missing features in esphome.


    
    
    bk72xx:
      board: cbu
      framework:
        version: 0.0.0
        source: "/libretiny"
    
    logger:
    
    text_sensor:
      - platform: libretiny
        version:
          name: LibreTiny Version
      - platform: template
        id: liquid_state_text
        name: "Liquid state"
    
    uart:
      - id: uyat_uart
        rx_pin: RX1
        tx_pin: TX1
        baud_rate: 9600
    
    uyat:
       time_id: homeassistant_time
       on_datapoint_update:
          - sensor_datapoint: 1
            datapoint_type: enum
            then:
              - lambda: |-
                  if (x == 0) id(liquid_state_text).publish_state("normal");
                  if (x == 1) id(liquid_state_text).publish_state("low");
                  if (x == 2) id(liquid_state_text).publish_state("high");
    
    sensor:
      - platform: "uyat"
        id: liquid_level_number
        name: "Liquid Level"
        unit_of_measurement: "%"
        sensor_datapoint: 22
        filters:
          - throttle_average: 10s
    
      - platform: "uyat"
        id: liquid_depth_number
        name: "Liquid Depth"
        unit_of_measurement: "m"
        accuracy_decimals: 2
        sensor_datapoint: 2
        filters:
          - multiply: 0.01
    
    number:
      - platform: "uyat"
        id: max_set_number
        name: "Alarm at maximum"
        unit_of_measurement: "%"
        min_value: 0
        max_value: 100
        step: 1
        number_datapoint: 7
        datapoint_hidden:
          datapoint_type: int
          init:
            value: 85
    
      - platform: "uyat"
        id: min_set_number
        name: "Alarm at minimum"
        unit_of_measurement: "%"
        min_value: 0
        max_value: 100
        step: 1
        number_datapoint: 8
        datapoint_hidden:
          datapoint_type: int
          init:
            value: 40
    
      - platform: "uyat"
        id: installation_height_number
        name: "Installation Height"
        unit_of_measurement: "m"
        min_value: 0.200
        max_value: 2.500
        step: 0.001
        multiply: 1000
        number_datapoint: 19
        datapoint_hidden:
          datapoint_type: int
          init:
            value: 1.000
    
      - platform: "uyat"
        id: liquid_depth_max_number
        name: "Distance to Max"
        unit_of_measurement: "m"
        min_value: 0.100
        max_value: 2.400
        step: 0.001
        multiply: 1000
        number_datapoint: 21
        datapoint_hidden:
          datapoint_type: int
          init:
            value: 0.100
    
    


    I haven't done many tests and I only use it for a water barell (1m height). So far I've noticed that it shows somewhat valid level until ~50%, then it rarely goes any lower, even though the actual level gets lower. So there definitely is a problem with settings... Will try to fiddle around with these settings some day.
  • #13 21193336
    john34
    Level 3  
    piotrszulc1 wrote:
    @john34
    My whole yaml consists of many packages, so pasting here only the relevant part.
    Also note that I'm using my external component (uyat) to workaround the missing features in esphome.


    
    
    bk72xx:
      board: cbu
      framework:
        version: 0.0.0
        source: "/libretiny"
    
    logger:
    
    text_sensor:
      - platform: libretiny
        version:
          name: LibreTiny Version
      - platform: template
        id: liquid_state_text
        name: "Liquid state"
    
    uart:
      - id: uyat_uart
        rx_pin: RX1
        tx_pin: TX1
        baud_rate: 9600
    
    uyat:
       time_id: homeassistant_time
       on_datapoint_update:
          - sensor_datapoint: 1
            datapoint_type: enum
            then:
              - lambda: |-
                  if (x == 0) id(liquid_state_text).publish_state("normal");
                  if (x == 1) id(liquid_state_text).publish_state("low");
                  if (x == 2) id(liquid_state_text).publish_state("high");
    
    sensor:
      - platform: "uyat"
        id: liquid_level_number
        name: "Liquid Level"
        unit_of_measurement: "%"
        sensor_datapoint: 22
        filters:
          - throttle_average: 10s
    
      - platform: "uyat"
        id: liquid_depth_number
        name: "Liquid Depth"
        unit_of_measurement: "m"
        accuracy_decimals: 2
        sensor_datapoint: 2
        filters:
          - multiply: 0.01
    
    number:
      - platform: "uyat"
        id: max_set_number
        name: "Alarm at maximum"
        unit_of_measurement: "%"
        min_value: 0
        max_value: 100
        step: 1
        number_datapoint: 7
        datapoint_hidden:
          datapoint_type: int
          init:
            value: 85
    
      - platform: "uyat"
        id: min_set_number
        name: "Alarm at minimum"
        unit_of_measurement: "%"
        min_value: 0
        max_value: 100
        step: 1
        number_datapoint: 8
        datapoint_hidden:
          datapoint_type: int
          init:
            value: 40
    
      - platform: "uyat"
        id: installation_height_number
        name: "Installation Height"
        unit_of_measurement: "m"
        min_value: 0.200
        max_value: 2.500
        step: 0.001
        multiply: 1000
        number_datapoint: 19
        datapoint_hidden:
          datapoint_type: int
          init:
            value: 1.000
    
      - platform: "uyat"
        id: liquid_depth_max_number
        name: "Distance to Max"
        unit_of_measurement: "m"
        min_value: 0.100
        max_value: 2.400
        step: 0.001
        multiply: 1000
        number_datapoint: 21
        datapoint_hidden:
          datapoint_type: int
          init:
            value: 0.100
    
    


    I haven't done many tests and I only use it for a water barell (1m height). So far I've noticed that it shows somewhat valid level until ~50%, then it rarely goes any lower, even though the actual level gets lower. So there definitely is a problem with settings... Will try to fiddle around with these settings some day.


    Thanks! Have you noticed any issues with datapoint 22 not updating/being registered after some time? A few times now, after working normally for several hours datapoint 22 stops updating and only 1 and 2 update.

    This is what I'm using now; I'll look into trying uyat.

    
      - platform: "tuya"
        name: "Sump Water Level (Raw)"
        sensor_datapoint: 22
        id: raw_water_level
    
      - platform: template
        name: "Water Level"
        id: water_level
        unit_of_measurement: "%"
        lambda: |-
          int raw_value = id(raw_water_level).state;
          // Convert the raw value to a percentage, where 100 is full and 87 is empty
          return (raw_value - 87) * 100 / 13;
        update_interval: 30s
    
    uart:
      rx_pin: RX1
      tx_pin: TX1
      baud_rate: 9600
    
    tuya:
  • #14 21206092
    john34
    Level 3  
    Everything's been working well with the first unit, so I opted to order a 2nd one as well. Unfortunately, the seller on AliExpress swapped the listings around and I didn't catch it (used the Buy it again option, but the item had been changed at the same link) and they shipped a TLC2326. The TLC2326 has a slightly different (better, IMO) form factor, and more importantly has a patched firmware (2.1.17) and can't be exploited with tuya-cloudcutter.

    After bashing my head against a while trying to extract the firmware and re-flash with ltchiptool, I found a post saying they couldn't re-flash while the Tuya MCU was still connected. Indeed, that was my issue as well.

    For anyone finding this by Google, trying to load ESPHome onto a TLC2326, best I can tell you'll need to use a hot air rework and remove the IBU entirely, flash with ltchiptool, and then resolder to the PCB. The rework was great at removing the potting. Heat it up, pierce with tweezers and it'll pull off the board cleanly in chunks.

    This was a bit fiddly, but it did work and everything is working as expected using the same ESPHome YAML config as the TLC2206. Logs show an error on boot on the Tuya component (Initialization failed at init_state), but the data is being reported properly so not sure what that's about.

Topic summary

The discussion revolves around flashing ESPHome on the EPT Tech TLC2206 and TLC2326 tank level sensors, which utilize a Tuya CBU-IPEX board with a BK7231N SoC. Users face challenges due to the epoxy coating on the boards and the devices being classified as TuyaMCU, requiring specific configurations for successful flashing. One user successfully flashed their device using CloudCutter, although they noted limitations in setting height and alarm levels due to a bug in ESPHome. Another user encountered difficulties with the TLC2326 model, which has a patched firmware that prevents exploitation with CloudCutter, suggesting the need for physical modifications to the board for flashing. Various YAML configurations for ESPHome were shared, highlighting the use of external components to work around missing features.
Summary generated by the language model.
ADVERTISEMENT