Deltaco SmartHome

Anyone had any success with SH-LFE14C35?

How did you manage to open the sh-p01e? The blog post doesn’t exist anymore. Looking to flash two of these via serial since tuya-convert doesn’t work anymore.

1 Like

Hi guys,

Not sure if this helps any of you, but I have a bunch of Deltaco smart plugs that I wanted to get into Home Assistant. I got a tip to try to add them to Tuya directly in the phone app without doing anything – and it worked.

1 Like

Deltaco SH-P01E Teardown:
There is a “plug” that can be removed (pried off) to reveal screws.
then simply unscrew, and pull the top, off of the bottom.
This one uses a TYWE2S packge, it contains an ESP8285 according to some documentation i found.

1 Like

Damm, I couldn’t just add the SH-P01E to Tuya Smart Home like I could with the SH-P01s.

What is the blog post referred to above for the P01E? Anyway to get them into Home Assistant?

If you have some soldering experience and a programmet, an rpi Will work, you can manually flash tasmota in SH-P01E.

1 Like

Thanks, sorry for not updating, I just tried a few times more the day after and it worked.

Don’t think there is any need to flash the Deltaco plugs to get them into HA, I’ve at least been able to just add them to Tuya and through that integration to HA.

But that of course includes creating an account etc that some don’t, but I don’t care that mcuh about that.

How did you get SH-OP1 open?

I did not open it. I used tuya convert to replace the stock firmware with ESPHome.

1 Like

If you have the round one linke i posted here https://community.home-assistant.io/t/deltaco-smarthome/146101/51 then you quite possible can’t open it non-destructively. I just revisited this to extract the TYWES2 module to use in another Nedis plug from Kjell&Co that had an incompatible module, at least i can salvage something as the shell was destroyed from opening.

If you have the square one others have shown then looks ike just the two screws under the cover.

I’m curious when was the ones that worked with tuya convert purchased; everything I’ve got the last year or so have either been patched or downright incompatible.

I poped out the plastic pice at the bottom to reveal 2 screws.
i posted the picture above.
Hopefully its similar enough to the one you have to help.

I also got a power strip, with this SWB2-1 (LM1) chip inside. For pinout, see this. Flashing went easily, but it behaves very strange, it can be flashed after every power-cycle, regardless of the GPIO0 state. Basically every code works on it until a restart.

Somebody experienced similar behavior with ESPs?

how do I load new firmware into this module SWB2-1? do you have any instructions?
Help FTL232RL and windows esphome flasher
My log lists:

Using 'COM5' as serial port.
Connecting........_____....._____....._____....._____....._____....._____....._____
Unexpected error: ESP Chip Auto-Detection failed: Failed to connect to Espressif device: Timed out waiting for packet header

Yaml in esphome

substitutions:
  friendly_name: ESP-Strip
  device_description: "convert strip Tuya Lingan SWB2-1"

esphome:
  name: esp-strip1

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "6d46e4943a7c28f4a232784e352152aa"

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

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

captive_portal:

sensor:
# Wifi signal 
  - platform: wifi_signal
    name: "${friendly_name} Signal"
    update_interval: 300s

switch:
  - platform: gpio
    id: led
    pin:
      number: GPIO12
      inverted: true
  - platform: gpio
    name: "${friendly_name} USB"
    pin: GPIO15
    id: plugusb
  - platform: gpio
    name: "${friendly_name} Socket3"
    pin: GPIO12
    id: plug1
  - platform: gpio
    name: "${friendly_name} Socket1"
    pin: GPIO14
    id: plug2
  - platform: gpio
    name: "${friendly_name} Socket2"
    pin: GPIO05
    id: plug3

Wiring
Google Photos

Thanks

EDIT: Ha ha fix reverse pin RX a TX :slight_smile:
And another problem:

Using 'COM5' as serial port.
Connecting....
Detecting chip type... ESP8266
Connecting...

