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

Hello! I have a 1 gang wall switch with wbr3 chip, I want to flash it with openbk, but it has rf switch functionality, is there any way this can work with openbk?

Wbr3 is rtl8720c, not supported in openbk and libretiny is in the works.
You could do an esp swap. rf is usually not tied to the chip and would still work as normal.

By the way, you didnā€™t flash with the uf2 file with ltchiptool but using rtltool.py to flash these binaries?

python2 ./rtltool2.py -p /dev/ttyUSB0 wf 0xb000 image_0x00B000.ota1.bin
python2 ./rtltool2.py -p /dev/ttyUSB0 wf 0x80000 image_0x080000.ota2.bin

This was how you avoided this error?

E: ValueError: Failed to write to 0x800B000

OK, I have just upgraded to ESPHome 23.9.1 and copied the yaml files for my Casa downlights to the ESPHome addon from the old Libretiny one.

The code is mostly the same as this post with the only change being to replace ledc with libretiny_pwm as is required with the merged version. The firmware compiled and uploaded without an error but it is now offline.

The light is sort of working as on power on it starts up at the brightness and colour temperature I have in the on_boot section of the code but it is offline and but I have no wifi so no logs.

Edit:

Had another look at this tonight and found that there was a fallback hotspot I could use to re-enter the wifi password and it came back to life. Maybe it is a libretiny thing but there is no AP stuff in the code.

Same thing had to be done with the second light I updated.

Could really use some help here everyone.

Followed the instruction to the flashing part but cannot get it to flash. Really not sure whats going on. Any ideas? Have tried lowering bitrate but nothing. Just says Initā€¦failed

Are you successful with other devices?
Sometime you need to keep grounding the cen pin as until flashing starts
or it could be that tx/rx is connected to mcu on the pcb that prevents flashing

I havenā€™t tried other devices yet. Ive tried grounding the cen pin a few times during the initial 15 seconds but the tx light on my serial adaptor turns off. Not sure if thats a good thing.
How can i tell if rx/tx is connected to mcu?

Can you post your device here? any pcb pics

It is the DETA 6922HA-Series 2 Double Power Wall outlet, the exact same as at the very beginning of this thread. Iā€™ve packed it all up for now so Iā€™ll have to try and get some photos next time I try.

Iā€™ve converted Deta SMART rewireable plug ( 6930HA Series2) to esphome using tuya-convert (OTA).
This has WB2S chip
Firmware version is 1.1.8.

In tuya-convert select:

By firmware version and name
1.1.8 - BK7231T / oem_bk7231s_rnd_switch
Aoycocr
X5P Smart Plug

# 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} Hotspot
    password: "ESPNotHome"

captive_portal:

logger:
  #level: VERBOSE

api:
  encryption:
    key: "Encryption key from ESPHOME"
ota:

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
1 Like

Bit late. I did Deta single powerpoint with power monitoring. It looks like the power monitoring chip is connected to the RX pin. I couldnā€™t flash while it was connected.
Removed chip and flashed while out of circuit without problems.



I am trying to flash a BK7621n tuya chip using CH340 serial adapter but end up with error.
how to fix it?

Just asking for a friend, what open source project do you find supporting the chip you reference? The title of this thread is about the OpenBK7231T project. And I donā€™t find any reference to this chip in that github.

I was trying to flash ESphome, and got it working in the end. Used OpenBeken GUI tool to flash OpenBeken to fix the CRC error before flashing Esphome.

1 Like

Hello Sir,
I have managed to flash my tuya 4 gang switch with OpenbK , get it to work with home assistant through mqtt.
however, i face a problem. whenever after a power failure, my 4gang switch is not connected to home assistant through mqtt. I have to login to web interface configuration and press on ā€œhome assistant discoveryā€ for it to connect again.

May i know if there is an automated method for above condition after power failure recovery.

I am trying to put ESPhome on a Tuya curtain switch

https://www.amazon.com/BSEED-Shutter-Compatible-Control-Required/dp/B09V4RPH9W/ref=sr_1_2?keywords=bseed+curtain&qid=1707571970&sr=8-2

I was able to do the cloudcutter etcā€¦
the generated YAML fom the ITchiptool is not correct
Has any body used this switch and has the correct YAML?
if not what is a suggested switch that has an easy esphome setup?
thank you

Well after several hours of trying to flash I finally did it (CB2S).

The very unfortunate think is, that the initial setup page does not workā€¦ I can connect to the device, but when I go to 192.168.4.1 i get no response.

Is there a way to reflash an older FW? I isntalled OpenBK7231N_QIO_1.17.459.bin

hi, I donā€™t find the right command to reset to default with esphome.
I tried this without succes.

button:
  - platform: factory_reset
    name: Restart with Factory Default Settings

log

15:50:45	[D]	[lt.preferences:104]	Saving 1 preferences to flash...
15:50:45	[D]	[lt.preferences:132]	Saving 1 preferences to flash: 0 cached, 0 written, 1 failed
15:50:45	[E]	[lt.preferences:135]	Error saving 1 preferences to flash. Last error=8 for key=233825507

What do you want to do? :thinking:

Explained here what it should do: :point_down:

The factory_reset button allows you to remotely invalidate (reset) all ESPHome preferences stored in flash memory and reboot your node. After reboot all states, parameters and variables will be reinitialized with their default values. This is useful:

  • for devices preflashed with ESPHome to reset behavior back to factory state
  • in case of moving a device to a new environment or starting a new use-case (e.g. reset counters or state)
  • for privacy concerns when giving away a device

The command on platform bk7231x donā€™t work!

did you read the log I posted?