Detailed guide on how to flash the new Tuya Beken Chips with OpenBK7231T

After couple of tries I successfully flashed smart switch. Initially I had trouble using the flasher referenced by the OP (could not unprotect the flash), but found another tool, very easy to use (windows and linux) for BK7231T and N chips:

I’ve got quite a few of the Deta GridConnect Light Switches that I’ve flashed ESPHome onto as well as some of the power points - but I’ve just bought 1 of the Touchless Handwave Switch 6931HA DETA Grid Connect Smart Touchless Handwave Switch | Deta Electrical I’ve added it to the Tuya app and see it is running firmware 1.0.4, which most of my light switches were. So I have no doubt that I’ll be able to flash it fine, but how does 1 then go and find what pins are being used for the LEDs, the Relay and the touchless handwave sensor (unsure what that is actually called)? Yes I’ve checked the ESP Home Devices page Standard: AU | devices.esphome.io but not found it there.

I bought a Feit smart downlight that has a chip labeled “CBU” in it. I tried connecting RX1, TX1, 3V3, and GND to a USB-Serial adapter, but I was unable to flash OpenBK on it. Does anyone know if this chip is supported or what I need to do to get it to flash?

Start flashing using ltchiptool then connect cen pin to gnd briefly. You might have do to this repeatedly until it’s working

Hi. I tried flashing ESPhome FW to CB3S module with libretiny, but it fails with error “flash protected”. Any help would be appretiated.

Detailed info here:

Can you try flash it with openbeken using BK7231GUIFlashTool

https://www.elektroda.com/rtvforum/topic4058227.html

I ddid not figured out, how to flash ESPhome FW using the OpenBEKEN. I copied the FW image (all variants) into the “firmwares” folder, but the tool just does not accept them as compatible for the BK7231N chip.

Btw the posts also state, that that there is on AP after flashing the Matter devices with OpenBeken FW.

So it looks like you can’t get openbk to boot yet on these bk7231m with matter.

https://www.elektroda.com/rtvforum/viewtopic.php?p=21115403#21115403

I just tried flashing it, and it’s not working as well. I’ve swapped cb3s with esp chip for now

I just installed esphome on a couple of tuya devices with CB3S, worked straight away :rocket:

bk72xx:
  board: generic-bk7231n-qfn32-tuya

Not for this cb3s/cbu with bk7231m(not n, m for matter i guess) it doesn’t boot up with openbeken or libretiny

Matter devices should be avoided (like zigbee, zwave, etc.) if you want to have full control and ownership. You don’t have the right to repair and other things you are used to have when using wifi devices that are supporting (and allowing) to install your own firmware like esphome. :muscle:

If I remember right the matter specs force the lock down of the modules :put_litter_in_its_place:

In case anyone else is following this thread…

Just installed OpenBK on an ANTSG HUBIR01HA Series 2
For the record: board is labeled TYSW_012_ZK_MAIN_V1.1
and uses a CB3S wifi board

To upload it (Icouldnt find my Jaycar FIDI board) I used an arduino MEGA2530 I had laying around, and simply connected the Reset Pin to GND (to lock it from responding). then I connected the TX(0) and RX(0) to a header I soldered directly to the HUBIR012A’s “input output” pads.

Boot with IO0 pulled to ground, and everything esle connected, then simply loaded the OPENBK and set to BK7231N (if you get an error on your first “backup”… this is why)…

Once backed up… installed and BINGO!
Worked!

Hope this helps someone else.
Mike - Melbourne.



2 Likes

DETA 6910HA Single button dimmer switch

This is flashable OTA by cloudCutter
Select firmware 1.1.9 bk7231s_common_iot_config_ty

When finished you will have 4 datapoints
1 = Switch
2 = Dimmer 0-1000
3 = Min Dimmer 0 - 1000 (so when pressing this is the lowest the dimmer will go to)
6 = Countdown timer in seconds to turn off the light ie 600 = 10Min

Yaml:

substitutions:
  name: deta-dimmer-1
  friendly_name: "Deta Dimmer "

esphome:
  name: ${name}
  friendly_name: ${friendly_name}

bk72xx:
  board: wb3s


captive_portal:
       
uart:
  rx_pin: P10
  tx_pin: P11
  baud_rate: 9600

time:
  - platform: homeassistant
    id: homeassistant_time

sensor:
  - platform: uptime
    name: ${name} Uptime

  - platform: wifi_signal
    name: ${name} Wifi Signal
    update_interval: 60s
    
# Register the Tuya MCU connection
tuya:

light:
  - platform: "tuya"
    name: "light"
    # dimmers current value
    dimmer_datapoint: 2
    # dimmer on/off
    switch_datapoint: 1
    #Min that light will dim to
    min_value_datapoint: 6
    min_value: 0
    max_value: 1000
1 Like

Hi everyone,

I was walking past Aldi yesterday, noticed the Casalux Corner Floor Lamp and ended up buying one. I tried using tuya-Cloudcutter, and there’s a device listed as Casalux Corner Lamp under Aldi, but the exploit didn’t work for me. I’m not even sure if it went into slow blink mode, as that didn’t happen, and the tool indicated that the exploit failed.

I have a quick question: Am I right in assuming that tuya has patched their newer modules, making this exploit no longer effective?

I’ve included a few photos of the board. If I need to flash it using a serial adapter, can I use the test points on the PCB without having to desolder the chip?

By the way, the chip is a Lightning LN882HKI.



Any help would be appreciated. Thanks.

I am not sure this model of chip is coveted by libretiny platform. BK723x is covered by that that too specific version of firmwares and not all. Refer here.

Hi, that’s not beken
You can flash with openbeken with this instructions

Hi, please has anyone flashed this switch?
Wifi Switch Module DC7-32V RF Receiver

Here it says here that flash is possible, but it is no more possible to add RC transmitters.
Thank you.

Hey I’ve managed to flash the same “Deta SMART rewireable plug (6930HA Series2)” using tuya-cloudcutter. I used the same firmware: 1.1.8 - BK7231T / oem_bk7231s_rnd_switch

I’m curious how you got ESPHome onto the device or how you uploaded this config to it. I thought this wasn’t an ESP chip?

I’d ideally like to run something like esphomekitdevices (HAA) on it instead to save needing a Home Assistant middleman with the OpenBK7231T firmware.

Any pointers would be greatly appreciated.

I create a device in esphome Download file to pc and
then copy to tuya-convert binary install folder.
Update your device (I think its option 3).
Select device binary and install.

The later versions of esphome can compile these new chips

My config for that device:

# Basic Config
# https://www.bunnings.com.au/deta-smart-plug-base-with-grid-connect_p0098817
substitutions:
  device_name: "deta_smartplug_1"
  name: "Deta Smartplug 1"

esphome:
  name: ${device_name}
  comment: ${name}

bk72xx:
  board: wb2s
  framework:
    version: dev

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
    - ssid: SSID Secondary
      password: Password
  ap:
    ssid: ${device_name}AP
    password: !secret ap_password 

captive_portal:

logger:
  #level: VERBOSE

api:
  encryption:
    key: "Key generated by esphome"
ota:
- platform: esphome
  password: !secret ota-password  

web_server:
  port: 80

time:
  - platform: homeassistant
    id: homeassistant_time

output:
  - platform: libretiny_pwm
    id: blue_led_output
    pin:
      number: P6
      inverted: True

light:
  - platform: monochromatic
    name: ${device_name} Blue LED
    output: blue_led_output
    id: blue_led
    internal: True

sensor:
  - platform: uptime
    name: ${device_name} Uptime

  - platform: wifi_signal
    name: ${device_name} Wifi Signal
    update_interval: 60s

text_sensor:
  - platform: version
    name: ${device_name} ESPhome Version
  - platform: wifi_info
    ip_address:
      name: ${device_name} IP

binary_sensor:
  - platform: gpio
    pin:
      number: P11
      inverted: True
    id: button
    name: ${device_name} Button
    on_press:
      - switch.toggle: relay_template
    internal: True

switch:
  - platform: gpio
    pin: P26
    id: relay

  # tie the led & relay operation together and report status based on relay state
  - platform: template
    name: ${device_name} Relay
    id: relay_template
    lambda: |-
      if (id(relay).state) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - light.turn_on: blue_led
      - switch.turn_on: relay
    turn_off_action:
      - light.turn_off: blue_led
      - switch.turn_off: relay

Is your device creating its own Access Point? If so, just connect to that and upload the binary. As @pencilhead said, libretuya was merged with esphome so very easy to do. If it helps these are my notes from when they were separate projects. You should only have to do steps 2, 3, 4, & 8.

2\ Go +New Device, Continue, enter a name, select BKxx, and select board type.

3\ We now have a basic YAML file. It's highly recommended to always include the web_server
   and captive_portal components - even in your first "empty" upload. "use_address" will
   be used later. For initial config I enter the actual ssid & pword.

# Enable web server
web_server:
  port: 80

# Enable Home Assistant API
api:

ota:
  safe_mode: true

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true
  power_save_mode: none
  manual_ip:
    static_ip: !secret ip_antbms1
    gateway: !secret ip_gateway
    subnet: !secret ip_subnet
    dns1: !secret ip_dns1
  #use_address: 192.168.1.28

  # Enable fallback hotspot in case wifi connection fails
  ap: {} # This spawns an AP with the device name and mac address, no password.
    #ssid: "Power-Switch1 AP"
    #password: "password"

captive_portal:

4\ Save the yaml and close. Using the 3 dots, select Install, Manual download, and select Modern Format.
   This will save the binaries on the RPi.

5\ Connect to the RPi using WinSCP. Navigate to the root and then opt folder. Do a search for *ug.bin and
   then Focus on the result to enter the folder. Drag the required *ug.bin file to the local desktop and rename
   to something meaningful. Navigate back to "/home/janos-pi/tuya-cloudcutter/custom-firmware" and drag the
   bin file into this folder.

6\ SSH into the RPi and navigate to "/home/janos-pi/tuya-cloudcutter".

7\ We first need to cut the device from Tuya cloud using tuya-cloudcutter.
   -execute sudo ./tuya-cloudcutter.sh -s ssid pword -w wlan0
    follow the prompts until completion. Device will now be local.
   -execute sudo ./tuya-cloudcutter.sh -w wlan0 -f esphome.bin (or whatever the bin filename is)
    follow the prompts until completion. Device will now have custom firmware loaded.

8\ If it fails for whatever reason and doesn't connect to local network then it should create its own
   Access Point. Use the phone to connect to this AP and load http://192.168.4.1/. From here your
   can reenter WiFi credentials and/or load new firmware.

9\ If it works then the device will connect to local network and be discovered by ESPHome.