Chip Info:
 - Chip Family: ESP8266
 - Chip Model: ESP8266EX
 - Chip ID: 00FE6CEE
 - MAC Address: 98:F4:AB:FE:6C:EE
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
 - Flash Size: 4MB
 - Flash Mode: dout
 - Flash Frequency: 40MHz
Erasing flash (this may take a while)...
Unexpected error: Error while erasing flash: Timed out waiting for packet content

EDIT 2
helped to replace it with another flasher module
Google Photos

EDIT3
full yaml code whit button (click turn on/hold turn off) and add current meter (ads1115 adc and ct_clamp SCT-013-50A)

i2c:
  sda: GPIO4
  scl: GPIO2

ads1115:
  - address: 0x48

sensor:
# Wifi signal 
  - platform: wifi_signal
    name: "${friendly_name} Signal"
    update_interval: 300s

  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 6.144
    name: "ADS1115 Channel A0-GND"
    id: adc_sensor
    update_interval: 30s
    internal: true

  - platform: ct_clamp
    sensor: adc_sensor
    name: "${friendly_name} Current"
    update_interval: 30s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.003 -> 0.142
    id: ctcurrent
  - platform: template
    name: "${friendly_name} Power"
    lambda: |-
      return (235.0 * id(ctcurrent).state);
    unit_of_measurement: 'W'
    update_interval: 30s
      
  

# Example configuration entry
switch:
  - platform: gpio
    id: led
    pin:
      number: GPIO12
      inverted: true
  - platform: gpio
    name: "${friendly_name} USB"
    pin: GPIO15
    id: plugusb
    restore_mode: ALWAYS_ON
  - platform: gpio
    name: "${friendly_name} Socket1"
    pin: GPIO12
    id: plug1
    restore_mode: ALWAYS_ON
  - platform: gpio
    name: "${friendly_name} Socket2"
    pin: GPIO14
    id: plug2
    restore_mode: ALWAYS_ON
  - platform: gpio
    name: "${friendly_name} Socket3"
    pin: GPIO05
    id: plug3
    restore_mode: ALWAYS_ON
    
# Example configuration entry
binary_sensor:
  - platform: gpio
    name: "${friendly_name} gpio13"
    pin:
      number: GPIO13
      mode: INPUT_PULLUP
    id: press_strip
    filters:
      - invert:
      - delayed_on: 10ms
    device_class: power
    on_click:
    - min_length: 50ms
      max_length: 990ms
      then:
        - switch.turn_on: plug1
        - switch.turn_on: plug2
        - switch.turn_on: plug3
        - switch.turn_on: plugusb
    - min_length: 1000ms
      max_length: 5000ms
      then:
        - switch.turn_off: plug1
        - switch.turn_off: plug2
        - switch.turn_off: plug3
        - switch.turn_off: plugusb
2 Likes

Can you share original firmware.

I don’t have the original firmware. It have been overwriten with ESPHome firmware.

Hi,
i have an 3 Socket + USB Lingan Model swb2-1 REV:v1.1 Date 2018.11.22
i tried your code to switch the Sockets and it is working fine. :slight_smile:
But the Power Sensor does not work. - NA - result.
Did you add the power sensor with your own hardware?
or is your Socket with the needed hardware delivered from Factory?
Greetings TiBo

I added my own HW.
the first version was with CT-clamp and ADS1115
the second version is already with hlw8012 and galvanically separated USB!!!

1 Like

I have a Deltaco outdoor smartplug (SH-OP01)
image

Seems tuya convert did not work.
But, managed to use this tuya cloudcutter to install esphome on it.

I followed digiblurs webpage how to use tuya cloudcutter:

Could not find that plug in the tuya cloudcutter list, so I just winged it and hoped for the best :smiley:
Chose a generic bk7231t plug, luckily I could login to it in AP mode, and add it to my wifi.

