Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable setting up integration via ConfigFlow UI #173

Open
11 of 12 tasks
dala318 opened this issue Jan 14, 2025 · 13 comments
Open
11 of 12 tasks

Enable setting up integration via ConfigFlow UI #173

dala318 opened this issue Jan 14, 2025 · 13 comments

Comments

@dala318
Copy link

dala318 commented Jan 14, 2025

Although the configuration.yaml setup works using the UI to setup the integration in much more user-friendly.
(It also is an enabler to group entities to devices, https://developers.home-assistant.io/docs/device_registry_index/#automatic-registration-through-an-entity)

  • add config_flow.py and modify manifest.json
  • fuse the config flow result into same format as configuration.yaml
  • add async_setup_entry() to main and all platforms
  • ensure entities are correctly created
  • add UI section to rename Containers
  • tidy up and make ready for review and merge
  • investigate why sometimes some containers return None from container.get_info() for device registry (container info no loger used at device registry)
  • add a re-configuration dialog to change settings after finalization Add Reconfigure flow #178
  • add a re-authorization dialog if connection to docker is lost Add Re-Authorization configuration step #179 fixed in Fix Re-Authorization #183
  • investigate if it makes sense to add the async_step_import()method that will convert configuration.yaml into config_entry. Draft proposal in Add import from configuration.yaml #181
  • add template function for managing entry version migration Add base for managing config_entry version migration #182
  • investigate and fix why removed entities at reconfigure stays as unavailable until restart of Home Assistant
@dala318
Copy link
Author

dala318 commented Jan 14, 2025

If you want to I could attempt to fix this on my fork of the repo

@ualex73
Copy link
Owner

ualex73 commented Jan 15, 2025

if you want to take a stab at it, please do ... but the biggest problem with the current yaml, there are a LOT of possible configuration options ;-)

@dala318
Copy link
Author

dala318 commented Jan 16, 2025

Yes, I have noticed so :-)
I think it will be a three step setup-process (1: connect to host, 2: select containers, 3: select options)
But want to re-use as much as possible from the original set-up process so have to convert the result back so it look identical as if it was originating from the configuration.yaml

@ualex73
Copy link
Owner

ualex73 commented Jan 17, 2025

I am briefly testing it (do not have extremely a lot of time), the following things we need to investigate/do more:

  1. The naming of existing YAML entries are a bit messy (cannot recognize them now ;-)). Prefix does not seem to be used?
  2. Reconfigure is required, because just too many things to configure
  3. Seems I cannot re-add a docker entry, after I deleted it?

But I am happy with the current work, you have done a lot ! Thanks!

@ualex73
Copy link
Owner

ualex73 commented Jan 17, 2025

Tomorrow I will make some changes for entity_id and name of the sensors/switches to get it a bit aligned. Also, we need to think if certain options can be removed in the UI config (which were handy/needed in YAML). Enough things to think about ;-)

@ualex73
Copy link
Owner

ualex73 commented Jan 19, 2025

Friendly name, entity id and unique id is "not" fun ... HA links friendly name and entity id, so the renaming/aliasses/etc configuration in the YAML/UI is not useable anymore.
I refactored this a bit in the sensor.py/switch.py in the new branch.

Cleaned up also the config flow with items which should not be in the UI.

I will refactor the init/run a bit more, because "certain" code starts running in the background during the config_flow run ... Which should not ;-)

@dala318
Copy link
Author

dala318 commented Jan 20, 2025

Good feedback, I'll rebase my local repo with your config_flow branch and continue to work on the reconfigure steps.

@ualex73
Copy link
Owner

ualex73 commented Jan 20, 2025 via email

@dala318
Copy link
Author

dala318 commented Jan 20, 2025

During your clean-up of config_flow.py a self.data.update(user_input) was removed from async_step_containers() which makes the selection of containers not being stored ;-)

@ualex73
Copy link
Owner

ualex73 commented Jan 20, 2025 via email

@dala318
Copy link
Author

dala318 commented Jan 21, 2025

Aha :-) my mistake, if you can add it to your pull then it is re-added

Yes, part of #178

@dala318
Copy link
Author

dala318 commented Jan 23, 2025

With latest #179 it should be mostly done from my side unless you find something more.

Also consider if you want dala318#5. It will import settings from configuration.yaml and then render them useless (unless you manually remove the config-entry in UI and restart HA, then they will get re-imported)
I first thought of adding it as a separate PR to you but as it's based on above PR I could not rebase it on config_flow branch.

@ualex73
Copy link
Owner

ualex73 commented Jan 26, 2025

I am trying to rework the entry reload/unload. At this moment when api.init() is called, it will always give an exception on an error (previously true can be returned). I haven't tested everything yet, but setup config flow is working.

I am not out what the "best" approach is, so that is work in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants