hass-magic_areas icon indicating copy to clipboard operation
hass-magic_areas copied to clipboard

Impossible to remove a device from an area if removed from HA

Open grinco opened this issue 3 years ago • 11 comments

One of the lights that has been used as night light for an area was removed from HUE. After that I wasn't able to remove it from the appropriate area, neither I was able to update the area as HA was reporting invalid configuration. I had to remove the area and re-create to get it fixed. Can you implement a cleanup mechanism? Thanks.

grinco avatar Dec 16 '21 13:12 grinco

I have the same problem right now.. guess I'll have to try recreating the area for now!

Patrick1610 avatar Dec 23 '21 14:12 Patrick1610

Yeah that's kinda tricky to solve due how config_flow works, but will take a look into it

jseidl avatar Jan 03 '22 10:01 jseidl

@jseidl Just a suggestion, for those selectable dropdowns, HA's version allows for text edit in the field as well as select. Wouldn't this be an appropriate solution? I'm not sure if the dev api gives you access to the same elements as they use. It should do.

Bodge-IT avatar Jan 06 '22 10:01 Bodge-IT

It should. They get autogenerated from the values tho, I'm not aware on how to force a given element. If you see another custom_component that does that let me know and I can look into their code

jseidl avatar Jan 06 '22 12:01 jseidl

@jseidl Just went through all my integrations and couldn't find it in use anywhere. The only place I have seen it is in Automations/Scripts I think. Is it not just an additional, perhaps off-the-books option for that form element? Frenk or Balloob should be able to help.

Bodge-IT avatar Jan 06 '22 12:01 Bodge-IT

Screenshot of Home Assistant (04-04-2022, 12-44-31)

Same here - now I can not change any settings for an Area because an entity that was deleted was still in the Magic Area settings. I cannot save. Error thrown as in screenshot. Logs set to debug but nothing of interest is logged.

Is it possible to remove this manually, if so, from where?

haakonstorm avatar Apr 04 '22 10:04 haakonstorm

@haakonstorm the solution to this is to delete the area from MA and restart HA. MA will recreate the area for you, that will fix the issue but you may have to do some re-config.

Bodge-IT avatar Apr 04 '22 11:04 Bodge-IT

@Bodge-IT thanks a bunch, that worked. Need to reconfig everything again but no worries.

haakonstorm avatar Apr 04 '22 13:04 haakonstorm

@jseidl new HA UI selectors in 2022.4 https://rc.home-assistant.io/docs/blueprint/selectors/#device-selector Might help with MA configuration UI?

Bodge-IT avatar Apr 05 '22 10:04 Bodge-IT

@Bodge-IT Those are looking nice! All depends if they're gonna backport or make them a generic interface so those selectors apply to config_flow as well. Config flow doesn't let us (from the best of my knowledge) to hint which kind of selector we want, we just say it's an entity_id field and that is multiple. That's what mostly caused the checkbox hell we have today because the UI thinks since we only have a couple of entries that I would prefer checkboxes (which I don't).

Fingers crossed that this makes into config flow or they allow us devs to hint the selector we want!

@haakonstorm glad Bodge was able to help out, I still have this pending to see if I can check if the entity was removed prior to loading the form

jseidl avatar Apr 06 '22 03:04 jseidl

Selectors added on #212.

Added some code that might have fixed this, but haven't tested.

jseidl avatar Jul 09 '22 06:07 jseidl

I think for a while now, after several updates to config flow and the work you have added to Magic Areas, this is no longer an issue. A deleted entity is now easy to remove from a Magic Area config. OK to close.

Bodge-IT avatar Mar 01 '23 08:03 Bodge-IT