How to: Digoo DG-SP202 / Slitinto NX-SP2021 config

Took me a little while to get it right, so I’m sharing it with you guys:

Buy, Tuya convert it and use with esphome! :wink:

Slitinto NX-SP2021:

Digoo DG-SP202:

Config:

esphome:
  # Digoo DG-SP202 wifi plug with power monitoring
  name: digoo01
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: !secret esphome_wifi_ssid
  password: !secret esphome_wifi_password
  
api:
  password: !secret esphome_api_password

ota:
  password: !secret esphome_ota_password

logger:

web_server:
  port: 80

time:
  - platform: homeassistant
    id: homeassistant_time

sensor:
  - platform: hlw8012
    sel_pin:
      number: GPIO16
      inverted: True
    cf_pin: GPIO5
    cf1_pin: GPIO14
    current_resistor: 0.00221 ## Higher value gives lower watt readout
    voltage_divider: 896  ## Lower value gives lower voltage readout
    current:
      name: "Digoo01 amperage"
      unit_of_measurement: A
    voltage:
      name: "Digoo01 voltage"
      unit_of_measurement: V
    power:
      name: "Digoo01 wattage"
      unit_of_measurement: W
      id: "wattage"
    change_mode_every: 8
    update_interval: 30s
  - platform: total_daily_energy
    name: "Digoo01 daily power usage"
    power_id: "wattage"
    filters:
        - multiply: 0.001  ## Multiplication factor from W to kW is 0.001
    unit_of_measurement: kWh

binary_sensor:
  - platform: gpio
    pin:
      number: 13
      mode: INPUT_PULLUP
      inverted: true
    name: "Digoo01 button-1"
    on_press:
      - switch.toggle: relay1
  - platform: gpio
    pin:
      number: 4
      mode: INPUT_PULLUP
      inverted: true
    name: "Digoo01 button-2"
    on_press:
      - switch.toggle: relay2

  - platform: status
    name: "Digoo01 Status"

switch:
  - platform: gpio
    name: "Digoo01 Plug 1"
    pin: GPIO15
    id: relay1
  - platform: gpio
    name: "Digoo01 Plug 2"
    pin: GPIO12
    id: relay2
3 Likes

Thanks for the how-to !
I just received a DG-SP202 and I will try to flash it very soon :slight_smile:

is it difficult to flash it?

You have to use tuya convert (once). I would say it’s fairly easy.

1 Like

Pretty cool.

Is smart life the app of Tuya based products?

On amazon its full of those smart plugs, like this one

Ciabatta Multipresa, Houzetek Presa Intelligente Smart Wifi Plug Supporta App Alexa / Google Home/ IFTTT, Ciabatta Elettrica Con Interruttore Con 4 Prese Polivalenti e 3 Prese Usb,Wifi 2.4G. https://www.amazon.it/dp/B07H5JVF4R/ref=cm_sw_r_cp_apa_i_6QYLCbY05KCAP

Don’t know, don’t use it :wink: I convert. I don’t want any Chinese cloud stuff on my network.

Take a look at the supported devices page. :slight_smile:

I got this one for EURO 17,94. As soon as it arrives, I’ll convert it, i’ll get it to work somehow and post the config :wink:

After having multiple fails with a tasmota build this worked instantly!!!

Could you help me point me in the right direction to get a usable HA desktop layout? All i can see is 9.8A usage (while the device has nothing connected) and i have to add everything one by one ?!

Mine arrived now, did yours ? Any problem with tuya convert? I try now

Please post your findings here :wink:

Hi, I converted and upload succesfully ESPHome. One of thje two plug works perfectly , while the other not (neither the switch, nor the binary_sensor)

The below is NOT working

binary_sensor:
  - platform: gpio
    pin:
      number: 4
      mode: INPUT_PULLUP
      inverted: true
    name: "Small oven button"
    on_press:
      - switch.toggle: relay2

switch:
  - platform: gpio
    name: "Small oven power plug"
    pin: GPIO12
    id: relay2

THe below IS working

switch:
  - platform: gpio
    name: "Micro power plug"
    pin: GPIO15

binary_sensor:
  - platform: gpio
    pin:
      number: 13
      mode: INPUT_PULLUP
      inverted: true
    name: "Micro button"
    on_press:
      - switch.toggle: relay1

Below the correct code

sensor:
  - platform: hlw8012
    sel_pin:
      number: GPIO16
      inverted: True
    cf_pin: GPIO5
    cf1_pin: GPIO4


binary_sensor:
  - platform: gpio
    pin:
      number: 0
      mode: INPUT_PULLUP
      inverted: true
    name: "Micro button"
    on_press:
      - switch.toggle: relay1
  - platform: gpio
    pin:
      number: 16
      mode: INPUT_PULLUP
      inverted: true
    name: "Small oven button"
    on_press:
      - switch.toggle: relay2

