Working config for Blitzwolf BW-SHP7!

I finally got the last few bits working.
The Blitzwolf BW-SHP7 is a dual socket with powermonitoring, it has a button for each socket, and three controllable LED’s (one for each socket and a status).

substitutions:
  device_name: shp7
  # Higher value gives lower watt readout
  current_res: '0.002291'
  # Lower value gives lower voltage readout
  voltage_div: '940'
  # BW-SHP7, dual outlet with powermonitoring.
  # One button for each relay, and one red led for each relay, as well as a blue status led
  # Static IP is configured, and fast_connect is enabled, as the SSID is hidden
  # Webserver is active and pw protected, and the OTA is password protected

esphome:
  name: '${device_name}'
  platform: ESP8266
  board: esp8285
  on_boot:
    then:
      - switch.turn_on: relay1
#      - switch.turn_on: relay2
      
wifi:
  ssid: !secret wifissid
  password: !secret wifipw
#  reboot_timeout: 60min
  manual_ip:
    static_ip: 192.168.1.100
    gateway: 192.168.1.1
    subnet: 255.255.255.0
  fast_connect: true
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${device_name} Hotspot"
    password: !secret appw

logger:
  baud_rate: 0

web_server:
  port: 80
  auth:
    username: !secret webuser
    password: !secret webpw

api:

ota:
  password: !secret otapw

time:
  - platform: homeassistant
    id: homeassistant_time

text_sensor:
  - platform: version
    name: "${device_name} ESPHome Version"
  - platform: wifi_info
    ip_address:
      name: "${device_name} ip"
    ssid:
      name: "${device_name} ssid"

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

output:
   - platform: esp8266_pwm
     id: led1
     pin:
       number: GPIO13
       inverted: true
   - platform: esp8266_pwm
     id: led2
     pin:
       number: GPIO2
       inverted: true

switch:
  - platform: gpio
    pin: GPIO14
    id: relay1
    name: 'relay1'
    on_turn_on:
      - output.turn_on: led1
    on_turn_off:
      - output.turn_off: led1
  - platform: gpio
    pin: GPIO16
    id: relay2
    name: 'relay2'
    on_turn_on:
      - output.turn_on: led2
    on_turn_off:
      - output.turn_off: led2

status_led:
  pin:
    number: GPIO01
    inverted: true

sensor:
  - platform: wifi_signal
    name: '${device_name} wifi signal'
    update_interval: 60s
    accuracy_decimals: 0
  - platform: uptime
    name: '${device_name} uptime'
    unit_of_measurement: days
    update_interval: 300s
    accuracy_decimals: 1
    filters:
      - multiply: 0.000011574
  - platform: hlw8012
    sel_pin:
      number: GPIO03
      inverted: true
    cf_pin: GPIO04
    cf1_pin: GPIO05
    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: 'kW'
      id: power
      accuracy_decimals: 3
      filters:
        - multiply: 0.001
      icon: mdi:flash-outline
    change_mode_every: 4
    update_interval: 10s
  - platform: total_daily_energy
    name: '${device_name} daily energy'
    power_id: power
    unit_of_measurement: kWh
    accuracy_decimals: 5

Please add to https://esphome-configs.io/ now https://www.esphome-devices.com/

1 Like

Ahh, yes of course, will do! :slight_smile:

Hi Fribert,

l ordered SHP7 and then I have found this topic. I didn’t receive it yet but I am trying to prepare everything to set it up. I am doing this first time and I don’t want to break something, so I apologize in advance if I will ask something stupid :slight_smile:
I instaled ESPHome addon in home assistant and created node for SHP7.
My first question is should I pick a “Generic ESP8266” for device type? I picked that one for testing now. Then I deleted everything in “Edit” and I pasted your script here (so here is completly and only your script).
I created secrets.yaml file and edited it with secrets until I pass validation.
Should I change anything else in your script? What about static_ip, should I change it?
Aha I see I am getting this warning in log, so I guess I will have to set a fixed IP for that device in router (when I’ll get it)?
“WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error connecting to 192.168.1.100: [Errno 113] No route to host). Re-Trying in 1 seconds”

What username and passwords are for “web_server”? Are they for home assistant (I don’t have any others)?

Anything else?

Thank you :slight_smile:

It should look like the sample code above.

entirely dependent on your own network.

What do you expect when you have no device?

1 Like

Sorry I don’t understand that. I see in script above platform is ESP8266.
So I assume I should pick a “Generic ESP8266” for device type in wizzard below? I believe this choice is the right one, but I still prefer to ask just in case. Thank you.

choose whatever you like as long as the yaml it produces (and which you can edit if it is wrong) looks like the one posted.

The wizard just creates a basic yaml file, that’s all it does, so it doesn’t matter at all what you choose, as you are going to overwrite that with the code you paste in from the example.
You should of course choose either to just let your router set an IP for it, or set an IP that is in your range.
As this code is going to be flashed into the plug, you of course need the plug, and thus the device inside it, or it will not be able to connect to it.

Hi
I want try flash my new SHP7 but i have a problem. I connect it with my programmer FTDI as show on this screen:

Ground to Ground programmer
VCC to VCC programmer
TX to RX Programmer
RX to TX Programmer
I00 to Ground when i connect programmer to USB. But when connected to USB any LED on SHP7 not flash and light. Nothing. And when try flash it nothoing do. Not send flash. What i done wrong ?

I’ve used the tuya convert 2.3, so I never opened mine up.

But it only works under linux… Tuya converter can not use on windows ?

That is true, it’s a question of getting a cheap (secondhand?) raspberry pi 3b+ and having a cell phone.
But it’s well worth it if this is something you want to pursue for more devices.

1 Like

Ok
How i can find good parameters for:

Higher value gives lower watt readout

current_res: ‘0.002291’

Lower value gives lower voltage readout

voltage_div: ‘940’

to show correct Voltage and WATT ?

I’ve bought a set of bulbs (old fashioned bulbs) of 75W and 100W, and then I just adjust the parameter so it reads the correct value in the sensor.

Hi, this is a clone/copy or the other way around from a Gosund SP211. I have it flashed with ESPhome working marvelous…

BUT

If it runs for about 4 hours in a warmer environment (not hot!) in my homes fuse cabinet it starts to “flash” relays are turning on/off and it is not connected to WiFi anymore.
If I remove it from the cabinet and power it on elsewhere it stat working normal again.

According to google it says:
Working Temperature -20~45℃

I have a few questions.

  • Is this sounding familiar to anyone?
  • Is there (like in shellys) a temperature sensor in itwhich is configurable?
  • Is there a way to work around this? (besides not usings them :-)?

Any thoughts?

Thank you!

1 Like

It sounds familiar to me… I’ve got 5 SHP6 and 1 SHP7, and I’ve got no problems at all with my SHP6 devices. My SHP7 is a different story, since I’ve observed sporadic reboots after random times.
One of the sides of my SHP7 becomes hotter than the environment, so I’m wondering if there’s a similar issue like this one from Shelly 2.5
I’m currently tinkering with my device, but it would be great if someone could provide high resolution photos of the SHP7 motherboard (unfortunately I only have one and I can’t replace it, so I can’t tear it down myself).

I’m currently testing the following config and the device seems to be running warmer now…

binary_sensor:
  - platform: gpio
    pin: GPIO15
    id: gpio15_irq
    internal: true

It would be great if someone with the same issue could check if adding this to the config solves the sporadic reboots and high temperature of the device…

2 Likes

Interesting, I chucked mine a while ago because it was getting so hot (and had a weird noise also).

Hi, I have 2 SHP 7 and just 1 suffered with the above mentioned issue (warmer than usual and lots of sporadic reboots).

I noticed that they are marked with different numbers:

  • Blitzwolf BW-SHP7 3420 - Working fine with esphome.
  • Blitzwolf BW-SHP7 4905 - Warmer and sporadic reboots with esphome.

I hadn’t opportunity to open them to look for differences, but then i saw the @Noltari addition on the GPIO15_irq.
I have applied it to my ESPHome configuration and it works fine, +24h since then and 0 reboots.

I guess that there’s probably some difference on the hardware of the 2 devices revisions. If not the first time that Blitzwolf does it.

Either way, thanks @Noltari !
Great catch!

2 Likes

@rmrebelo many thanks for confirming that the additional config works!
I haven’t experienced any more random reboots since I added it and seems to be stable now:


1 Like

That looks great, good work @Noltari
I’ve reordered a couple of these, I’m going to try and add that to the config.

1 Like