ESPHome - Blitzwolf BW-SHP6 configuration

Hi everybody,

I just got my Blitzwolf BW-SHP6 working with ESPHome on home assistant and wanted to share the config file so everybody can use it. I flashed my SHP6 using the tutorial for the Tasmota Github and it worked fine. But it was quite a hassle to but the plug back together so maybe using tuya-convert is better method. Intermit.tech has a tutorial on that, but i haven’t tried it, since i don’t have a Linux PC.

I based the config on the tutorial from Intermit.tech who used a SHP2 and changed the pin layout according to this post. Then I did some modifications to best mimic the original working of the device.

substitutions:
  plug_name: YOURNAME
  # Higher value gives lower watt readout
  current_res: "0.00290"
  # Lower value gives lower voltage readout
  voltage_div: "940"
  
esphome:
  name: ${plug_name}
  platform: ESP8266
  board: esp8285

wifi:
  ssid: "YOURSSID"
  password: "YOURPASSWORD"

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: 'YOURAPIPASSWORD'

ota:
  password: 'YOURAPIPASSWORD'

time:
  - platform: homeassistant
    id: homeassistant_time
    
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO13
      inverted: True
    name: "${plug_name}_button"
    on_press:
      - switch.toggle: switch1

output:
  - platform: gpio
    pin: GPIO15
    id: relay
  - platform: gpio
    pin: GPIO00
    inverted: True
    id: led1

status_led:
  pin:
    number: GPIO02
    inverted: True

switch:
- platform: template
  id: switch1
  icon: mdi:power-socket-eu
  optimistic: true
  name: "${plug_name}_Relay"
  turn_on_action:
    - output.turn_on: relay
    - output.turn_on: led1
  turn_off_action:
    - output.turn_off: relay
    - output.turn_off: led1

sensor:
  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: True
    cf_pin: GPIO05
    cf1_pin: GPIO14
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    current:
      name: "${plug_name}_Amperage"
      unit_of_measurement: A
      accuracy_decimals: 3
      icon: mdi:flash-circle
    voltage:
      name: "${plug_name}_Voltage"
      unit_of_measurement: V
      icon: mdi:flash-circle
    power:
      name: "${plug_name}_Wattage"
      unit_of_measurement: W
      id: "${plug_name}_Wattage"
      icon: mdi:flash-circle
    change_mode_every: 4
    update_interval: 10s
  - platform: total_daily_energy
    name: "${plug_name}_Total Daily Energy"
    power_id: "${plug_name}_Wattage"
    filters:
        # Multiplication factor from W to kW is 0.001
        - multiply: 0.001
    unit_of_measurement: kWh
    icon: mdi:clock-alert
      
# Extra sensor to keep track of plug uptime
  - platform: uptime
    name: ${plug_name}_Uptime Sensor
    icon: mdi:clock-outline

I set the template switch to optimistic, because i don’t no how to do a lambda template. I’m sure this can be improved, but it works for me at the moment.

I hope this will help somebody,

Greetings,

Tijmen

14 Likes

