Input_select.set_options not working with options generated by Jinja

Here’s an example python_script that fills an input_select from a group with entities.

group = data.get('group')
input_select = data.get('input_select')

if group is not None and input_select is not None:
    group_entities = hass.states.get(group).attributes['entity_id']
    list = []
    for e in group_entities:
        list.append(e)
    service_data = {'entity_id': input_select,
                    'options': list}
    hass.services.call('input_select', 'set_options', service_data)
else:
    logger.warning('Missing arguments!')

It’s called at HA start with:

      - service: python_script.group2input_select
        data:
          group: 'group.all_switches'
          input_select: 'input_select.all_switches'

The script was from @pnbruckner, if i remember it right.

2 Likes