I’m making a timer like this, I want it can let any entity auto turn off after countdown.
But now i have an issue. I can’t make input select auto fill.
I try to searching and I found this Fill Input select
But I don’t know how to use it. The python script is setup, but I don’t know how to let the input select use it.
Yes, I set input select ready.But i don’t really know how dose that python script work. Did I need add some variable in the input select options to let that python script fill it? Or I need to add all entity friendly name to options manual?
Hi! Sorry, I bookmarked your post when you first asked for help with this (in the other topic) but haven’t gotten around to going back through all the posts I bookmarked yet!
Anyway, the idea is to create an automation that will call the script when HA starts so that it can populate the list of options in the input_select. Then you’ll need to customize the script for your particular situation.
Do you really want all entities to be put in the list, or just entities of certain types (such as switches, lights, etc.)?
You need to add this to configuration.yaml to enable use of python_scripts:
python_script:
Then you create a directory in your config directory (i.e., the directory that contains configuration.yaml) named python_scripts. Then you put a file in there named update_entities.py, with this content (assuming you do want all entities):
If you want some subset of entities, just let me know what you want. Also, this populates the input_select options list with entity_id’s. If you’d rather use friendly_name’s, just let me know that, too.
You can see I trying to put the double quotation marks on different place, but error report still appear.
Invalid config for [automation]: Entity ID > {{ (states|selectattr('attributes.friendly_name','eq', states('input_select.general_timer_entities'))|list) [0].entity_id }} is an invalid entity id for dictionary value @ data['condition'][0]['entity_id']. Got None
extra keys not allowed @ data['condition'][0]['for']. Got None
extra keys not allowed @ data['condition'][0]['state']. Got None
not a valid value for dictionary value @ data['condition'][0]['condition']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/automation/
It’s that mean the automation conditions can’t use variable so complex like this?
Hello, I am a beginner and I thank you for your explanations. I would like to advance in the understanding of your script, wanting to refine the list (for example get the friendly_name).
Can you tell me where I can find information on the variables you are transmitting to the py script ? where do we find this information?
service_data ?
hass.services.call(‘input_select’ ?