Thanks for the share, looks to be a really nice product (sort of copy of Fibaro Zwave ones :wink: Would be a good contribution at cookbook on ESPhome website :wink:

My configuration is very similar but I use gpio switch:

substitutions:
  device_name: DEVICE_NAME
  # Higher value gives lower watt readout
  current_res: '0.00290'
  # Lower value gives lower voltage readout
  voltage_div: '940'

esphome:
  name: ${device_name}
  platform: ESP8266
  board: esp8285

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

logger:

api:
  password: !secret esphome_api_password

ota:
  password: !secret esphome_ota_password

web_server:
  port: 80

binary_sensor:
  - platform: gpio
    id: button
    internal: true
    pin:
      number: GPIO13
    on_press:
      - switch.toggle: relay

output:
  - platform: gpio
    pin: GPIO00
    inverted: true
    id: led

switch:
  - platform: gpio
    pin: GPIO15
    id: relay
    name: '${device_name} Relay'
    on_turn_on:
      - output.turn_on: led
    on_turn_off:
      - output.turn_off: led

status_led:
  pin:
    number: GPIO02
    inverted: true

sensor:
  - platform: uptime
    name: '${device_name} Uptime'
    unit_of_measurement: days
    update_interval: 300s
    filters:
      - multiply: 0.000011574

  - platform: wifi_signal
    name: '${device_name} WiFi Signal'
    update_interval: 300s

  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: true
    cf_pin: GPIO05
    cf1_pin: GPIO14
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    current:
      name: '${device_name} Current'
      unit_of_measurement: 'A'
      accuracy_decimals: 3
      icon: mdi:flash-outline
    voltage:
      name: '${device_name} Voltage'
      unit_of_measurement: 'V'
      icon: mdi:flash-outline
    power:
      name: '${device_name} Power'
      unit_of_measurement: 'W'
      icon: mdi:flash-outline
    change_mode_every: 4
    update_interval: 10s
3 Likes

Hi all,
Im quite new to Hass.io.
But like it allot already. :slight_smile:
Question, I hope you can help me.
I have flashed the SHP6 with a 3d printed flasher,
Now if installed Home assistant. Also installed ESPHome. I opend the WEB UI
I added a new device, clickt “edit” and copyed the configuration into the text editor.
added the Wifi credentials. But it is also asking for a API and OTA API.
Where can i find the API`s . Am i missing something or do i working in the wrong direction!?

The SHP-6 is configured with a static ip addres (No DNS configured) How does the ESPHome know the IP address because i cannot reach the device.

Greetings
Palermo

hello Palermo,

i think these questions are more esphome related, so maybe you can ask them in the related topic. if you cant figure it it out there i will look in to it it for you.

i wanted to post a response for a different reason…

My shp-6 actually bunt out, it was quite a show and a bit of a shock.
looking back and examining the burnt out circuit board, i think i put to much stress on it.
so extra recommendation to tuya flash or 3d printed flasher.

Although there is a slight change that my shp6 was faulty from the factory, no way to check. blame disassembly, i think

Oei,Watch out.
You dont want them to start a fire.
I have an 3d Printer so if anyone needs a Flasher. Please let me know.
I printed 4 of them already.

I relation to my problem I think may be the new version 0.100.3 changed a few things.
When I compile the configuration and upload the bin file to the plug. Still showing me that the plug is down. I`m still looking

Greetings
Palermo

For those who would like to use this with the tuya convert; I get the strong impression that these will not work with tuya-convert. The original plug tries downloading a firmware using a non-secure connection. These plugs try to use https, and that fails with tuya convert. I’ll try to see if I can use stunnel to get them to download a firmware, but If they do proper certificate checking, that won’t work. I’ll post my results here later.

A random certificate with a valid certificate from a private root will not work.
Off course the plug does not have an RTC, so cert based authentication will be a challenge. Therefore they seemed to have chosen to use pre shared key authentication.

The SHP6 tries to connect to a3.tuyaeu.com and sugests 2 cipher suites:

TLS_PSK_WITH_AES128_CBC_SHA256 (0x00ae)
TLS_EMPTY_RENEGOTIATION_INFO_SCSV (0x00ff)

So if they use a PSK it’s probably in the original firmware somewhere.

Nevermind, someone has already figured this out and the newest version of tuya-convert supports the new devices perfectly.

1 Like

Only just received two SHP7, the double version of this. Won’t have time to poke the serial and stuff for a while, but uploaded some pictures if anyone wanna have a look under the hood before ordering these.


(No idea if ESPHome is possible or not at this time; looking closer the green module does say RL_ESP8285_Z0_V2.0 so I guess its just a matter of mapping pins one day I have the time:)
((or just pull the module, read the silkscreen, then probe the board another day https://ibb.co/album/jR0taa))

Done intitial pin mapping:

wifi module
IO1/TX   IO3/RX
IO5      IO4
IO0      IO2
IO13     IO12
IO14     IO16
IOUT*    GND
VDD

mapping
IO0       switch1 (next to wifi module)
IO13      led1
IO15      relay1
IO2       switch2
IO12      led2
IO16      relay2
IO01/TX   blue led
IO03/RX** SEL HLW8012? pin 8
IO5**     CF1 HLW8012? pin 7
IO4**     CF  HLW8012? pin 6
GND           HLW8012? pin 5
VDD           HLW8012? pin 1

*) no idea if correct, seems unused
**) untested

Hope to get it flashed soon:) Flashed, need to get buttons and power meter chip working.
Button shows up in log once, but doesn’t do anything besides show up in log.

