ESPhome: Treatlife Smart Dimmer Plug with 2 Sockets DP12

I purchased the Treatlife Smart Dimmer Plug with 2 sockets to use with the outdoor Christmas lights and decorations, that way I can automate when they turn on and turn off but I didn’t want to connect it to Tuya Cloud and I already have ESPhome and openHAB managing all the smart home tech. At the time there was no information on how to convert this unit or even if it was possible, there was the DP10 that others converted. This unit was purchased December 2024 and has the CB3S module.

The DP12 has two separate outlets that can be individually dimmed unlike other products out there.

I fired up Tuya-CloudCutter and gave it a try with the DP10 profile, and surprise it worked! After a bunch of trial and error and log watching I’ve got both plugs operational and they can be dimmed! Below is the current YAML code I’m using, this is current as of December 5, 2024. As I discover more about this unit I’ll update.

substitutions:
  device_name: outdoor_dp12-1
  device_friendly_name: Outdoor DP12-1
  device_description: "Treatlife Smart Dimmer Plug with 2 Sockets DP12"
  icon: mdi:power-socket-us
  update_interval_wifi: "60s"
  
esphome:
  name: ${device_name}
  friendly_name: ${device_friendly_name}  
  comment: ${device_description}
  on_boot:
    priority: 600
    then:
      lambda: |-
        id(Outlet1).remote_values.set_brightness(100);
        id(Outlet2).remote_values.set_brightness(100);

bk72xx:
  board: cb3s

# Automatically logs all log messages, By default, all logs with a severity DEBUG or higher will be shown
# Increasing the log level severity (to e.g INFO or WARNING) can help with the performance of the application and memory size.
logger:
  level: DEBUG
  baud_rate: 0

# Enable openHAB API
api:
  encryption:
    key: !secret api_password

ota:
  - platform: esphome
    password: !secret esphome_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  domain: !secret domain
  power_save_mode: NONE
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    password: !secret ap_password

# After 1 minute of unsuccessful WiFi connection attempts, the ESP will start a WiFi hotspot (with the credentials from ap configuration above)
captive_portal:
# Creata a simple web server on the node that can be accessed through any browser and a simple REST API
web_server:
# Make the node announce itself on the local network using the multicast DNS (MDNS)
mdns:

# Sets the communication details to MCU
uart:
  rx_pin: P10
  tx_pin: P11
  baud_rate: 115200 

debug:
  update_interval: 30s

text_sensor:
  - platform: version
    name: Version
  - platform: debug
    reset_reason: 
      name: Reset Reason
  - platform: libretiny
    version: 
      name: LibreTiny Version
  - platform: wifi_info
    ip_address:
      name: ${device_friendly_name} IP Address
      icon: "mdi:ip-outline"
      update_interval: ${update_interval_wifi}
    ssid:
      name: Connected SSID
      icon: "mdi:wifi-settings"
      update_interval: ${update_interval_wifi}
    bssid:
      name: Connected BSSID
      icon: "mdi:wifi-settings"
      update_interval: ${update_interval_wifi}
    mac_address:
      name: ${device_friendly_name} WiFi MAC Address
      icon: "mdi:network-outline"

time:
  - platform: sntp
    servers: xx.xx.xx.xx
    id: sntp_time

tuya:
  time_id: sntp_time
  
sensor:
  - platform: wifi_signal
    name: ${device_friendly_name} WiFi Signal
    update_interval: 60s

  - platform: uptime
    name: ${device_friendly_name} Uptime
    unit_of_measurement: minutes
    filters:
      - lambda: return x / 60.0;
    
light:
  - platform: "tuya"
    name: ${device_friendly_name} Outlet 1
    id: Outlet1
    dimmer_datapoint: 2
    switch_datapoint: 1
    min_value: 100
    max_value: 1000
  - platform: "tuya"
    name: ${device_friendly_name} Outlet 2
    id: Outlet2
    dimmer_datapoint: 8
    switch_datapoint: 7
    min_value: 100
    max_value: 1000

select:
  - platform: "tuya"
    id: "dimmer_mode"
    name: ${device_friendly_name} Dimming Mode
    enum_datapoint: 10
    options:
      0: LED # Index 0
      1: Incandescent # Index 1
      2: Halogen # Index 2


#1 - switch 1
#2 - dimmer 1 = 763
#3 - dimmer 1 - brightness min = 100 Diming Range 10%= 100, 100%=1000
#7 - switch 2
#8 - dimmer 2 = 763
#9 - dimmer 2 - brightness min = 100 Diming Range 10%= 100, 100%=1000

#10 - dimming mode = LED, incandescent, halogen

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top