Chicken and egg dilemma with input_select

Gradually I’m going through my configuration trying to cleanup all errors and warnings in log file, that can be remediated by proper configuration. Now I faced issue that I’m not able to resolve (perhaps it is not possible :frowning: ).
So, I use Twinkly integration to control my Christmas lights. Everything works fine, but I do not like how effects are handled. Currently I have input_select that stores (as options) list of effects configured on device. I can change effects from UI via this helper. It is populated at HA start with list of available options from integration. Obviously these might change over time, so selection is not fixed. And here comes the problem; when input_select is defined in configuration.yaml, it is required to provide the list of options, that I do not know upfront. Only after integration is initialised I can use automation to populate it with actual list. So at startup options list contains just one dummy option - None, that obviously is not valid one. And this is causing warning in log file:

026-01-11 16:06:07.379 WARNING (MainThread) [homeassistant.components.input_select] Current option: - None no longer valid (possible options: 0 Carnival, 1 Bright Tribe, 2 Neon, 3 Rosy Valentine, 4 Wed. Day Blues, 5 Snake, 6 Inferno)

I created additional input_text helper that holds the most recently selected option and tried to use it in template to define input_select options list, but seems options are not temptable:

input_select:
  twinkly_effects:
    name: Twinkly Effects
    options: >-
      - {{ states('input_text.twinkly_effect') }}

It throws exacly the same error at HA start. It is annoying, as it resets the selected option to the first on the list, which is not recent. Again I can add automation to use input_text to restore previously selected effect, but the ultimate goal is to get rid of warning message in log. Any advice?

Why “seems”… it’s documented that only a list is accepted:

If templates were accepted it would say template next to “options”, not list.


If you want to use a template to define the options, you need to use a Template Select.

1 Like

Do you could put an option that exists on the device as the option you set in configuration.yaml.

Then when you rebuild it, the selected option still exists and the warning goes away.

1 Like

This is how I do my input selects I use for room occupancy modes.

Everyone starts ‘Vacant’

1 Like

Yes, I can; issue is that I’d need to reconfigure input_select every time that eventually this option goes away (not a big deal, usually I configure it once per season). I’m just looking for permanent solution (that I stated might not exist).

Looks promising… never used this, so need to learn :+1:

1 Like