ESP32 connected, but unavailable in frontend

Hi.

I have a bird house where I have installed an ESP32-cam, dallas temperature sensor and a PIR sensor. Everything worked OK, except for random disconnects. I adjusted the settings and everything seemed to work fine. Then, later in the day the sensors and camera image on the frontend became unavailable.

I checked the EspHome UI and the ESP is still green/connected, logs show everything working as it should, but the frontend entities show as unavailable.

I have tried ;

  • Toggle power on ESP32cam
  • OTA update.
  • Restart EspHome add-on
  • Restart Home Assistant
  • Reboot RPi
  • Another OTA update

Anyone else experience the same?
I could try re-flashing the .bin file, but itā€™s a nightmare removing and re-installing the ESP from the bird house.

YAML ;

substitutions:
  hostname: 'host'
  ssid: 'SSID'
  password: 'PSSWD'
esphome:
  name: $hostname
  platform: ESP32
  board: esp32dev
wifi:
  ssid: $ssid
  password: $password
  manual_ip:
    static_ip: 192.168.xxx.xx
    gateway: 192.168.xxx.xx
    subnet: 255.255.xxx.x
  fast_connect: True
  power_save_mode: none
api:
  reboot_timeout: 0s
ota:
logger:
  level: VERBOSE

# ESP32-CAM
esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32

  name: name
  # ... Frame Settings
  resolution: 400x296
  jpeg_quality: 18
  idle_framerate: 0.05 fps
  max_framerate: 5 fps 

  # ... Temperatur sensor
dallas:
  - pin: 12
    update_interval: 30s
    
sensor:
  - platform: dallas
    address: 0x16051701D54C000X
    name: "temperatur"
    
  # ... motion sensor
    
binary_sensor:
  - platform: gpio
    pin: 13
    name: "motion"
    device_class: motion
    
# Flashlight
output:
  - platform: gpio
    pin: GPIO4
    id: gpio_4
light:
  - platform: binary
    output: gpio_4
    name: $hostname light

Logs ;