[22:32:30][D][binary_sensor:036]: 'button1': Sending state OFF
[22:32:33][D][binary_sensor:036]: 'button2': Sending state OFF

add mode: INPUT_PULLUP fixes button.

config.yaml so far:

substitutions:
  device_name: blitzwolf07 

esphome:
  name: ${device_name}
  platform: ESP8266
  board: esp8285

wifi:
  ssid: !secret iot_ssid
  password: !secret iot_password
  domain: !secret iot_domain 
  ap:
    ssid: "ESPhome"
    password: !secret iot_password

logger:
  baud_rate: 0
  hardware_uart: UART1

api:

ota:

#IO13      led1       ok
#IO12      led2       ok
#IO01/TX   blue led   ok 
#IO0       switch1    ok?
#IO2       switch2    ok?
#IO15      relay1     ok
#IO16      relay2     ok

binary_sensor:
  - platform: gpio
    id: button1
    #internal: true
    pin:
      number: GPIO00
      mode: INPUT_PULLUP
    on_press:
      - switch.toggle: relay1
  - platform: gpio
    id: button2
    #internal: true
    pin:
      number: GPIO12
      mode: INPUT_PULLUP
    on_press:
      - switch.toggle: relay2

output:
  - platform: gpio
    pin: GPIO13
    inverted: true
    id: led1
  - platform: gpio
    pin: GPIO02
    inverted: true
    id: led2

switch:
  - platform: gpio
    pin: GPIO14
    id: relay1
    name: '${device_name} Relay 1'
    on_turn_on:
      - output.turn_on: led1
    on_turn_off:
      - output.turn_off: led1
  - platform: gpio
    pin: GPIO16
    id: relay2
    name: '${device_name} Relay 2'
    on_turn_on:
      - output.turn_on: led2
    on_turn_off:
      - output.turn_off: led2

status_led:
  pin:
    number: GPIO01 #tx
    inverted: true
1 Like

Tasmota template has some additional info:

GPIO # Component
GPIO00 Button1
GPIO01 LedLinki
GPIO02 Led2i
GPIO03 HLWBL SELi
GPIO04 BL0937 CF
GPIO05 HLWBL CF1
GPIO09 None
GPIO10 None
GPIO12 Button2
GPIO13 Led1i
GPIO14 Relay1
GPIO15 None
GPIO16 Relay2

Here is my Blitzwolf SHP6 ESPHOME configuration file

Functions:

  • Button - ON / OFF
  • When the button on blue LED on
  • When power consumption above 1W red LED on (delayed)
  • after boot turn on the relay
# Blitzwolf SHP6 15A Power Monitoring Plug
# https://templates.blakadder.com/blitzwolf_SHP6-15A.html
substitutions:
  plug_name: blitzwolf_shp6_04
  # Higher value gives lower watt readout
  current_res: '0.00290'
  # Lower value gives lower voltage readout
  voltage_div: '760'

esphome:
  name: ${plug_name}
  platform: ESP8266
  board: esp8285
  on_boot:
    priority: -10
    then:
    # on affter boot
    - switch.toggle: relay

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

logger:

api:

ota:

web_server:
  port: 80

time:
  - platform: homeassistant
    id: homeassistant_time

binary_sensor:
  - platform: gpio
    internal: true
    pin:
      number: GPIO13
      inverted: True
    on_press:
      - switch.toggle: relay
    name: "${plug_name}_button"
        
