BW-SHP2 flashen mit esphome

Um den ESP in den flash-Modus zu bringen, sollte GND und IO0 verbunden werden.

substitutions:
  plug_name: bw_shp2
  # Higher value gives lower watt readout
  current_res: "0.00221"
  # Lower value gives lower voltage readout
  voltage_div: "934"

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

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

logger:

web_server:
  port: 80

api:
  password: !secret api_password

ota:
  password: !secret ota_password

time:
  - platform: homeassistant
    id: homeassistant_time

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO3
      inverted: True
    name: "${plug_name}_Button"

switch:
- platform: gpio
  name: "${plug_name}_Relay"
  pin: GPIO14
  restore_mode: ALWAYS_ON
- platform: gpio
  name: "${plug_name}_LED_Blue"
  pin: GPIO1
  inverted: True
  restore_mode: ALWAYS_OFF
- platform: gpio
  name: "${plug_name}_LED_Red"
  pin: GPIO13
  inverted: True
  restore_mode: ALWAYS_OFF

sensor:
  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: True
    cf_pin: GPIO04
    cf1_pin: GPIO05
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    current:
      name: "${plug_name}_Amperage"
      unit_of_measurement: A
    voltage:
      name: "${plug_name}_Voltage"
      unit_of_measurement: V
    power:
      name: "${plug_name}_Wattage"
      unit_of_measurement: W
      id: "${plug_name}_Wattage"
    change_mode_every: 8
    update_interval: 10s

  - platform: total_daily_energy
    name: "${plug_name}_Total Daily Energy"
    power_id: "${plug_name}_Wattage"
    filters:
        - multiply: 0.001
    unit_of_measurement: kWh

  - platform: uptime
    name: ${plug_name}_Uptime Sensor