jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
191 stars 46 forks source link

Lost all my switches after latest update. #234

Closed jiipee-blob closed 4 months ago

jiipee-blob commented 7 months ago

Title says it all.

"Hubitat doesn't provide this integration anymore...."

image

They all seem to be switches.

AJolly commented 6 months ago

I've tested it four times, Every time my entities get duplicated. Whats the best way to debug? I've got a full backup immediately before Upgrading and after with the duplicated entities If that helps.

jason0x43 commented 6 months ago

You're definitely updating directly from 0.9.8 to 0.9.19, without installing any versions in between? I've tested that upgrade path a number of times and haven't seen any devices be duplicated, but my testing setup isn't that complex, so I'm certainly not covering every case.

If you could show me the complete entries for one of the original entities and a new duplicated entity from core.entity_registry, that would be helpful.

jason0x43 commented 6 months ago

@pwestbro Hmmm...those entries are for different entities -- one is the switch control entity, and one is a power sensor entity for the switch. Do you happen to have the entry for switch.basement_workshop_plug (without the _2) from when that one was working?

AJolly commented 6 months ago

Yes directly. I dont think my setup is that complex.

From one of my runs (to be explicit, these are both entries in the core.entity_registry after the upgrade): { "aliases": [], "area_id": null, "capabilities": null, "config_entry_id": "7e9002253bdaa6bd9d0561f8453512a6", "device_class": null, "device_id": "da21b84277efee06d362072dc69aab74", "disabled_by": null, "entity_category": null, "entity_id": "switch.chilicube", "hidden_by": null, "icon": null, "id": "f673ca9c74d6ae3ff4b4016afe3297c9", "has_entity_name": false, "name": null, "options": { "conversation": { "should_expose": true } }, "original_device_class": "outlet", "original_icon": null, "original_name": "ChiliCube", "platform": "hubitat", "supported_features": 0, "translation_key": null, "unique_id": "3c8d42788f40ec8a85df0a917f31b06b0cd0d2202afad9f75b5db0c132ce504c::4::switch::power_meter", "previous_unique_id": null, "unit_of_measurement": null },

  {
    "aliases": [],
    "area_id": null,
    "capabilities": null,
    "config_entry_id": "7e9002253bdaa6bd9d0561f8453512a6",
    "device_class": null,
    "device_id": "da21b84277efee06d362072dc69aab74",
    "disabled_by": null,
    "entity_category": null,
    "entity_id": "switch.chilicube_2",
    "hidden_by": null,
    "icon": null,
    "id": "1a63b7844ffdc7d037f8ff771141aebb",
    "has_entity_name": false,
    "name": null,
    "options": {
      "conversation": {
        "should_expose": true
      }
    },
    "original_device_class": "outlet",
    "original_icon": null,
    "original_name": "ChiliCube",
    "platform": "hubitat",
    "supported_features": 0,
    "translation_key": null,
    "unique_id": "3c8d42788f40ec8a85df0a917f31b06b0cd0d2202afad9f75b5db0c132ce504c::4::switch::power",
    "previous_unique_id": null,
    "unit_of_measurement": null
  },
jason0x43 commented 6 months ago

Ah, I think I may know what's going on. There may be some issues around how power meter switches are handled (I don't have any of those in my normal suite of test devices). Looking into it...

jason0x43 commented 6 months ago

This should be fixed in v0.9.20.

Wipeout944 commented 6 months ago

I've gone to .20 and can confirm I'm no longer seeing issues. Thank you, @jason0x43!

pwestbro commented 6 months ago

Thank you @jason0x43! Things are working for me as well

AJolly commented 6 months ago

Works for me!

On Fri, Jan 12, 2024, 7:46 PM Jason Cheatham @.***> wrote:

This should be fixed in v0.9.20.

— Reply to this email directly, view it on GitHub https://github.com/jason0x43/hacs-hubitat/issues/234#issuecomment-1890150952, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAWKZNWYMW2PPMFFMZPA7LYOHDNHAVCNFSM6AAAAABBI2OFJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJQGE2TAOJVGI . You are receiving this because you commented.Message ID: @.***>

markus99 commented 6 months ago

I installed Hubitat back in early December (.9.8 or so I believe). Worked fine. Upgraded to 0.9.19 and saw the duplicate (_2) switch issue. Updated my ~40 outlets (delete 'old', rename 'new') and all was fine. Just upgraded to 0.9.20 and again seeing the _2 duplicates.

Tried reading through above thread, and feels like the 'new' entities should be w/ the correctly created unique_id, but given that 0.9.20 is again creating dupes - maybe not?

jason0x43 commented 6 months ago

V0.9.20 restored the pre-0.9.12 id format (which was never meant to change), so if you had switch entities that only used the 0.9.12-0.9.19 id format, you’ll end up with duplicates since V0.9.20 will create entities using the original id format.

markus99 commented 6 months ago

Ugh, sounds like I either need to do a ton of find / replace in a text editor - or go thru, AGAIN, the process of deleting a renaming 40+ entities. Less than ideal for sure... Thx for the clarification here @jason0x43

jason0x43 commented 6 months ago

You could try shutting down HA and editing the entries in .storage/core.entity_registry. You should just need to change :power to :power_meter at the end of the switch entity unique IDs.

jason0x43 commented 4 months ago

I'm closing this since the core issue is fixed.