hass-magic_areas
hass-magic_areas copied to clipboard
Impossible to remove a device from an area if removed from HA
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.
I have the same problem right now.. guess I'll have to try recreating the area for now!
Yeah that's kinda tricky to solve due how config_flow
works, but will take a look into it
@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.
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 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.

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 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 thanks a bunch, that worked. Need to reconfig everything again but no worries.
@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 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
Selectors added on #212.
Added some code that might have fixed this, but haven't tested.
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.