switch:
- platform: gpio
  name: "${plug_name}_Relay"
  id: relay
  pin: GPIO15
  on_turn_on:
    - switch.turn_on: "${plug_name}_LED_Blue"
  on_turn_off:
    - switch.turn_off: "${plug_name}_LED_Blue"
    - switch.turn_off: "${plug_name}_LED_Red"
- platform: gpio
  internal: true
  name: "${plug_name}_LED_Blue"
  id: "${plug_name}_LED_Blue"
  pin: GPIO2
  inverted: True
- platform: gpio
  name: "${plug_name}_LED_Red"
  internal: true
  id: "${plug_name}_LED_Red"
  pin: GPIO0
  inverted: True
sensor:
  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: True
    cf_pin: GPIO05
    cf1_pin: GPIO04
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    current:
      name: "${plug_name}_Amperage"
      unit_of_measurement: 'A'
      accuracy_decimals: 3
    voltage:
      name: "${plug_name}_Voltage"
      unit_of_measurement: 'V'
    power:
      name: "${plug_name}_Wattage"
      unit_of_measurement: 'W'
      id: "${plug_name}_Wattage"
      on_value_range:
        - above: 2.0
          then:
            - switch.turn_on: "${plug_name}_LED_Red"
        - below: 2.0
          then:
            - switch.turn_off: "${plug_name}_LED_Red"
    change_mode_every: 8
    update_interval: 5s
  - platform: total_daily_energy
    name: "${plug_name}_Total Daily Energy"
    power_id: "${plug_name}_Wattage"
    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'
    unit_of_measurement: days
    update_interval: 300s
    filters:
      - multiply: 0.000011574
# BlitzWolf BW-SHP6 10A Power Monitoring Plug
# https://templates.blakadder.com/blitzwolf_SHP6.html
substitutions:
  plug_name: blitzwolf_shp6_01
  # Higher value gives lower watt readout
  current_res: '0.00290'
  # Lower value gives lower voltage readout
  voltage_div: '940'

esphome:
  name: ${plug_name}
  platform: ESP8266
  board: esp8285
  on_boot:
    priority: -10
    then:
    # on affter boot
    - switch.toggle: relay

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

logger:

api:

ota:

web_server:
  port: 80

time:
  - platform: homeassistant
    id: homeassistant_time

binary_sensor:
  - platform: gpio
    internal: true
    pin:
      number: GPIO13
      inverted: True
    on_press:
      - switch.toggle: relay
    name: "${plug_name}_button"
        
switch:
- platform: gpio
  name: "${plug_name}_Relay"
  id: relay
  pin: GPIO15
  on_turn_on:
    - switch.turn_on: "${plug_name}_LED_Blue"
  on_turn_off:
    - switch.turn_off: "${plug_name}_LED_Blue"
    - switch.turn_off: "${plug_name}_LED_Red"
- platform: gpio
  internal: true
  name: "${plug_name}_LED_Blue"
  id: "${plug_name}_LED_Blue"
  pin: GPIO2
  inverted: True
- platform: gpio
  name: "${plug_name}_LED_Red"
  internal: true
  id: "${plug_name}_LED_Red"
  pin: GPIO0
  inverted: True
sensor:
  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: True
    cf_pin: GPIO05
    cf1_pin: GPIO14
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    current:
      name: "${plug_name}_Amperage"
      unit_of_measurement: 'A'
      accuracy_decimals: 3
    voltage:
      name: "${plug_name}_Voltage"
      unit_of_measurement: 'V'
    power:
      name: "${plug_name}_Wattage"
      unit_of_measurement: 'W'
      id: "${plug_name}_Wattage"
      on_value_range:
        - above: 1.0
          then:
            - switch.turn_on: "${plug_name}_LED_Red"
        - below: 1.0
          then:
            - switch.turn_off: "${plug_name}_LED_Red"
    change_mode_every: 8
    update_interval: 5s
  - platform: total_daily_energy
    name: "${plug_name}_Total Daily Energy"
    power_id: "${plug_name}_Wattage"
    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'
    unit_of_measurement: days
    update_interval: 300s
    filters:
      - multiply: 0.000011574
4 Likes

here is config for Blitzwolf SHP8

substitutions:
  device_name: blitzwolf_shp8_01
  upper_devicename: "BlitzWolf SHP8 01"
  ip: 192.168.xx.xx
  # Higher value gives lower watt readout
  current_res: '0.00221'
  # Lower value gives lower voltage readout
  voltage_div: '825'
  
esphome:
  name: ${device_name}
  platform: ESP8266
  board: esp8285
  comment: Blitzwolf SHP8
  on_boot:
    priority: -10
    then:
      - light.turn_on: ${device_name}_blue_led_light

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pwd
  fast_connect: true
  manual_ip:
    static_ip: ${ip}
    gateway: 192.168.x.x
    subnet: 255.255.255.0
    dns1: 192.168.x.x
    dns2: 8.8.8.8
  ap:
    ssid: "${upper_devicename} Hotspot"
    password: "!secret wifi_pwd"

captive_portal:

logger:

api:

ota:

web_server:
  port: 80

binary_sensor:
  - platform: gpio
    id: ${device_name}_button
    pin:
      number: GPIO3
      inverted: True
      mode: INPUT_PULLUP
    on_press:
      - switch.toggle: ${device_name}_relay
      
  - platform: status
    name: "${upper_devicename} Status"
    id:  ${device_name}_status

output:
  - platform: esp8266_pwm
    pin: GPIO13
    inverted: true
    id: ${device_name}_blue_led

light:
  - platform: monochromatic
    name: "${upper_devicename} Blue LED"
    output: ${device_name}_blue_led
    id: ${device_name}_blue_led_light

switch:
  - platform: gpio
    pin: GPIO14
    id: ${device_name}_relay
    name: '${upper_devicename} Relay'
    on_turn_on:
      - light.turn_off: ${device_name}_blue_led_light
    on_turn_off:
      - light.turn_on: ${device_name}_blue_led_light
  - platform: restart
    name: "${upper_devicename} Restart switch"

sensor:
  - platform: uptime
    name: '${upper_devicename} Uptime'
    update_interval: 60s

  - platform: wifi_signal
    name: "${upper_devicename} WiFi Signal Sensor"
    update_interval: 300s
    id: ${device_name}_wifisignal

  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: true
    cf_pin: GPIO04
    cf1_pin: GPIO05
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    current:
      name: '${upper_devicename} Current'
      unit_of_measurement: 'A'
      accuracy_decimals: 3
      icon: mdi:flash-outline
    voltage:
      name: '${upper_devicename} Voltage'
      unit_of_measurement: 'V'
      accuracy_decimals: 0
      icon: mdi:flash-outline
    power:
      name: '${upper_devicename} Power'
      unit_of_measurement: 'W'
      icon: mdi:flash-outline
    change_mode_every: 4
    update_interval: 5s

text_sensor:
  - platform: wifi_info
    ip_address:
      name: '${upper_devicename} IP Address'
      icon: mdi:ip
  - platform: version
    name: '${upper_devicename} ESPHome Version'
2 Likes

works like a charm, thank you.
how can i tune this values?

plug_name: blitzwolf_shp6_04

Higher value gives lower watt readout

current_res: ‘0.00290’

Lower value gives lower voltage readout

voltage_div: ‘760’

I just received a SHP-7 and a SHP-9 (and some more SHP-6’S) I can’t wait to get the ‘7’ flashed, I have to open the ‘9’ to see if it’s also esp based, I really hope so :slight_smile:

Just try it. If it is not esp based, then it would anyway not accept the flash

It worked, it’s tasmotized now, so tomorrow I’m going to see if I can figure out the pins for it. It’s rather nice, 3 plugs, and two usb ports, and as I read it, they should be individually controllable.
Is there an ‘easy’ path for figuring out the pins?

I’ve made a very rudimentary template for shp9 now, and it’s uploaded to the repository.
It only handles the switches, LED and button, and I still have yet to figure out how to get powermonitoring active on this.