Lovelace not able to update input_select when created from states.set

I’m developing a component which creates input_selects on the fly.
so I have

def setup(hass: HomeAssistantType, config: ConfigType) -> bool:
    entity_id = 'input_select.test'
    attributes = {'options': ['one', 'two', 'three', 'four']}
    current_option = 'two'
    hass.states.set(entity_id, current_option, attributes)
    logger.debug(f"Created '{entity_id}' with option '{current_option}'")
    current_state = hass.states.get(entity_id)
    logger.debug(f"{current_state.entity_id} ({}) state after creation is '{current_state.state}'")
    def handle_state_changed(event):
        nonlocal entity_id
        if['entity_id'] != entity_id:
        logger.debug(f"'{entity_id}' changed from {['old_state'].state} to {['new_state'].state}")
    hass.bus.listen(EVENT_STATE_CHANGED, handle_state_changed)
    logger.debug("setup finished")
    return True

This works fine in creating the input_select and I can change (and detect) changes in state in Developer Tools->States.

When I use Lovelace to change the state it appears to work (in Lovelace’s ui) but the log shows

2020-11-11 10:02:11 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities input_select.test

and no EVENT_STATE_CHANGED is fired.
If I refresh the Lovelace page it reverts to the original value (confirming there was no change)
input_select.test does exist as it shows in the list of entities (with the correct integration ‘Input Select’)
What am I doing wrong?


I don’t know how, but as far as I know, you need to register the input select in the entity register, otherwise you get the error you posted. I think you also need to do this in order to make your inout selects survive a restart.

Thanks @Burningstone I think you’re on to it.
I had a look in and it seems the input_select platform entities does not contain my newly created input_select.

Maybe it’s something to do with not having a unique_id…

I’ll have to delve to see how I add my newly created input_select entity to the input_select platform…

Stuck now with chicken and egg
My new input_select entity is not in the entry registry as seen by




returns a state object not an entity

So how do I get my newly created entity in order to add it to the registry?
Also curious how the ui Configuration->Entities shows it - where is it looking?