[Solved] 1 of 26 Xiaomi Sensor gone Unavailable

I have Aqara hub and 26 various temp/door/pir sensors located around the house. All was working fine for some time.

Now one of the sensors has been showing as offline for a couple of weeks now in Home Assistant, but it is working fine in the Xiaomi Home app.

Screenshot_2

Not sure which way to go as all the other sensors are working and I never added the sensors they were auto discovered through the settings in the config file.

Screenshot_3

Same here xiaomi hub is messed in 0.106. Not sure why they have to change things in new version.

I am still working on this problem.

I did this today with no success.

  1. Lots of googling.
  2. Went into Mi app, held down on the sensor and deleted it and the re-bound it to the app.
  3. Went into HA Configuration (menu) > Entities > Deleted the PIR sensor.
  4. Restarted HA core.
  5. Power cycled Xiaomi hub.
  6. Went back to Configuration (menu) > Entities sensor had not appeared.

I guessing that HA stores the entities in a yaml file maybe and would like to delete it from here maybe this will help.

Why is HA doesn’t like this sensor even though it works happily in the MI app and was working in HA for over 12months.

It has to stored somewhere in HA other than the entity list, the only place I have been able to find so far is in /config/.storage/core.entity_registry

As HA is not 1.0 yet, things are expected to change. Please provide a debug log of the Xiaomi integration and an exact step by step guide on what you are doing to resolve the situation. You can’t expect people to magically fix it for you without gives as much info as you can on the issue :wink:

I have posted what I have done already.

If there is something more specific that will help I would love to include it, I just am limited in knowledge as what to post and where to get it from but I can follow instruction.

You did not disable it by accident ?

It was in this list, it was enabled but showing as unavailable. This is the area where I deleted the entity from HA.

This is what shows now in the Entities area.
My camera, switch and the battery level for the missing sensor.

The battery level is using MQTT integration

Yes.

I used @NotoriousBDG battery alert https://community.home-assistant.io/t/howto-create-battery-alert-without-creating-a-template-for-every-device/30576?u=three

Since I deleted the Woodpile PIR sensor from the entities today I notice another one has become unavailable.

Screenshot_2

Seeing as though the original one that was unavailable happened along time ago and hasn’t come back online since but none of the other sensors have had issues until today when I deleted the woodpile PIR.

I am thinking in terms of lines of code eg there is deletion code which was stopping at the woodpile PIR but now it is gone it moves to the next line of code.

With that I remember the battery code in the above link was creating duplicate entities and I implemented some code to cleanup the duplicates which I feel now maybe behind it.
https://community.home-assistant.io/t/howto-create-battery-alert-without-creating-a-template-for-every-device/30576/665?u=three

I run out of time today to check but I think it might be something?

I weighed up how long I was spending on this and that it appeared to be what I felt some kind of bug created during the 0.105 update of HA.

So I chose the quickest path for me and that was:

  1. I run through Virtualbox Machine so I chose to setup new installation.
  2. Created new image and downloaded fresh copy of Home Assistant “HA”.
  3. Got to the stage where I was logged into new latest version of HA.
  4. Shut down opened my old image and load up old HA and Exported (Lovelace code, nodered code, addon settings)
  5. Close the old HA and open the new HA and paste in lovelace code, node red code and addon settings).

My issue is not resolve I have a door count and all my sensors are present.