Enable setting up integration via ConfigFlow UI
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)
- [x] add config_flow.py and modify manifest.json #174
- [x] fuse the config flow result into same format as configuration.yaml
- [x] add async_setup_entry() to main and all platforms
- [x] ensure entities are correctly created
- [x] ~~add UI section to rename Containers~~ (added but later removed)
- [x] tidy up and make ready for review and merge
- [x] ~~investigate why sometimes some containers return None from
container.get_info()for device registry~~ (container info no loger used at device registry) - [x] add a re-configuration dialog to change settings after finalization #178
- [x] add a re-authorization dialog if connection to docker is lost #179 #183 (fix)
- [x] investigate if it makes sense to add the
async_step_import()method that will convertconfiguration.yamlintoconfig_entry. #181 - [x] add template function for managing entry version migration #182
- [ ] investigate and fix why removed entities at reconfigure stays as unavailable until restart of Home Assistant
If you want to I could attempt to fix this on my fork of the repo
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 ;-)
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
I am briefly testing it (do not have extremely a lot of time), the following things we need to investigate/do more:
- The naming of existing YAML entries are a bit messy (cannot recognize them now ;-)). Prefix does not seem to be used?
- Reconfigure is required, because just too many things to configure
- 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!
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 ;-)
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 ;-)
Good feedback, I'll rebase my local repo with your config_flow branch and continue to work on the reconfigure steps.
Thanks :-) I am also working on improving the load/unload of the DockerAPI/DockerContainerAPI (and cancelling all tasks and making the entities unavailable ;-))
Op ma 20 jan 2025 om 11:42 schreef DanielV @.***>:
Good feedback, I'll rebase my local repo with your config_flow branch and continue to work on the reconfigure steps.
— Reply to this email directly, view it on GitHub https://github.com/ualex73/monitor_docker/issues/173#issuecomment-2602061363, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQASXDA33KOOCM4VU5HTPT2LTHIHAVCNFSM6AAAAABVFIAMECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBSGA3DCMZWGM . You are receiving this because you commented.Message ID: @.***>
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 ;-)
Aha :-) my mistake, if you can add it to your pull then it is re-added
Op ma 20 jan 2025 om 12:54 schreef DanielV @.***>
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 ;-)
— Reply to this email directly, view it on GitHub https://github.com/ualex73/monitor_docker/issues/173#issuecomment-2602224381, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQASXDVZZ3HYENRTYRG5QD2LTPYBAVCNFSM6AAAAABVFIAMECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBSGIZDIMZYGE . You are receiving this because you commented.Message ID: @.***>
Aha :-) my mistake, if you can add it to your pull then it is re-added
Yes, part of #178
With latest https://github.com/ualex73/monitor_docker/pull/179 it should be mostly done from my side unless you find something more.
Also consider if you want https://github.com/dala318/monitor_docker/pull/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.
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.