devices.esphome.io

Blitzwolf BW-SHP6 Socket with powermonitoring

Blitzwolf BW-SHP6 Socket with powermonitoring

Device Type: plug
Electrical Standard: eu
Board: esp8266

General Notes

Model reference: BW-SHP6

Manufacturer: BlitzWolf

There are two versions of this plug, a 10A version and a 15A version. The pinout seems to be the same.

Product

GPIO Pinout

PinFunction (<2020)Function (>2020)
GPIO0Red LED (inverted)Red LED (inverted)
GPIO2Blue LED (inverted)Blue LED (inverted)
GPIO4HLW8012 - CF1
GPIO5HLW8012 - CFHLW8012 - CF
GPIO12HLW8012 - SELHLW8012 - SEL
GPIO13Button (inverted)Button (inverted)
GPIO14HLW8012 - CF1
GPIO15RelayRelay

HLW8012 Calibration Values

Value<2020>2020
Current0.002900.00117
Voltage940755

Basic Config

The configuration has some default sensors for wifi reporting, etc.

substitutions:
device_name: shp6
# Higher value gives lower watt readout
current_res: "0.00290"
# Lower value gives lower voltage readout
voltage_div: "940"
# Max Power is 3450W for 15A and 2300W for 10A
max_power: "3450"
# 2020 model uses GPIO4 for CF1
cf1_pin: GPIO14
# BW-SHP6, outlet with powermonitoring.
# One button for the relay, and one red led for the 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}"
on_boot:
then:
- switch.turn_on: relay
- output.turn_on: led
esp8266:
board: esp8285
# OTA flashing
ota:
- platform: esphome
wifi: # Your Wifi network details
# Enable fallback hotspot in case wifi connection fails
ap:
# Enabling the logging component
logger:
# Enable Home Assistant API
api:
# Enable the captive portal
captive_portal:
# Enable the Web Server component
webserver:
# Button configuration
binary_sensor:
- platform: gpio
name: "${device_name} button"
id: button
pin:
number: GPIO13
inverted: true
on_press:
then:
- switch.toggle: relay
# Setup of LED's used in displaying Switch status
output:
- platform: gpio
pin: GPIO0
inverted: true
id: led
# Config for switch
switch:
- platform: gpio
pin: GPIO15
restore_mode: RESTORE_DEFAULT_OFF
id: relay
name: "${device_name} Relay"
on_turn_on:
- output.turn_on: led
on_turn_off:
- output.turn_off: led
# Status LED for connection
status_led:
pin:
number: GPIO2
inverted: true
# Sensors for Voltage (V), Current (A), Power (W), Daily energy usage (kWh)
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: true
cf_pin: GPIO5
cf1_pin: ${cf1_pin}
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"
id: power
icon: mdi:flash-outline
on_value_range:
- above: ${max_power}
then:
- output.turn_off: led
- switch.turn_off: relay
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
filters:
- multiply: 0.001

Advanced config additions

Starting with ESPHome v1.16.1 the hlw8012 platform sensor now supports energy, so we can add the following to the hlw8012 platform sensor and get rid of the total_daily_energy platform sensor and the homeassistant time sensor:

sensor:
- platform: hlw8012
energy:
name: "${device_name} Energy"
unit_of_measurement: "Wh"
icon: mdi:flash-outline

Send a notification to Home Assistant when max power is exceeded.

sensor:
- platform: hlw8012
---
power:
name: "${device_name} Power"
unit_of_measurement: "W"
id: power
icon: mdi:flash-outline
on_value_range:
- above: ${max_power}
then:
- output.turn_off: led
- switch.turn_off: relay
- homeassistant.service:
service: persistent_notification.create
data:
title: Message from ${device_name}
data_template:
message: Switch turned off because power exceeded ${max_power}W
Edit this page on GitHub