Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to update the configuration.yaml file using data from a payload #491

Unanswered
davidbd7 asked this question in Q&A
Discussion options

Hello everyone,

I am using Pyscript to try to achieve some functionalities that I want for home assistant. Currently, I am trying update the alarm code in the configuration.yaml file to a new code that a user can specify using a frontend that I built. So once they enter the new code, that code is recieved through a webhook that is connected to home assistant. So is there a way to use pyscript to open the configuration.yaml file and update the alarm code with that new code? Any help would be appreciated!

You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

same problem, when i want to open some files with:
with open(datei_path, "r") as datei:
i become:
Exception in </config/pyscript/hello_py.py> line 13: with open(datei_path, "r") as datei: ^ NameError: name 'open' is not defined

You must be logged in to vote
1 reply
Comment options

Try looking through pyscript-compile section of the documentation https://hacs-pyscript.readthedocs.io/en/stable/reference.html#pyscript-compile

Comment options

You can open files as demonstrated here,
https://github.com/JacobLChrzanowski/HomeAssistant/blob/cbce3b1d5703c750a2df7261a7eb427a22f28b7d/CONFIG/pyscript/example.py#L154
There may be some upper limit on file size so paging n-bytes through a file might be necessary. I haven't played around with it yet.
This does not require pyscript-compile but that does solve another issue I had so, thanks to ALERTua to showing me that :)

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /