ESPHome sensors unavailable after upgrade

Hi all,
I recently updated Hassio and ESPhome to the latest versions and since then none of my ESP sensors are showing up in HA.

ESPHome shows the devices and I can see them updating values and states, but on HA the status is always unavailable for both binary and temp/humidity.

I recompiled and rebooted and still nothing. I have not tried reverting yet since I’d like to keep everything up to date if I can.

Thanks.

FWIW: After upgrading I’ve seen some sensor, but not all, were showing up unavailable. Later found that somehow sensors were renamed with a _2 suffix.

Can you still see the sensors in Configuration - Integrations - ESPHome: nodename? Or perhaps sensors show up in Configuration - Entity registry as being unavailable?

1 Like

Yes, they show up in Integrations–ESPHome and in the Entity Registry. Didn’t see any duplicates.

Here’s what I see on some nodes after upgrading to 1.14.0. Some unavailable entities were suffixed. Tried to rename by removing the suffix in the Entity Registry so it would correspond to the original name again, but got an error saying the entity name was already in use.

In the end I restarted Hassio, and after that I saw unavailable entities with the original name in the Entity Registry and in the ESPHome integrations page. What I did was delete these original entities after which I could rename the new suffixed entities back. Unfortunately this was seen as a new sensor and history was gone, but I can live with that.

If your issue is different than I’m not sure if I can be of much further help…

Thanks. I ended up removing a node integration and re-adding it. Oddly enough all but two of its sensors (binary) resumed perfectly. Two others added the _2, but are at least available now.

Not sure what went wrong with the upgrade. I’ll see if i can clean up the sensors IDs.

Appreciate the help.

I couldn’t rename the _2 back to the original name. It said they were already registered.

Since it was only 2 things, I just renamed the GUI entities. That should work for now. Odd that it just renamed those two and the others registered as they were before.

I have the same problem with ESPHome entries showing as “unavailable” but my SolarEdge monitoring is also “unavailable”. My entities haven’t changed and the existing ones haven’t incremented number _2.

Is there any way to find the cause of the problem? My log files are not informative.

Are you doing SolarEdge through the API or local? I have a local sensor setup and that monitors my system fine, even after the upgrade.

I imagine it has something to do with discovery – I’d need a coder to verify this, but it seems like HA looks for existing entities, doesn’t find them, discovery finds new entities, and then it makes duplicates. So I’m guessing the problem is why it didn’t find the “existing” entity first. This is just a guess, I’m not a developer.

But I agree, the logs have been unhelpful in trying to solve this.

I have recently added two Xiaomi Mijia (LYWSD03MMC) temperature/humidity sensors to Homeassistant via Esphome. I followed instructions Here:

and

The sensors were flashed with ATC_MiThermometer-master.bin using Teelin Flasher.

The following Yaml file was generated in Esphome and flashed to a new esp32

temphumi1.yaml

substitutions:
  esphome_name: temphumi1
  
esphome:
  name: ${esphome_name}
  platform: ESP32
  board: esp-wrover-kit

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "50241c66c0f25571a65da6c989a6fa0b"

wifi:
  ssid: "*******"
  password: "*********"
#  domain: .****
  
  # Optional manual IP
  manual_ip:
    static_ip: 192.168.0.207
    gateway: 192.168.0.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
#  ap:
#   ssid: "Temphumi1 Fallback Hotspot"
#   password: "uac78awPoBZz"

captive_portal:

time:
  - platform: homeassistant
  
esp32_ble_tracker:

switch:
  - platform: gpio
    name: “${esphome_name}-Onboard-LED”
    pin: 2
    inverted: True

  - platform: restart
    name: ${esphome_name}  -restart
    id: restart_switch

sensor:
  - platform: uptime
    name: “${esphome_name}_Uptime Sensor”

  - platform: wifi_signal
    name: “${esphome_name} WiFi Signal”
    update_interval: 60s
    
  - platform: xiaomi_lywsd03mmc
    mac_address: A4:C1:38:73:26:04
    bindkey: "A1101A63CDAF068EF5B9FDA5155314B1"
    temperature:
      name: "1 Temperature"
    humidity:
      name: "1 Humidity"
    battery_level:
      name: "MiniVideoTemp Battery Level"

  - platform: xiaomi_lywsd03mmc
    mac_address: A4:C1:38:D9:D6:37
    bindkey: "fdf3c69bdb487f790370c82e0e8fb74e"
    temperature:
      name: "2 Temperature"
    humidity:
      name: "2 Humidity"
    battery_level:
      name: "MiniVideoTemp Battery Level"

The device does show in Integrations and is pingable from another nwtwork PC.

temphumi1
ESPHome
1 device and 9 entities

Device temphumi1
Manufacturer espressif
Model ESP-WROVER-KIT
Area Living Room
Integration ESPHome
Battery 80 %

The selected entities are:

Name
Entity ID
Integration
Area
Status

${display_name} Humi
sensor.display_name_humi
ESPHome

${display_name} Pres
sensor.display_name_pres
ESPHome

${display_name} Temp
sensor.display_name_temp
ESPHome

However the status of all three entities is “unavaillable”

The whole sytem and all components have been restarted several times with no effect.

In addition, some other unrelated sensors (mainly switches on a multi outlet powwer strip are now “unavailable” although they were working fine previously.

The states on the Developer Tools page appears to show informations that indicates the sensors are working normally:

sensor.1_humidity
1 Humidity
41 state_class: measurement
unit_of_measurement: %
friendly_name: 1 Humidity
device_class: humidity
sensor.1_temperature
1 Temperature
80.6 state_class: measurement
unit_of_measurement: °F
friendly_name: 1 Temperature
device_class: temperature
sensor.2_humidity
2 Humidity
40 state_class: measurement
unit_of_measurement: %
friendly_name: 2 Humidity
device_class: humidity
sensor.2_temperature
2 Temperature
80.6 state_class: measurement
unit_of_measurement: °F
friendly_name: 2 Temperature
device_class: temperature

I am hoping others have solved this problem.

Thanks for Preformatted textyour time.

Kerry

Take a look at the documentation Xiaomi Mijia BLE Sensors — ESPHome

If you using the ATC Flash then you have to change it to the following.

sensor:

  • platform: atc_mithermometer

Did anybody find a solution to the problem of ESPHOME sensors becoming unavailable but reappearing as new sensors with a _2 suffix?
I have a built a multisensor of which two of it’s temperature sensors are having this issue.
They measure the outdoor temperature and the temperature of my swimming pond and I don’t want to lost the long term statistics of these sensors (the new feature introduced in Home Assistant around August last year).

To answer my own question:
I had made a backup of the long term statistics in the MySQL database, and then went and deleted the original sensor so that I could rename the one with the _2 suffix to have the original name.
The backup wasn’t necessary as the long term statistics were not deleted and for new measurements now used the renamed sensor :slight_smile: Not sure whether it’s a bug or a feature but great for my situation.