Lepro / Nexigo Smart Desk Lamp - Light control missing from Home Assistant UI

Hello, my first post here, although I’ve been coming here for a year or so to read about different items.

I flashed a lamp with ESPHome. It uses Tuya MCU and it has required a bit of tinkering to find the proper settings. While I flashed slightly different configurations, the RGB+CT light controls disappeared from HA and they refuse to come back. I can only set the lamp mode from the interface. I need help bringing back the light control to the UI.

A bit of background:
I have a couple of lamps I got on different occasions that looked very similar. They are different brands and I bought them at different times. I decided to take a peek to see if I could flash ESPHome on them and found out that the circuits are identical. Same chips and everything: This is what they look like on the inside

They both have a BK72XX module inside (WB3S), which I removed to flash ESPHome. This is my YAML

esphome:
  name: rgbw-lamp

bk72xx:
  board: wb3s

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_key

ota:
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  manual_ip:
    static_ip: !secret wifi_ip
    gateway: !secret wifi_gateway
    subnet: !secret wifi_smask

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Fallback Hotspot"
    password: "password"

time:
  - platform: sntp
    id: sntp_time
    timezone: America/New_York
    servers:
      - pool.ntp.org

captive_portal:

uart:
  rx_pin: RX1
  tx_pin: TX1
  baud_rate: 115200

tuya:
# Datapoint 20: switch (value: ON)          Switch ON/OFF
# Datapoint 21: enum (value: 2)             Mode {white, color, scene, music}
# Datapoint 22: int value (value: 34)       Dimmer
# Datapoint 23: int value (value: 50)       Color Temperature
# Datapoint 24: string value (value: hex)   HSV
# Datapoint 25: string value (value: JSON)  Structure
# Datapoint 26: int value (value: 0)        Countdown timer
# Product: '{"p":"owlz2ugyq0mjvdke","v":"1.0.2","m":0}'
  time_id: sntp_time

# Control the light
light:
  - platform: "tuya"
    id: "rgb_desk"
    switch_datapoint: 20
    dimmer_datapoint: 22
    min_value: 10
    max_value: 1000
    color_temperature_datapoint: 23
    color_temperature_max_value: 1000
    cold_white_color_temperature: 7500K
    warm_white_color_temperature: 3000K
    color_type: hsv
    color_datapoint: 24
    restore_mode: RESTORE_AND_OFF

select:
  - platform: "tuya"
    id: "light_mode"
    name: "Set mode"
    optimistic: true
    enum_datapoint: 21
    options:
      0: white
      1: color
      2: scene
      3: music

As I mentioned before, the light control appeared and controlled the light well through multiple iterations of my trial-and-error process, but then it became unavailable and never came back.

What I have tried so far:

  • Deleted the unavailable control from the UI.
  • Deleted the ESPHome device and added it again from HA by pasting the YAML. This only brought the mode selector back.
  • Looked for unknown/orphan entities without luck
  • Flashed a version without any controls to the device and then readded the controls. Only the mode selector came back
  • Deleted the device, let HA discover it. Added it again. Only mode selector was added.
  • Reloaded HA
  • Rebooted HA

The light responds to its buttons and I can see the settings changing in the logs, but I cannot control them from HA. (Other than the mode).

Any help is welcome.

As closing notes, these posts were very helpful for me to get to where I am:
TuyaMCU - Tasmota to get the data point identifiers
(Will add two others as a reply. I am limited as a new user)

Two more useful links :wink:
Hugoai Table Lamp Light (HG02) Configuration for Tasmota mapping for a very similar lamp
GitHub - dulfer/localtuya-device-datapoints: List of data points for various Tuya devices, required to setup localtuya integration data points for a tuya mcu rgbcw light

Even though my project is an ESPHome project, I think the problem may be related to the HA UI. I will post there with a link to this original topic.