custom-components / pyscript

Pyscript adds rich Python scripting to HASS
Apache License 2.0
874 stars 46 forks source link

pyscript.app_config #518

Closed marshalltech81 closed 1 year ago

marshalltech81 commented 1 year ago

In following the documentation, https://hacs-pyscript.readthedocs.io/en/latest/reference.html#configuration, I tried "To use the UI, go to the Configuration -> Integrations page and select “+” to add Pyscript Python scripting.". However I could not find that option any where in the UI.

So in my configuration.yaml, I did the manual option of specifying:

pyscript: !include pyscript/config.yaml

And in my pyscript/config.yaml:

allow_all_imports: true
apps:
  my_app1:
    # any settings for my_app1 go here
  my_app2:
    # any settings for my_app2 go here

Lastly in my script for my_app1 as an example, I am trying to call log.info(f"configuration {pyscript.app_config}") and the error I keep getting back is:

NameError: name 'pyscript.app_config' is not defined.

Any thoughts?

Thank you in advance!

marshalltech81 commented 1 year ago

Nevermind ... came across https://github.com/custom-components/pyscript/issues/313 ... I am wondering if this could be slightly better documented maybe?

craigbarratt commented 1 year ago

Updated docs to clarify that pyscript.app_config is not available in regular scripts. See 12b1e84.