After that I used esphome to build a firmware and loaded it manually through webgui. And after that homeassistant found it.

Here is my esphome config for it. But still needs a proper calibration for energymeter part.

substitutions:
#  voltage_divider: "785.5115954276857"
  voltage_divider: "815.5115954276857"
  current_resistor: "0.001054149274397953"
  current_multiply: "0.4499878363475396"

esphome:
  name: deltaco-outdoor-wifi-plug-1
  friendly_name: Deltaco-outdoor-wifi-plug-1

bk72xx:
  board: generic-bk7231t-qfn32-tuya

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: ""

ota:
  password: ""

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

  ap:
    ssid: "Deltaco-Outdoor-Wifi-Plug-1"
    password: ""

captive_portal:

web_server:
  port: 80

sensor:
  - platform: hlw8012
    model: BL0937
    cf_pin:
      number: P7
      inverted: true
    cf1_pin:
      number: P8
      inverted: true
    sel_pin:
      number: P24
      inverted: true
    current_resistor: ${current_resistor}
    voltage_divider: ${voltage_divider}
    current:
      name: "BL0937 Current"
      filters:
        - multiply: ${current_multiply}
    voltage:
      name: "BL0937 Voltage"
    power:
      name: "BL0937 Power"
    update_interval: 10s


  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 60s

  - platform: uptime
    name: Uptime Sensor
    id: uptime_sensor
    update_interval: 60s
    on_raw_value:
      then:
        - text_sensor.template.publish:
            id: uptime_human
            state: !lambda |-
              int seconds = round(id(uptime_sensor).raw_state);
              int days = seconds / (24 * 3600);
              seconds = seconds % (24 * 3600);
              int hours = seconds / 3600;
              seconds = seconds % 3600;
              int minutes = seconds /  60;
              seconds = seconds % 60;
              return (
                (days ? to_string(days) + "d " : "") +
                (hours ? to_string(hours) + "h " : "") +
                (minutes ? to_string(minutes) + "m " : "") +
                (to_string(seconds) + "s")
              ).c_str();

text_sensor:
  - platform: template
    name: Uptime Human Readable
    id: uptime_human
    icon: mdi:clock-start
  - platform: wifi_info
    ip_address:
      name: IP Address
      entity_category: diagnostic

binary_sensor:
  - platform: status
    name: Status
    entity_category: diagnostic

  - platform: gpio
    pin:
      number: P10
      mode: INPUT_PULLUP
      inverted: true
    name: "Power Button"
    on_press:
      - switch.toggle: relay

switch:
  - platform: gpio
    # LED
    id: led
    pin:
      number: P6
      inverted: true

  - platform: gpio
    name: Switch
    pin: P26
    id: relay

    # Turn on LED when turned on
    on_turn_on:
      - switch.turn_on: led

    # Turns off LED once the plug is turned off
    on_turn_off:
      - switch.turn_off: led

button:
  - platform: restart
    id: restart_button
    name: Restart
    entity_category: diagnostic

Oh, thanks this looks great! I have bee searching for this but what orginal firmware did you have on the plug, I have a SH-OP01 and don’t know if there is any difference to the sp-op01 maybe just or another contry. My is bought in Sweden.
Where did you get thoose number from?

 voltage_divider: "815.5115954276857"
  current_resistor: "0.001054149274397953"
  current_multiply: "0.4499878363475396"

Because I read that you need to calibrate it?

Hi, sorry that was a typo… It’s a SH-OP01. I bought it from netonnet :slight_smile:

The values I just copied it from another example, and tried it to see what kind of values I get for volt amps watt.
I have tuned those a bit, but still need more time on that. It’s almost there, but I haven’t just had time to calibrate it properly. :slight_smile:

new values that I think is more close to be correct.

  voltage_divider: "826.5560949725779"
  current_resistor: "0.0005782716155781829"
  current_multiply: "0.20570710385066757"

You can use this page to calibrate it.