logo elektroda
logo elektroda
X
logo elektroda

[BK7231N CBU] Tuya WiFi Temperature and Humidity Sensor (Blue PCB, no TuyaMCU)

dmcbeing 
I recently bought a few of 'Tuya WiFi Temperature and Humidity Sensor'.

I looked for an existing thread for this exact device but only found a few users posting pictures of this board.

Here is a picture of the PCB: PCB board of Tuya WiFi sensor with highlighted components and connections.

And here is the firmware from an unused device:

Tuya JSON:
Code: JSON
Log in, to see the code

It does not have a TuyaMCU and is using I2C to communicate with the Temp+Humidity sensor CHT8305.

This device requires deep sleep to run on batteries longer than few days.
Please see related topics for details:
https://www.elektroda.com/rtvforum/topic4025593.html
https://www.elektroda.com/rtvforum/topic3945688.html
https://www.elektroda.com/rtvforum/find.php?q=CHT8305

I have flashed esphome and aside from I2C, and deep-sleep, everything else works.

esphome:
  name: upk2esphome-bk7231n

bk72xx:
  board: cbu

logger:
  baud_rate: 0

# tuya:

web_server:

captive_portal:

mdns:

external_components:
  - source: /soft_i2c

#api:
#  password: ""
#  reboot_timeout: 0s

ota:
  password: ""

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  use_address: 192.168.1.32
  fast_connect: true
  ap:

mqtt:
  broker: mqtt.hlab.host

button:
  - platform: restart
    name: Restart

debug:
  update_interval: 30s

text_sensor:
  - platform: debug
    reset_reason:
      name: Reset Reason
  - platform: libretiny
    version:
      name: LibreTiny Version
sensor:
  - platform: uptime
    name: Uptime
    update_interval: 15s
    id: uptime_sensor
  - platform: adc
    pin: P23
    name: "Battery Level"
    update_interval: 15s
    on_value:
      then:
        - mqtt.publish_json:
            topic: temp_sensor
            payload: |-
              root["batt"] = x;
              root["uptime"] = id(uptime_sensor).state;
              root["alert"] = id(alert).state;

uart:
  rx_pin: RX1
  tx_pin: TX1
  baud_rate: 115200

light:
  - platform: binary
    name: "Status"
    output: status_output

output:
  - id: status_output
    platform: gpio
    pin: P16

binary_sensor:
  - platform: gpio
    pin: 
      number: P14
      inverted: true
    name: "Button"
  - platform: gpio
    id: alert
    pin: 
      number: P7
      inverted: true
    name: "Alert"


I hope this information is sufficient to 'port'/support openbeken for this device.

Let me know if i can help any other way.

About Author
dmcbeing wrote 5 posts with rating 3 . Been with us since 2024 year.

Comments

p.kaczmarek2 13 Jan 2024 08:57

I will edit your first post to add more information, but first of all, your current config is incorrect . You can't just: This device must have deep sleep, otherwise it will drain batteries really,... [Read more]

johnypean 13 Jan 2024 21:03

I have it working quite well. I have gathered information from multiple threads about these sensors here. Even the battery is working and showing up in HASS. "pins": { "8": "BAT_Relay;0", "14":... [Read more]

dmcbeing 16 Jan 2024 23:45

Thanks for the replies @p.kaczmarek2 and @johnypean. I got stuck at flashing as the GUIFlashTool would not work in Linux ... it would freeze when writing the first page after erasing all flash blocks. Installing... [Read more]

p.kaczmarek2 16 Jan 2024 23:47

Are the device configs the same? Is the device hardware the same for both devices? [Read more]

dmcbeing 17 Jan 2024 00:31

Yes, I copied and pasted all settings and autoexec.bat from the first device I flashed that reports correct values. [Read more]

dmcbeing 19 Jan 2024 22:00

I played a bit with the sensors in the previous days and redid my configuration, and now all sensors return valid readings. I also started playing with the deepsleep as @p.kaczmarek2 recommended. However... [Read more]

johnypean 22 Jan 2024 14:18

If you activated Flag 36 - "[DRV] Deactivate Autostart of all drivers", you have to add startDriver Battery to autoexec.bat Had the same happen. [Read more]

dmcbeing 23 Jan 2024 21:39

@johnypean Nope, i don't have that enabled I have the following enabled: Flag 2 - [MQTT] Broadcast self state every N (def: 60) seconds (delay configurable by 'mqtt_broadcastInterval' and 'mqtt_broadcastItemsPerSec'... [Read more]

nacxoffw 29 Jan 2024 17:42

Hi! Thanks a lot about this post and the information given. I have one of this PCB with CBU chip. Here a resume about my configuration: https://obrazki.elektroda.pl/2744555700_1706546227_thumb.jpg... [Read more]

nacxoffw 30 Jan 2024 07:17

Solved!! Setting Channel 4 for gpio of configured battery send MQTT data. https://obrazki.elektroda.pl/7046929300_1706595312_thumb.jpg Data appear as unavailable in sleep time is solved after... [Read more]

crispybeken 23 Mar 2024 00:29

I've got one of these devices, too. But I can't find a template in the WebApp. Could you please post your template here? [Read more]

mcexmltv 23 Apr 2024 20:09

Newbie here, anyone could be kind and post a how to, or at least post the files. Thanks in advance. [Read more]

p.kaczmarek2 24 Apr 2024 08:55

Hello @mcexmltv , what kind of information do you need exactly? Are you asking about device configuration, or about flashing? For flashing, please see: https://github.com/openshwprojects/BK7231GUIFlashTool You... [Read more]

mcexmltv 01 May 2024 00:34

Thanks @pkaczmarek2 , finally had some time to do some research. Here is what I am looking for. I have ESPHome installed. How do I flash openBK OTA or do I have to use UART? If OTA is possible what... [Read more]

p.kaczmarek2 01 May 2024 09:35

They have OTA locked against flashing our/Tuya RBL format but someone has found a work around (converted files...): https://github.com/BenJamesAndo/OpenBeken_uf2_firmware Let me know how it works for... [Read more]

psyko_chewbacca 19 Dec 2024 03:19

Hi, where do I find this "soft_i2c" external component? I have an i2c device I'd like to interface to a bk7231n in ESPHome. Thanks! [Read more]

%}