Edit json file from rules OpenHab

hello!
I would like to know a way to write in a json file (in Openhab/conf/html) some strings (contained in items read from the HABPannel) in my rules OpenHab.

my goal is to abtain a json file with credentials for a login. We need to:

  • part_1: Write in json “name, surname, ID(during the registration)

  • part_2: Read from json the data to compare whith credentials created in part_1 (during the login)

i know it can be stupid but i’m a newbie in this world, be gently!

Using cleartext files for login information is not a very good idea from a security perspective.

It was not stated that the password would be stored in clear text - it could be that the password will be stored in a hashed way. :slight_smile: in the json file.

You can make use of jython rules that means you have language elements of python an can read/write files.
You could make use of the Exec binding or ExecuteCommandLine to run a script ( shell, python etc. ) to read/write a json file.

1 Like

NGRE or HABApp could also do that - NGRE can use Jython based on Python 2.7. HABApp uses Python 3.

Perfect! i’ll try to do this , i would know if there were some OpenHab functiones to do this but the integrategration of this functionality by a Python code seems good.
Thank you

yes, it is surely not safe but it is not my task to make this secure, thank you!