dummylabs / thewatchman

Home Assistant custom integration to keep track of missing entities and actions in your config files
MIT License
475 stars 20 forks source link

Support for pyscript #63

Open adwuk opened 2 years ago

adwuk commented 2 years ago

I have been using pyscript for my automations, as well as YAML. I thought that I would mention that watchman does a pretty good job of scanning python files and detecting problems as well. Essentially the easiest way to use pyscript is to put all your python files into the /config/pyscript directory. I have added the following to init.py to get it working. You may want to provide it as an option for others.

def get_included_folders(hass):
...
    folders.append(os.path.join(hass.config.config_dir, "pyscript/*.py"))

The one thing that it doesn't cope with is pyscript's ability to refer to attributes in the same definition, e.g. entity.attribute, but other than that, 10/10! Thanks - great utility.