gcobb321 / icloud3_v3

iCloud3 v3, Development Version - This Repo/Version is used for development and testing of new and updated features. It is not the official release of iCloud3 v3, .
MIT License
169 stars 13 forks source link

Unable to delete non existing sensors ... are the no UUIDs defined for the sensors? #339

Open chichi1967 opened 1 month ago

chichi1967 commented 1 month ago

I have now the 3rd time the issue that I get all sensors of 5 devices (115!) with _2 as extension and all without _2 are listed as not existing anymore, but I cannot delete them from the gui as HA is missing a unique ID (UUID). If this is true is it possible to create a UUID for each sensor when it is created?

gcobb321 commented 1 month ago

The sensor has a Unique ID when it is created by iCloud3 (devicename_sensor.name)

Here is my entry in the entity registry (config/.storage.core.entity_registry):

        "aliases": [],
        "area_id": null,
        "categories": {},
        "capabilities": null,
        "config_entry_id": "01J4Y63PB7D1941MHC6M2GVK95",
        "created_at": "1970-01-01T00:00:00+00:00",
        "device_class": null,
        "device_id": "f94061492855ab63f03e50163cce4eb0",
        "disabled_by": null,
        "entity_category": null,
        "entity_id": "sensor.gary_iphone_home_distance",
        "hidden_by": null,
        "icon": null,
        "id": "1c0f1a1998cddb9f78da267a2aa82e1f",
        "has_entity_name": false,
        "labels": [],
        "modified_at": "2024-08-10T13:02:15.745520+00:00",
        "name": null,
        "options": {},
        "original_device_class": null,
        "original_icon": "mdi:map-marker-distance",
        "original_name": "Gary HomeDistance",
        "platform": "icloud3",
        "supported_features": 0,
        "translation_key": null,
        "unique_id": "icloud3_gary_iphone_home_distance",
        "previous_unique_id": null,
        "unit_of_measurement": null
      },

I think the the problem is when HA recreates the entities (and I do not know why it does this), HA does not create the Unique ID. I will see if there is a way to go back through the entity registry and rename them back to what they were originally. Can you send your _config/.storage/core.entity_registry and core.device_registry to geekstergary@gmail.com and reference this issue. Then I will be able to see the before and after and maybe able to come up with an easy way to scan the registries and put thing back the way they were.

chichi1967 commented 1 month ago

Thanks for checking in to this one ... as I was not even able to use purge to get rid of these entitities I restored the backup from 3 hours ago (update HA to newest version) as this was the easiest way to fix it. As I didn't create a backup before restoring I have no chance to send these data - sorry.

But another question - is it possible that this happened due to reloading of the icloud app via the gui instead from inside the integration? As my new phone that didn't show up even after 10 minutes I restarted the integration from the HA gui and I think this was quite close to the point were the trouble started.

gcobb321 commented 1 month ago

It could be. When it reloaded, HA would see the entities already exist and create new ones. I have removed the reload from the Configure > Actions already for other reliability reasons.

gcobb321 commented 2 weeks ago

Closed with the v3.1.1 Release. Create a new issue if you continue to experience this problem.