Configuration
Pyscript can be configured using the UI, or via yaml. To use the UI, go to the Configuration -> Integrations page and selection “+” to add
Pyscript Python scripting. After that, you can change the settings anytime by selecting Options under Pyscript in the Configuration page.Alternatively, for yaml configuration, add
pyscript:to<config>/configuration.yaml. Pyscript has two optional configuration parameters that allow any python package to be imported and exposes thehassvariable as a global (both options default tofalse):pyscript: allow_all_imports: true hass_is_global: true
Add files with a suffix of
.pyin the folder<config>/pyscript.Restart HASS after installing pyscript.
Whenever you change a script file or app, pyscript will automatically reload the changed files. To reload all files and apps, call the
pyscript.reloadservice with the optionalglobal_ctxparameter to*.Watch the HASS log for
pyscripterrors and logger output from your scripts.