Hi All!
So I’ve just recently started trying out ESPHome, and so far it has been a fun exercise (aside from some headaches flashing the device initially - hardware isn’t my thing), but now I’m hitting an issue.
I flashed 2 of these plugs with ESPHome and then connected them to home assistant. Now, I’m seeing frequent updates to the sensors, but making changes to the relay state is difficult if even possible. When I toggle it, it might respond 1 in 5 times, or after an extended delay like half a minute
I’ve followed the guides, so I’m kind of at a loss for what I could have done wrong. Does anyone have any suggestions? Both of my plugs have the same issue, and the following config (with different name and IP):
name: my-plug-name
friendly_name: My Plug Name
esp8266:
board: esp12e
early_pin_init: false
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "[SECRET]"
ota:
- platform: esphome
password: "[SECRET]"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.84.68
gateway: 192.168.86.1
subnet: 255.255.252.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "My-Plug-Name"
password: "[SECRET]"
captive_portal:
uart:
rx_pin: RX
baud_rate: 4800
parity: EVEN # required since 2024-08
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "button"
on_press:
# Ensure the switch always operates the relay
- switch.toggle: relay
- platform: status
name: "status"
sensor:
- platform: wifi_signal
name: "wifi_signal"
update_interval: 60s
- platform: cse7766
current:
name: "current"
accuracy_decimals: 2
voltage:
name: "voltage"
accuracy_decimals: 2
power:
name: "power"
accuracy_decimals: 2
id: power
- platform: integration
name: "energy"
sensor: power
time_unit: h
state_class: measurement
unit_of_measurement: kWh
filters:
- multiply: 0.001
- platform: total_daily_energy
name: "Total Daily Energy"
power_id: power
time:
- platform: sntp
id: the_time
switch:
- platform: gpio
name: "relay"
pin: GPIO12
id: relay
restore_mode: ALWAYS_OFF
status_led:
pin:
number: GPIO13
inverted: True
It’s probably worth noting the issue isn’t Wi-Fi signal - the sensors on both update regularly and show Wi-Fi signal on the order of -30 dBm
Also, I wanted to note I’m intentionally not averaging the values over a time period. Getting updates to one of the sensors frequently is essential for my project - even the once every two seconds updates I’m getting by default isn’t perfect and I’d love to drop that below once a second
Does anyone have any thoughts how to fix it? I’m really out of ideas at this point