My garage door opener randomly goes offline in Home Assistant(I can still ping it so it’s connected to wifi still). When I go into ESPHome I can’t connect to it via the esphome api. It will then randomly come back online but keeps doing this throughout the day randomly.
The weird thing is that I had the same issue with a Meross garage door opener which was connected via Apple Homekit to Home Assistant. I have a Crafstman garage door opener if that helps.
I have it connected to 1 relay with an esp32 just like the diagram below except minus the one reed sensor(I only have 1 connected).
Here is my code:
esphome:
name: garage
friendly_name: Garage
esp32:
board: esp32dev
framework:
type: arduino
debug:
update_interval: 5s
text_sensor:
- platform: debug
device:
name: "Device Info"
reset_reason:
name: "Reset Reason"
# Enable logging
logger:
level: debug
# Enable Home Assistant API
api:
encryption:
key: "XXXXXXXXXXXXXXXXXXXXXXXX"
ota:
- platform: esphome
password: "XXXXXXXXXXXXXXXXXXXX"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 172.16.20.9
gateway: 172.16.20.1
dns1: 172.16.20.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Garage Fallback Hotspot"
password: "XXXXXXXXX
captive_portal:
switch:
- platform: gpio
pin: GPIO4
name: " Switch"
id: garage_switch
restore_mode: ALWAYS_OFF
binary_sensor:
# This is the magnetic reed switch, used to determine if the door is closed.
- platform: gpio
pin:
number: GPIO13
mode: INPUT_PULLUP
filters:
# During testing- the reed switch was pretty noisy. This cleans up the output.
- delayed_on: 100ms
- delayed_off: 100ms
id: reed_switch
internal: true
cover:
- platform: template
name: "Door"
lambda: |-
if (id(reed_switch).state) {
return COVER_OPEN;
} else {
return COVER_CLOSED;
}
open_action:
- switch.turn_on: garage_switch
- delay: 0.5s
- switch.turn_off: garage_switch
close_action:
- switch.turn_on: garage_switch
- delay: 0.5s
- switch.turn_off: garage_switch