INFO Reading configuration /config/esphome/xx.yaml...
INFO Starting log output from xxx using esphome API
INFO Connecting to xxx:xx (xxxx)
INFO Successfully connected to 192.168.2xx.xx
[17:56:55][I][app:100]: ESPHome version 1.14.3 compiled on Apr  1 2020, 07:51:27
[17:56:55][C][wifi:415]: WiFi:
[17:56:55][C][wifi:283]:   SSID: [redacted]
[17:56:55][C][wifi:284]:   IP Address: 192.168.xxx.xx
[17:56:55][C][wifi:286]:   BSSID: [redacted]
[17:56:55][C][wifi:287]:   Hostname: 'xxxx'
[17:56:55][C][wifi:291]:   Signal strength: -49 dB ā–‚ā–„ā–†ā–ˆ
[17:56:55][C][wifi:295]:   Channel: 6
[17:56:55][C][wifi:296]:   Subnet: 255.255.xxx.x
[17:56:55][C][wifi:297]:   Gateway: 192.168.xxx.x
[17:56:55][C][wifi:298]:   DNS1: 0.0.0.0
[17:56:55][C][wifi:299]:   DNS2: 0.0.0.0
[17:56:55][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'motion'
[17:56:55][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[17:56:55][C][gpio.binary_sensor:016]:   Pin: GPIO13 (Mode: INPUT)
[17:56:55][C][gpio.output:010]: GPIO Binary Output:
[17:56:55][C][gpio.output:011]:   Pin: GPIO4 (Mode: OUTPUT)
[17:56:55][C][logger:175]: Logger:
[17:56:55][C][logger:176]:   Level: DEBUG
[17:56:55][C][logger:177]:   Log Baud Rate: 115200
[17:56:55][C][logger:178]:   Hardware UART: UART0
[17:56:55][C][light:177]: Light 'light'
[17:56:55][C][esp32_camera:043]: ESP32 Camera:
[17:56:55][C][esp32_camera:044]:   Name: cam
[17:56:55][C][esp32_camera:045]:   Board Has PSRAM: YES
[17:56:55][C][esp32_camera:047]:   Data Pins: D0:5 D1:18 D2:19 D3:21 D4:36 D5:39 D6:34 D7:35
[17:56:55][C][esp32_camera:048]:   VSYNC Pin: 25
[17:56:55][C][esp32_camera:049]:   HREF Pin: 23
[17:56:55][C][esp32_camera:050]:   Pixel Clock Pin: 22
[17:56:55][C][esp32_camera:051]:   External Clock: Pin:0 Frequency:20000000
[17:56:55][C][esp32_camera:052]:   I2C Pins: SDA:26 SCL:27
[17:56:55][C][esp32_camera:053]:   Reset Pin: -1
[17:56:55][C][esp32_camera:074]:   Resolution: 640x480 (VGA)
[17:56:55][C][esp32_camera:097]:   JPEG Quality: 10
[17:56:55][C][esp32_camera:099]:   Contrast: 0
[17:56:55][C][esp32_camera:100]:   Brightness: 0
[17:56:55][C][esp32_camera:101]:   Saturation: 0
[17:56:55][C][esp32_camera:102]:   Vertical Flip: ON
[17:56:55][C][esp32_camera:103]:   Horizontal Mirror: ON
[17:56:55][C][esp32_camera:120]:   Test Pattern: NO
[17:56:55][C][dallas.sensor:070]: DallasComponent:
[17:56:55][C][dallas.sensor:071]:   Pin: GPIO12 (Mode: INPUT)
[17:56:55][C][dallas.sensor:072]:   Update Interval: 30.0s
[19:17:17][D][dallas.sensor:077]:   Found sensors:
[19:17:17][D][dallas.sensor:080]:     0x16051701D54C00X
[19:17:17][C][dallas.sensor:085]:   Device 'temperatur'
[19:17:17][C][dallas.sensor:085]:     Unit of Measurement: 'Ā°C'
[19:17:17][C][dallas.sensor:085]:     Accuracy Decimals: 1
[19:17:17][C][dallas.sensor:085]:     Icon: 'mdi:thermometer'
[19:17:17][V][dallas.sensor:085]:     Unique ID: 'dallas-16051701D54C000X'
[19:17:17][C][dallas.sensor:093]:     Address: 0x16051701D54000X
[19:17:17][C][dallas.sensor:094]:     Resolution: 12
[19:17:17][C][ota:029]: Over-The-Air Updates:
[19:17:17][C][ota:030]:   Address: 192.168.2xx.xx:xxxx
[19:17:17][C][api:095]: API Server:
[19:17:17][C][api:096]:   Address: 192.168.2xx.xx:xxxx
[17:57:00][D][dallas.sensor:148]: 'temperatur': Got Temperature=26.4Ā°C
[17:57:00][D][sensor:092]: 'temperatur': Sending state 26.43750 Ā°C with 1 decimals of accuracy
[17:57:02][D][esp32_camera:157]: Got Image: len=11382

While you were tinkering with it, did the entities change name, or it may have thought there were duplicates and appended a number? When you go to configuration-> integrations, do you see your bird house esp unit? If not, try re adding it.

Yes, I should have added that to my original post ;
The unit shows in Configuration -> integrations.
All the entities show as well, but as unavailable.
Core register does not show any duplicates.
The static ip address from .yaml matches the reserved ip in my router settings.
My routers app shows ESP as connected to the 2.4ghz bandwith with excellent signal.

If it were me, Iā€™d readd it

1 Like

By re-add, do you mean deleting it from integrations and then adding again? As in the attached picture?

I deleted a different integration once, and it just deleted the entities and I never managed to get it working again, thatā€™s why Iā€™m a bit apprehensive.

I make no warranty, but Iā€™ve deleted then readded my esp device with no issues. One possibility is if you registered it with an IP address and the esp ip changed, I believe this requires you to readd it.

The worst thing that had happened to me is having to rename my entity_ids if they get duplicated. Maybe you back up your ha folders including your .storage directory before you do it.

Most esp32 cam devices need an external antenna, and the onboard antenna is disconnected. Have you checked?

Thanks, that worked. In case it can help others I will describe what I did ;

  • Copied the YAML from EspHome Dashboard node to a text file.
  • Deleted the integration via ā€œConfiguration -> Integrationsā€
  • Deleted the node from EspHome Dashboard.
  • Added a new node with same name.
  • ā€œEditā€ node.
  • Paste original YAML back in.
  • Go to ā€œConfigurationā€ -> Restart server -> Discovery found the integration again.

Regarding antenna :
My board came configured to onboard antenna, which was ok for indoor use. Not great, but it worked. Outdoor was no chance.

Making a connection between two pads is how you choose the configuration. The guide says you need to move the 0 ohm resistor between the pads, but thatā€™s not the case. You can have connection between both pairs. Be careful though, the pads and the antenna connector itself is very fragile to overheating and mechanical stress.

Say itā€™s configured to onboard antenna, and you want to use external : All you need to do is put a small blob of solder between the two pads for external antenna. No need to move the resistor. I wrapped a solid core 24 awg wire around the soldering iron tip and slowly melted solder onto it, until it dripped onto the two pads for external antenna.

Signal went from around 75-88 to 45-50 after switching to external antenna, and now it works fine 7 meters from the house.

1 Like

Did re adding it stop it from being unavailable all the time?
All my esp devices do that all the time andncant find a fix

Yes, itā€™s been online since then (yesterday).
If I understand correctly, your devices are intermittently unavailable?

My node was green/connected at EspHome Dashboard, but itā€™s entities was permanently unavailable in the frontend. Re-adding solved that.

Hi, I have the same problem on one of my many 8266 sonoff s20 outlets. Iā€™m running HASSIO and this problem happened after upgrading to the latest HA.
Can you explain what you mean by copy YAML, Iā€™m running standard frontend without any modifications.

When you delete the node, the yaml configuration is gone. You want to keep the yaml configuration text for the new node you will create, so you donā€™t have to set everything up from scratch again.

Sonoff 20, example :

esphome:
  name: <NAME_OF_NODE>
  platform: ESP8266
  board: esp8285
  arduino_version: 2.4.2

wifi:
  ssid: <YOUR_SSID>
  password: <YOUR_PASSWORD>

api:

logger:

ota:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Sonoff S20 Button"
  - platform: status
    name: "Sonoff S20 Status"


switch:
  - platform: gpio
    name: "Sonoff S20 Relay"
    pin: GPIO12

output:
  # Register the green LED as a dimmable output ....
  - platform: esp8266_pwm
    id: s20_green_led
    pin:
      number: GPIO13
      inverted: True

light:
  # ... and then make a light out of it.
  - platform: monochromatic
    name: "Sonoff S20 Green LED"
    output: s20_green_led
  • Go to ā€œEspHome Dashboardā€
  • Go to ā€œEditā€
  • Mark all yaml text and copy
  • Save in a text file
  • Create new node and paste the yaml text back in

This is just how I did it, maybe there is an even easier way to do it.

Thanks, so you copied the esphome yaml for later. - I have actually done the same when I have flashed many sonoffs.

I have had some sever syncronisations problems earlier when I have deleted integrations, entity and devices from the HA configuration GUI.

At that time I was left with a complete unsycronized DB so Iā€™m really scared to fiddle around to much!

So in what order did you remove the devices from HA?
And btw, did you have to reflash the 8266 via the serial interface or could you use the OTA in some way?

Thanks, so you copied the esphome yaml for later

Exactly.

I have had some sever syncronisations problems earlier when I have deleted integrations, entity and devices from the HA configuration GUI.

Yes, me too. I took snapshot before doing anything. But in this process I had no problems what so ever.

So in what order did you remove the devices from HA?

  • Copied the YAML from EspHome Dashboard node to a text file.
  • Deleted the integration via ā€œConfiguration ā†’ Integrationsā€
  • Deleted the node from EspHome Dashboard.
  • Added a new node with same name.
  • ā€œEditā€ node.
  • Paste original YAML back in.
  • Go to ā€œConfigurationā€ ā†’ Restart server ā†’ Discovery found the integration again.

And btw, did you have to reflash the 8266 via the serial interface or could you use the OTA in some way?

My setup is space limited and everything is tight, fiddly and glued together. Lucky enough, OTA worked without problems.

You do realise that the presence, or lack thereof, of the esphome yaml has nothing to do with your esp device being recognised in home assistant?

Can you elaborate?

The Esp integration entities became available in Home Assistant after deleting the integration and then re-adding it.

The yaml, or rather the firmware binary, should still be in the Esp, right? I could do without re-uploading to Esp, but did it anyway. Is that what you mean?

I mean that copying or moving your esphome yaml files has nothing to do with whether the flashed device is visible in home assistant.

Yes, I do realise that.

Then why are you copying, pasting, etc?