BK7231N - Too much consumption?

I tried to install espHome to this device and all worked well while using an external power supply.

When I disconnect the serial and the external power supply i’m not able to start it anymore. Connecting the 230V AC results in multiple relay noise, and it seems that the device continue to reboot.

I think it’s related to the big cpu power consumption that causes a blackout with the small internal AC-DC supply. If I disconnect 230V and reconnect 3.3V external power supply all starts working…

Following my yaml, how can I modify it to avoid that problem?

Thanks

esphome:
  name: "aubess-pm1"

bk72xx:
  board: cb2s 

# Enable Home Assistant API
api:
logger:
ota:
  platform: esphome

wifi:
  networks:
    - ssid: "Dim-GB0"
      password: !secret wifi_password
    - ssid: "Dim-GB"
      password: !secret wifi_password

  ap:
    ssid: "testDIY Fallback Hotspot"
    password: "asdasdasd"

binary_sensor:
  - platform: gpio
    pin:
      number: P23
      mode:
        input: true
        pullup: true
    id: "PB_reset"
    on_press:
      - switch.toggle: aubespm01
  - platform: gpio
    pin:
      number: P24
      mode:
        input: true
        pullup: True
    id: "PB_ext"
    on_press:
      - switch.toggle: aubespm01
    on_release:
      - switch.toggle: aubespm01

  - platform: status
    name: "Status"

sensor:
  - platform: wifi_signal
    update_interval: 10s
    id: wifi_signal_db
  - platform: uptime
    name: "Uptime"
  - platform: copy
    source_id: wifi_signal_db
    name: "WiFi Signal Percent"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "%"
  - platform: bl0942
    uart_id: uart_bus
    voltage:
      name: 'Voltage'
    current:
      name: 'Current'
    power:
      name: 'Power'
      filters:
        multiply: -1
    energy:
      name: 'Energy'
    frequency:
      name: "Frequency"
      accuracy_decimals: 2

    update_interval: 60s

output:
  - platform: gpio
    pin: P8
    id: led

switch:
  - platform: gpio
    name: "relay"
    pin: P26
    id: aubespm01
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_on:
      then: 
        - output.turn_on: led
    on_turn_off:
      then:
        - output.turn_off: led

captive_portal:
    
uart:
  id: uart_bus
  tx_pin: P11  #TX
  rx_pin: P10 #RX
  baud_rate: 4800
  stop_bits: 1

I would first correct the board type. This was revised last year.

bk72xx:
  board: generic-bk7231n-qfn32-tuya
  framework:
    version: latest
#CB2S module which is a BK7231N

My wifi is in a separate package but here is my yaml for a similar device.

substitutions:
  name: "power-switch1"
  entity_name: "power_switch1"
  friendly_name: "Power Switch1"

packages:
  wifi: !include base/wifi.yaml

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

bk72xx:
  board: generic-bk7231n-qfn32-tuya
  framework:
    version: latest

external_components:
  - source:
      type: git
      url: https://github.com/esphome/esphome
      ref: dev
    components: [bl0942]

uart:
  id: uart_bus
  tx_pin: P11
  rx_pin: P10
  baud_rate: 4800
  stop_bits: 1

sensor:
  - platform: wifi_signal
    name: "WiFi Signal"
    update_interval: 60s
    state_class: ''

  - platform: bl0942
    uart_id: uart_bus
    voltage:
      name: 'Voltage'
      state_class: ''
    current:
      name: 'Current'
      state_class: ''
    power:
      name: 'Power'
      state_class: ''
      #filters:
        #multiply: -1
    energy:
      name: 'Energy'
    frequency:
      name: "Frequency"
      state_class: ''
      accuracy_decimals: 2

    update_interval: 30s

binary_sensor:
  - platform: gpio
    pin:
       number: P6
       inverted: true
       mode:
        input: true
        pullup: true
    name: "button_P6"
    filters:
       - delayed_on: 10ms
    on_press:
      - switch.toggle: ${entity_name}_relay

switch:
  - platform: gpio
    pin: P23
    id: ${entity_name}_relay
    name: "Relay"
    restore_mode: ALWAYS_ON
    on_turn_on:
      - output.turn_on: ${entity_name}_led
    on_turn_off:
      - output.turn_off: ${entity_name}_led

output:
  - platform: gpio
    pin: P7
    id: ${entity_name}_led
    inverted: false

text_sensor:
  - platform: wifi_info
    ip_address:
      name: "IP Address"
    ssid:
      name: "Connected SSID"
    mac_address:
      name: "Mac Address"
  # Expose ESPHome version as sensor.
  - platform: version
    name: "ESPHome Version"
     
time:
  - platform: sntp
    id: sntp_time

Why do you say mine it’s wrong?
I can ensure that it mounts a cb2s, i checked this site CB2S - LibreTiny

You can see it match the photos i posted in the other forum (link in the first topic)

What does it changes with

  framework:
    version: latest

? => tested, same behavior

If I add

external_components:
  - source:
      type: git
      url: https://github.com/esphome/esphome
      ref: dev
    components: [bl0942]

i have the following error

sensor.bl0942: [source /config/esphome/aubess-pm1.yaml:57]

Platform not found: ‘sensor.bl0942’.

This is from esphome. Can’t recall details but I thought types were changed when libretiny was incorprated into esphome.

LibreTiny Platform — ESPHome

The esphome yaml editor will provide added info.

image

Can’t explain the github issue. Working fine for me but not an expert on all this.