In which folder the scripts are saved?

Hello all,

  • Platform information:
    • Hardware: Fujitsu Futro S920, Proxmox and OH is running on LXC, NO openhabian
    • OS: Debian 11 “Bullseye”
    • Java Runtime Environment: openjdk version “11.0.18” 2023-01-17 LTS
    • openHAB version: 3.4.2
  • Issue of the topic:

I have been trying to edit my script files via VSC for several hours now, as I find it is much easier to program and access.

My approach so far:

  • Samba installed, user added, folder shared: works
  • Folder mounted in Windows as network drive: works
  • In VSC installed the extension Openhab, API setup etc: works, I have access to all Items and hings in the VSC.

What does not work is I do not have access to my files because the folder /etc/openhab all exist but are empty. Where are my scripts, page settings etc saved?

Thank you and regards
Daniel

GUI created elements (scripts, rules, pages…) Are stored in a JSON db in /var/lib/openhab. This is not meant to be edited while openhab operates.

I think he meant the file based scripts, since he mentioned VSC.
It depends on where your OPENHAB_CONF directory is. Then it’s under

  • RulesDSL OPENHAB_CONF/rules
  • Javascript OPENHAB_CONF/automation/js
  • JRuby OPENHAB_CONF/automation/ruby

Blockquote I think he meant the file based scripts, since he mentioned VSC.
It depends on where your OPENHAB_CONF directory is.

That is also empty. All folders in openhab_conf are empty (only readme.txt), but my openhab is running. I would like to change my existing scripts or design them with VSC. See here:

The items and my model are recognised by VSC (it works)

but the folders are all empty

My expectation is that I can see all my scripts, design settings (etc). I guess these settings are somewhere else.

OK so you’ve found it…

Try creating something.js inside automation/js/

No. that is not my question. I’m looking for the exist scripts. Where are the exists scripts saved?

As you mentioned page settings as well, I assume you are talking about exising scripts created in MainUI, loke your page settings.
Those are stored in JSONDB under userdata and cannot be edited via external tools like VSC. At least, not while openHAB is running.

I think some clarification is required. You’ve found the right folder, but as @glhopital and @hmerk noted, anything created in the UI is stored in JSONDB and can’t be edited with VSC.

If you want to use VSC, then you have to create text files that have the appropriate extensions (.items, .rules, etc.). You haven’t done that, so the folders are empty.

Note that you can’t create Pages with text files. You can only create the older BasicUI sitemaps.

You can use both text-based and UI-based configs at the same time, but that can get confusing. We generally recommend that new users try the UI at first to explore its functionality, and switch to text-based config if they find the UI too limiting.

Note that we have experienced developers who have completely switched to UI configuration, in part because of something you mentioned earlier: “easier to program and access”. While VSC is a familiar environment for many developers, Blockly is a very friendly visual interface and is regularly gaining new functionality (because developers with advanced needs are using it). Perhaps more importantly, you can make edits to the UI from any web browser and from any location (via myopenHAB cloud access).

A mixed approach ( items via UI and files e.g.) is not recommended as it might lead to errors.

Good point. I was thinking more about rules than things/items.

And they are actually saved in userdata/jsondb/ this is not locate inside conf. Feel free to look but as others have mentioned, don’t modify this while OH is running. You can commit this to git for versioning / history, if you like.

I understand. I thought that I’d access to the existing system and could then also modify my scripts/pages.

Thank you very much

Regards
Daniel