Just wanted to share some info on on getting ESPHome running on these fairly inexpensive relays from Costco (Model: BPPLUG/WIFI/WP/2 UPC: 017801722086):
Here is the process and my YAML used for flashing these devices:
- Compile the ESPHome YAML configuration below after changing the names and wifi information / API passwords
substitutions:
deviceName: general_switch_1
prettyDeviceName: General Switch 1
esphome:
name: $deviceName
platform: ESP8266
board: esp8285
wifi:
ssid: "SSID"
password: "Password"
# Connect without wifi scanning, needed for hidden networks, forces connection to first AP
fast_connect: on
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${prettyDeviceName} Fallback"
password: "Password"
captive_portal:
# Enable Over the Air updates
ota:
password: "Password"
# Enable Home Assistant API
api:
password: "Password"
# Enable logging
logger:
baud_rate: 9600
# Status LED
status_led:
pin:
number: GPIO4
inverted: yes
binary_sensor:
- platform: gpio
id: button
pin:
number: GPIO13
mode: INPUT_PULLUP
inverted: True
on_press:
- switch.toggle: $deviceName
output:
- platform: gpio
id: relay_status
pin: GPIO5
inverted: yes
switch:
- platform: gpio
id: $deviceName
name: $prettyDeviceName
pin: GPIO12
on_turn_on:
- output.turn_on: relay_status
on_turn_off:
- output.turn_off: relay_status
-
Remove the three screw from the rear of the device
-
Using an FTDI cable (3.3V logic, not 5V), connect it to the header according to the silk screen, remember to connect the FTDI TX to RX and the FTDI RX to TX on the board. Also, connect a jumper between the near by Ground (GND) to the IO0 pin as this will put the ESP into flash mode when power is applied by the the FTDI cable. Lastly connect the 3V supply from the FTDI cable (shown as dark red cable in picture below to power the ESP into flash mode.
-
Flash the device using either esphome or esptool.py
-
Profit.