-
Notifications
You must be signed in to change notification settings - Fork 58
-
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!
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 1 reply
-
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
Beta Was this translation helpful? Give feedback.
All reactions
-
Try looking through pyscript-compile
section of the documentation https://hacs-pyscript.readthedocs.io/en/stable/reference.html#pyscript-compile
Beta Was this translation helpful? Give feedback.
All reactions
-
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 :)
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1