Adding the Ptyhon script to Home Assistant configuration directory
The first thing we shuold do is add a Directory named python_scrips right under Home-Assistant Config dir:
Now, create a files calld populate_catchall_group.py and add the following content into the file and save it:
Save the file and close i2
Help Home-Assistant be aware to the new directory
Now, in Home-Assistant configuration file “configuration.yaml” add the next line to tell home assistant load the script:
* Using “!include_dir_merge_list” will cause Home Assistant to load all the files in the given path”.
Creating an empty group
In this stage we will create an empty group/view so the script will attach the UnGroupd entities to it. to this add the next lines into groups.yaml:
and save it.
In this stage we will add an Automation to tell Home-Assistant run the script at startup. to do this add the next lines into “automations.yaml”:
Save the file and restrt Home Assistant
Run the script Manualy
Alongside with the automation we can also call the script manualy from Home-Assistant frontend using “Call Service” in the developer panel.
Search: “python_script.populate_catchall_group” and press the “Call Service” button: