I’m fairly new to ESPHome and Home Assistant, but so far I’ve been having way too much fun with this stuff. I hope this helps someone. Mods feel free to move it if this is in the wrong place.
I recently picked up a couple of ELEGRP PQR21 and with the help of Claude, was able to get it working with ESPHome.
A couple of notes: Tuya-cloudcutter hasn’t been able to crack any tuya device I’ve tried. I think unfortunately the firmware has been patched to the point where this is not a reliable option.
That being said, as I have been flashing all kinds of stuff lately, I picked up one of these BDM frames from Amazon for about $35 and now no soldering required.
*Backup and flashing were easy. ltchiptool running when the CBU booted immediately started reading / writing.
Claude assisted with generating a template based on other ELEGRP Dimmers:
This config includes:
- CBU board type and UART settings for the TuyaMCU link at 9600 baud
- Dimmable socket on DP 1 (on/off) and DP 2 (brightness), with 10-1000 scale
- Non-dimmable socket on DP 7
- Dimmer Level percentage slider for brightness control
- SNTP time source for the MCU to answer its time queries
- Web UI, restart button, and standard sensors
I’ve added TODO comments where users need to insert their specific settings like device name, API key, OTA, and Wi-Fi credentials.
esphome:
name: elegrp_pqr21
# TODO: Uncomment and change to a unique name
# friendly_name: "ELEGRP PQR21"
bk72xx:
board: cbu
# Serial logging off: TX1/RX1 are used by the TuyaMCU.
# Logs are still visible in the web interface and ESPHome dashboard.
logger:
baud_rate: 0
level: DEBUG
# TODO: Uncomment and set up your ESPHome API and OTA settings
#api:
# encryption:
# key: ""
#ota:
# - platform: esphome
# TODO: Uncomment and set up your Wi-Fi settings
#wifi:
# ssid: !secret wifi_ssid
# password: !secret wifi_password
# ap:
# ssid: "ELEGRP PQR21 Fallback Hotspot"
# password: ""
captive_portal:
web_server:
port: 80
version: 3
# Link to the TuyaMCU
uart:
rx_pin: RX1
tx_pin: TX1
baud_rate: 9600
# The MCU asks for the time; this answers it
time:
- platform: sntp
id: sntp_time
tuya:
id: tuya_mcu
time_id: sntp_time
# Dimmable socket on DP 1 (on/off) and DP 2 (brightness)
light:
- platform: tuya
name: "Dimmable Socket"
switch_datapoint: 1
dimmer_datapoint: 2
min_value: 10
max_value: 1000
# Non-dimmable socket on DP 7
switch:
- platform: tuya
name: "Socket 2"
switch_datapoint: 7
# Percentage slider for dimmer brightness (MCU scale 10-1000 = 1-100%)
# Sets brightness directly; does not turn the socket on by itself
number:
- platform: tuya
name: "Dimmer Level"
number_datapoint: 2
min_value: 1
max_value: 100
step: 1
multiply: 10
unit_of_measurement: "%"
button:
- platform: restart
name: "Restart"
sensor:
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
- platform: uptime
name: "Uptime"
text_sensor:
- platform: wifi_info
ip_address:
name: "IP Address"
ssid:
name: "SSID"