switch:
  - platform: gpio
    name: "Micro power plug"
    pin: GPIO15
    id: relay1
  - platform: gpio
    name: "Small oven power plug"
    pin: GPIO14
    id: relay2

Both are correct, there is a internal hardware difference. Externally the devices look exactly the same.

Hi! Can you point me to what firmware to flash with Tuya-convert? One of the included sonoff-basic.bin or espurna-base.bin? Or where can I find the ESPHome firmware? Many thanks

I succesfuly converted this device and uploaded the esphome firmware, this configuration worked for me:

esphome:
  name: digoo01
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "xxxxx"
  password: "xxxxxx"

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

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "xxxxx"

ota:
  password: "xxxxx"

web_server:
  port: 80

time:
  - platform: homeassistant
    id: homeassistant_time
    
sensor:
  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: True
    cf_pin: GPIO4
    cf1_pin: GPIO5
    current_resistor: 0.00221 ## Higher value gives lower watt readout
    voltage_divider: 779  ## Lower value gives lower voltage readout
    current:
      name: "Digoo01 Current"
      unit_of_measurement: A
    voltage:
      name: "Digoo01 Voltage"
      unit_of_measurement: V
    power:
      name: "Digoo01 Power Consumption"
      unit_of_measurement: W
      id: "wattage"
    change_mode_every: 8
    update_interval: 30s
  - platform: total_daily_energy
    name: "Digoo01 Daily Power Consumption"
    power_id: "wattage"
    filters:
        - multiply: 0.001  ## Multiplication factor from W to kW is 0.001
    unit_of_measurement: kWh

binary_sensor:
  - platform: gpio
    pin:
      number: 16
      mode: INPUT_PULLUP
      inverted: true
    name: "Digoo01 Button Left"
    on_press:
      - switch.toggle: relayLeft
  - platform: gpio
    pin:
      number: 0
      mode: INPUT_PULLUP
      inverted: true
    name: "Digoo01 Button Right"
    on_press:
      - switch.toggle: relayRight
  - platform: status
    name: "Digoo01 Status"

switch:
  - platform: gpio
    name: "Digoo01 Plug Left"
    pin: GPIO14
    id: relayLeft
  - platform: gpio
    name: "Digoo01 Plug Right"
    pin: GPIO15
    id: relayRight

Hi, I installed ESPHome, was not working totallyu ok, but it was, today I tried to upload a changed firmware, but something happened, now I can’t see the plug in my WiFi.

How to make a reset/ put in AP mode? With Sonoff is pressing 4 times the button, but with these plugs?

Or any other way to be able to upload the firmware?

I bought a Digoo DG-SP202 in June 2020 and it seems tuya-convert is no longer supported.

When I try to upload firmware with tuya-convert, I get this error message in the file smarthack-web.log:

WARNING: it appears this device does not use an ESP82xx and therefore cannot install ESP based firmware

Sad…

Yup, that has been the case with many tuya devices lately.

I have a Slitinto NX-SP201 dual-outlet plug. After some experimenting, I’ve found that it’s configuration is:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO4
      inverted: True
    name: "${plug_name}_button1"
    on_press:
      then:
        - switch.toggle: "${plug_name}_relay1"
  - platform: gpio
    pin:
      number: GPIO13
      inverted: True
    name: "${plug_name}_button2"
    on_press:
      then:
        - switch.toggle: "${plug_name}_relay2"
    
switch:
  - platform: gpio
    id: "${plug_name}_relay1"
    name: "${plug_name}_relay1"
    pin: GPIO12
    restore_mode: RESTORE_DEFAULT_OFF
  - platform: gpio
    id: "${plug_name}_relay2"
    name: "${plug_name}_relay2"
    pin: GPIO15
    restore_mode: RESTORE_DEFAULT_OFF
  - platform: gpio
    name: "${plug_name}_led_blue"
    pin: GPIO0
    inverted: True
    restore_mode: RESTORE_DEFAULT_OFF

sensor:
  - platform: hlw8012
    sel_pin:
      number: GPIO3
      inverted: True
    cf_pin: GPIO5
    cf1_pin: GPIO14
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    current:
      name: "${plug_name}_current"
      unit_of_measurement: A
    voltage:
      name: "${plug_name}_voltage"
      unit_of_measurement: V
    power:
      name: "${plug_name}_power"
      unit_of_measurement: W
      id: "${plug_name}_power"
    change_mode_every: 8
    update_interval: 10s
  - platform: total_daily_energy
    name: "${plug_name}_consumption_today"
    power_id: "${plug_name}_power"
    filters:
        # Multiplication factor from W to kW is 0.001
        - multiply: 0.001
    unit_of_measurement: kWh
  # Extra sensor to keep track of plug uptime
  - platform: uptime
    name: ${plug_name}_uptime