Config Flow with Custom Component

I’m working on a component that’s not quite ready for prime time (keeping it in custom_components for now) but I want to implement Config Flow for it.

The documentation states the component has to be added to config_entries.FLOWS which is part of HA.

Is there a way to make this work?

3 Likes

I’m also interested in getting the answer.
+1

I’m also in process of developing custom component - it will be kept in custom_components folder. I will try to develop it with minimal scope.

Found answer by myself. So in short: CUSTOM_COMPONENTS don’t use config_flow (as for HA 0.93.2).
Usage of config flow is defined in file config_entries.py (https://github.com/home-assistant/home-assistant/blob/master/homeassistant/config_entries.py) and is hard coded for now for closed list of compoenents. So unless custom_component doesn’t overwrite one of those components - it will not be able (AFAIK) to run config_flow.py

I am interested to know what the future plans for config_flow with custom components is.
The docs say:

This option is currently only available for built-in components.

which makes it sound like there are plans to enable it for custom components. Does anyone have any details on this?

PR was merged to allow this, latest version works.

https://github.com/home-assistant/home-assistant/pull/24946

1 Like

Has anyone managed to make this work by following the documentation? I am struggling at the moment, and would love to see an example of a very simple config flow

There is a lyric component that is waiting to be merged that I’ve been using as a custom component with success.

Thanks kylerw, I think I am up and running now.

Hi,

Any idea of when the native Lyric will be added? I’d like to avoid doing this via custom components, if I can help it.

If you don’t have the final version in the pipeline yet, what form will the final implementation take? Will it be like the “cover: myq” platform integration for my garage door opener?


cover:

  • platform: myq
    username: !secret myq_user
    password: !secret myq_pass
    type: liftmaster

    Thanks,

Ambi

Has anyone successfully implemented config_flow for a custom_component?

I’m using the anniversaries custom component and this uses config flows:

I installed it over HACS and there was no reboot required in oder to create entitites over to UI.

With two steps.

some help,

Ok so I am having a weird issue with a custom component config flow.

When I run the component as a normal component in my development container, not in “custom_components” but as a standard component, it works fine.

When I run it on my production machine in the “custom_components” , the config flow dialogs don’t pick up the strings, so the dialog boxes are empty.

Anybody knows what is going on?

I believe you need a strings.json to get those to show up (and possibly a language translation file). See: https://aarongodfrey.dev/home%20automation/building_a_home_assistant_custom_component_part_3/#translations and https://developers.home-assistant.io/docs/internationalization/custom_integration/#translation-strings

2 Likes

Hi thank you for the tip!

Turns out I needed an en.json file in /translations and you have to flush the browser cache for any effects to take place.

1 Like

Oh for @#%@#$ sake. I’ve been trying to work out why the heck my custom component config flow boxes had no descriptive text for two days before I thought to search the forum and found this post. Thank you for finally putting me out of my misery!

1 Like