Customize display value of combobox items for integration config flow

I have a config flow defined for my custom integration, and one of my configuration options is a single-select dropdown of values. This is configured via vol.In, and generally works:

vol.Required(
   CONF_PUBLISH_MODE,
   default="all",
): vol.In(["all", "value_changed", "any_changed"])

My problem is that I’d like to offer a more user-friendly display value for each of these entries, but I’m forced to show the “internal” value here. Is there a way to show a translatable, friendly display value for each of these permitted values?

Bumping for visibility. Has anyone else come across this before?

I’m going to… any solutions?

Just checking in – has anyone come up with a clever solution to this?

Use the new selectors where you can also use a dict to specify label: value to make it looks nicer.

1 Like

@gjohansson thanks for the pointer, this is exactly what I was looking for!

References:

1 Like