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

Add config flow (UI) configuration option #2068

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

Conversation

dan-r
Copy link

@dan-r dan-r commented May 8, 2024

Implements config flow configuration whilst retaining support for YAML configuration. Resolves #2016.

There's some automated testing needed, but I'd appreciate some community testing with this fork as so far I've only tested with a few areas local to me.

Customise functionality is not supported as this time, but the basic functionality (incl. ICS) is there.

This feature borrows very heavily from the config_flow branch, but takes a different approach with how sources are handled. Instead of templating the language and constants files, a JSON list of sources is written by update_docu_links.py and read during the config flow.

Config.flow.setup.mov

@dan-r dan-r marked this pull request as ready for review May 9, 2024 10:00
@5ila5
Copy link
Collaborator

5ila5 commented May 10, 2024

  • Seems to work fine I had an error but could not reproduce it again for some reason (logs, see below).
  • I think it would be nice to "move" the wizards to the UI. I thought about a check whether the source or module has a specific method providing values to select.
  • Type checking: what about an optional dictionary containing types of attributes. It might be nice to have to also be able to set vol.Exclusive as we have a lot of sources you can either configure with some kind of ID and with an address (e.g. jumomind_de allows city street house_number or city_id and area_id)
  • low priority and maybe not even wanted but showing the ICS YAMLs in the specific country could lead to the ICS mask with the to-dos shown on top of the configuration fields. Maybe allow to specify default values in the yaml (like regex method or specific data)

General stuff I noticed while looking at the code:

  • why is the first step named user and not country?
  • comment above async_step_source is wrong

one time error log:

  File "/workspaces/core/config/custom_components/waste_collection_schedule/config_flow.py", line 112, in async_step_args
    ] = cv.string if default is None else cv_map[type(default)]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: TextSelector.__init__() got an unexpected keyword argument 'type'

@dan-r
Copy link
Author

dan-r commented May 10, 2024

Thanks for your feedback on these changes!

I think it would be nice to "move" the wizards to the UI. I thought about a check whether the source or module has a specific method providing values to select.

Interesting - I hadn't spotted the sources with wizards. I'll take a look into that.

Type checking: what about an optional dictionary containing types of attributes.

Agreed, I'll look into that.

It might be nice to have to also be able to set vol.Exclusive as we have a lot of sources you can either configure with some kind of ID and with an address (e.g. jumomind_de allows city street house_number or city_id and area_id)

Agreed. I couldn't see a good way to intepret this type of input requirement. It would be a fair bit of initial work but maybe its worth introducing a JSON (or other machine readable) 'definition' of each source?

low priority and maybe not even wanted but showing the ICS YAMLs in the specific country could lead to the ICS mask with the to-dos shown on top of the configuration fields. Maybe allow to specify default values in the yaml (like regex method or specific data)

Seems reasonable - I didn't go any further with ICS because I wanted to keep it as 'generic' as possible. There were a couple of things like request headers that I'd like to add support for in the UI.

why is the first step named user and not country?

'user' is the first step the UI setup wizard calls. See this table. You could have a step called country thats called straight away from the user step though...

comment above async_step_source is wrong

Fixed :)

one time error log:

That looks to be caused by my type 'guessing' logic. I'll see if I can reproduce that.

@muchcodesuchwow
Copy link

muchcodesuchwow commented May 13, 2024

I never used this integration, because the setup process looked complicated to me. I am a newbie to this integration and gave this PR a try.

The waste collection in my city in germany is provided by "app_abfallplus_de". The following problem is not unique to my city, I have tried several others with "app_abfallplus_de".

In the last step of the setup a lot of fields are shown, but only a few are lablled. I dont know what to enter there. Somewhere my street has to be entered, but i dont know where. When i press enter, it tells me, that not all the required fields have been filled in, but these fields are not highlighted.
grafik

I want to note, that if i use "Generic" (for ICS) in the next step i am asked for a source, but only ICS is the option. This step can be skipped imo, if "Generic" is selected.
grafik

@5ila5
Copy link
Collaborator

5ila5 commented May 25, 2024

I made some updates dan-r#1 @dan-r what do you think? (fixes @muchcodesuchwow issue as well)

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

Successfully merging this pull request may close these issues.

[Feature]: Config Flow (UI) setup
3 participants