Last active
May 9, 2021 17:25
-
-
Save yanfali/82c1ccf864042cb5047a4b1636037cd5 to your computer and use it in GitHub Desktop.
Peace By Hampton ESPHome Smort Plug configuration example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the first four pins on the top of the ESP controller are | |
# 1 - 3.3v | |
# 2 - GND | |
# 3 - TX | |
# 4 - RX | |
# I soldered wires and hooked them to a raspberry pi 4 with the serial port enabled. | |
# 3.3v, gnd, tx and rx. Warning you will need a beefy PSU, as the parasitic power draw | |
# of the ESP can brown out the pi, even at 15w. | |
# | |
# ` sudo esptool.py --port /dev/ttyS0 write_flash -fm dout 0x0 hampton.bin` | |
# | |
# You have to pull gpio0 (IO0) down to ground when powering up to put it in programming mode. | |
# If you did it correctly, the red LED will not blink. If not try again. | |
# | |
# These are sold exclusively through best buy. On sale they can be found for as low as 5usd each. | |
# They are manufactured by Intertek. | |
# You can shuck them open like an oyster by gently prying the top cover off. It's held on by glue. | |
# You will need to re-glue or tape it closed afterwards. Other than the funky pin configuration | |
# they seem to work well with ESPHome and Home Assistant. | |
# Basic Config | |
esphome: | |
name: hampton_s01 | |
platform: ESP8266 | |
board: esp8285 | |
wifi: | |
ssid: "myssid" | |
password: "supersekritpassword" | |
logger: | |
api: | |
password: "supersekritpassword" | |
ota: | |
password: "supersekritpassword" | |
sensor: | |
- platform: wifi_signal | |
name: "Hampton WiFi Signal" | |
update_interval: 60s | |
# Uptime sensor | |
- platform: uptime | |
name: "Hampton uptime" | |
# Device Specific Config | |
binary_sensor: | |
- platform: gpio | |
id: push_button | |
pin: | |
number: GPIO4 | |
mode: INPUT_PULLUP | |
inverted: True | |
internal: true | |
on_press: | |
# Prevents unintended LED lit states. | |
if: | |
condition: | |
- switch.is_off: relay | |
then: | |
- switch.turn_on: red_led | |
- switch.turn_on: relay | |
else: | |
- switch.turn_off: relay | |
switch: | |
# The relay switches on the red side of the LED when active. | |
- platform: gpio | |
name: "Hampton Basic Relay" | |
pin: GPIO13 | |
id: relay | |
on_turn_off: | |
if: | |
condition: | |
- switch.is_on: red_led | |
then: | |
- switch.turn_off: red_led | |
# With this we can control the blue side of the LED. | |
- platform: gpio | |
id: red_led | |
pin: | |
number: GPIO5 | |
mode: OUTPUT | |
inverted: False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment