ESP32 connected, but unavailable in frontend

That is the correct method.

The Esphome application (which you can use standalone, or by an addon) has nothing to do with integration to home assistant.

I had this problem, the solution in my case was to remove underscores from the hostname.

I have created a PR to hopefully prevent this from affecting anyone else.

Hi @Aussi ,

thank you very much for this solution. been searching for days and this is the solution for me (had the same problem!)

unfortunately, after a restart of HA, all sensors are no longer available. Anyone have a solution for this?

Similar symptoms and exact same workaround happening on one of my esphome devices as well.

Note that it is just the one, and I have many others doing similar esphome devices that do not have this issue. I also observed it doesnā€™t correlate to just restarting the serverā€¦ in my case sometimes HA loses connection randomly, for no apparent reason. The device in question, yes does have somewhat weaker wifi, but it has for years and there are other esphome devices in the same room that are still working with even weaker signals. Also hard for me to pin wifi drop on this, since doing the tango with the disable/enable gets it working every timeā€¦ and not to mention the esphome logs are working as expected while it is ā€œlost to HAā€ (that would be impossible without good wifi).

So to me this seems to be a bug with esphome or HA. I want to help if possible to fix this issue, as the device in question is a very important one for my install. The sooner I can get it reliable again, the less nagging Iā€™ll have to hear from the natives. Iā€™m not a dev, but tech savvy enough to capture logs, wireshark, etc.

Just wanted to report what I found out sinceā€¦ it seems the issue is related to enabling the esphome encryption feature on the particular device. After commenting out the lines enabling encryption, the problem has gone away altogether.

Note that I still have the rest of my numerous esphome devices using encryption without issues. So I am guessing there is some incompatibility with the features on that particular device when used with encryption. Along those lines, Iā€™m sharing the yaml config for the device that is having issues with encryption:

substitutions:
  name: "garage"
  friendly_name: "Garage"

# Custom esp12f device
esphome:
  name: ${name}
  platform: ESP8266
  board: d1_mini
  on_boot:
    then:
      - switch.turn_off: beeper
      - switch.turn_off: relay

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${friendly_name} Fallback Hotspot"
    password: "also some secret"

captive_portal:

# Enable logging to get dallas address
logger:
  
# Enable HA API
api:
  password: !secret garage_password
  encryption:
    key: !secret encryption_key
# Enable ota
ota:
  password: !secret ota_password
# description         GPIO  D1 mini
#-------------------------------------------------
# relay               15    D8     // relay input pin (must stay low on power up)
# motion              13    D7     // motion output pin
# s-Tx                12    D6     // software serial
# s-Rx                14    D5     // software serial
# built in LED        2     D4     // status
# nc                  0     D3     // na
# scl                 4     D2     // i2c clock pin
# sda                 5     D1     // i2c data pin
# beeper              16    D0     // Beeper input pin
  
i2c:  
  sda: GPIO5
  scl: GPIO4
  frequency: 100kHz
  
uart:
  tx_pin: GPIO12
  rx_pin: GPIO14
  baud_rate: 9600

dfplayer:

binary_sensor:
  - platform: status
    name: "${friendly_name} Status"
    
  - platform: gpio
    pin:
      number: GPIO13
      mode: INPUT
    name: "${friendly_name} Motion"
    device_class: motion
    

text_sensor:
  - platform: homeassistant
    name: "ESPhome Voice"
    internal: true
    entity_id: input_text.esphome_voice
    on_value:
      then:
        - dfplayer.set_volume: 25
        - delay: 150ms
        - dfplayer.play_folder:
            folder: 1
            file: !lambda return atoi(x.c_str());
            
sensor:
  - platform: wifi_signal
    name: "${friendly_name} WiFi Signal"
    update_interval: 60s
        
  - platform: bh1750
    name: "${friendly_name} Luminance"
    address: 0x23
    update_interval: 10s
    
  - platform: bme280
    temperature:
      name: "${friendly_name} Temperature"
      oversampling: 16x
    pressure:
      name: "${friendly_name} Pressure"
      filters:
      - lambda: return (x + 3.0);
    humidity:
      name: "${friendly_name} Humidity"
    address: 0x76
    update_interval: 60s
    
status_led:
  pin:
    number: GPIO2
    
switch:
  - platform: gpio
    name: "${friendly_name} Opener Relay"
    pin: GPIO15
    id: relay
    icon: mdi:garage
    on_turn_on:
    - delay: 500ms
    - switch.turn_off: relay
    
  - platform: gpio
    name: "${friendly_name} Beeper"
    pin: GPIO16
    id: beeper
    internal: true
    icon: mdi:volume-low
    
  - platform: template
    name: "${friendly_name} Beeps 2"
    turn_on_action:
    - switch.turn_on: beeper
    - delay: 50ms
    - switch.turn_off: beeper
    - delay: 50ms
    - switch.turn_on: beeper
    - delay: 50ms
    - switch.turn_off: beeper
    
  - platform: template
    name: "${friendly_name} Beeps 3"
    turn_on_action:
    - switch.turn_on: beeper
    - delay: 50ms
    - switch.turn_off: beeper
    - delay: 50ms
    - switch.turn_on: beeper
    - delay: 50ms
    - switch.turn_off: beeper
    - delay: 50ms
    - switch.turn_on: beeper
    - delay: 50ms
    - switch.turn_off: beeper
    
  - platform: template
    name: "${friendly_name} Beeps 5"
    turn_on_action:
    - switch.turn_on: beeper
    - delay: 50ms
    - switch.turn_off: beeper
    - delay: 50ms
    - switch.turn_on: beeper
    - delay: 50ms
    - switch.turn_off: beeper
    - delay: 50ms
    - switch.turn_on: beeper
    - delay: 50ms
    - switch.turn_off: beeper
    - delay: 50ms
    - switch.turn_on: beeper
    - delay: 50ms
    - switch.turn_off: beeper
    - delay: 50ms
    - switch.turn_on: beeper
    - delay: 50ms
    - switch.turn_off: beeper

So, simply commenting out:

  encryption:
    key: !secret encryption_key

Gets it working again. Weā€™ll see what comes of thisā€¦ hereā€™s the issue report on github for those interested: