ESPHome - Blitzwolf BW-SHP6 configuration

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
5 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.

HI,

I have a BW-SHP6 15A. I flashed it first with Tasmota. The reading where ok. But I prefer ESPHome. So I used one of the configs here:

substitutions:
  plug_name: blitzwolf_shp6
  # 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: !secret ssid
  password: !secret wifi_password

# Enable logging
logger:

# Enable Home Assistant API

  
web_server:
  port: 80

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: 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
    icon: mdi:clock-alert
      
# Extra sensor to keep track of plug uptime
  - platform: uptime
    name: ${plug_name}_Uptime Sensor
    icon: mdi:clock-outline
    unit_of_measurement: days
    update_interval: 300s
    filters:
      - multiply: 0.000011574

Unfortunately, the Voltage and Amperage stay 0?? The wattage is correct. Anyone an idea? Or is the latest SHP6 using a different chip? (BL0937 and is not supported?)

I have had the same problem, the problem is wrong configuration.
i used this https://community.home-assistant.io/t/esphome-blitzwolf-bw-shp6-configuration/113938/12

Thanks, but unfortunately this won’t work either? Could it be that they changed the hardware?

Can you double check this line under the sensor section.
cf1_pin: GPIO04

It has to be 04 and not 14

Aha, That’s the failure! Overlooked! Thanks it is working now ! :grinning: :+1:

I like the idea of using the red led to show if there is power consumption above a certain threshold!

But does anyone know how to make a binary sensor out of that? Something that would have the value True if power => 10 W for instance, and False if < 10W.

Oh wait I can just comment out internal: true from the declaration of the LED_Red :slight_smile:

Hi all.I am a beginner and i have 5-6 BW-SHP6 .i running HA on PI 3 .did a solution for upgrade ower the air software to works wit home assistant ?? that is for me now the only option.

or any link for buying 3d printed flash tool

Thanks

It depends of the version of software in you SHP6. But you can do it also without 3D printed part, just more attention is needed.

But I did not even try to flash my lates batch of Blitzwolf smart sockets, since local integration https://github.com/rospogrigio/localtuya works perfectly

And how would you set that if for example power is below 10w is blue and when above 10w is red?

Andrej did i understand you right, SHPG can work with HA without any extra flashing of device like sonoff ??? i need power monitoring from devices.

regards

i connect SHP6 with Smart life and i see a device in HA Tuya integration but no any possibility to use like sensors for now .any solution ??

do NOT use Tuya integration!
You have to use LocalTuya integration from https://github.com/rospogrigio/localtuya

The trickies part here is only to get the LocalKey, but the instructions are good so there should be no issue. Then you can have full energy monitoring with the options you want, as if you would flash it. Also the communication is only local, so if you do not want to share data with tuya cloud, you can simply block them on router after everything is set