Why is everything in JSON format in my OpenHAB installation

No. If you want to use file based configs you must write them yourself.

Yes, if you want to use file based configs, you must write files and place them in the right folders.

Nothing you describe is impossible to do in a UI rule. So your end goal is not a reason to not use the UI. Only your personal preferences will drive that decision. The UI rules are as fully capable as file based rules.

We’d have to see the code to really help. Typically, because openHAB is event driven, you would want to drive behavior like this using events. [Deprecated] Alarm Clock Rule and Time Based State Machine [3.2.0;3.4.9] might be useful to you.

Correct on Blockly. The newer language options all follow a files first, UI maybe someday approach, much to my chagrin. The only “modern” language with full UI support right now is JS Scripting. All the rest are files only, though there are reports that jRuby is at least working on UI support. JScript cannot work in the UI based on my understanding but there is a third party Java Scripting add-on that does.

Right now I can only recommend Blockly or JS Scripting if you want to write rules in the UI. If you want to use text files I can recommend JS Scripting or jRuby. If you are OK with running a separate rules service I can also recommend HABApp which is pure Python 3.

I cannot recommend Rules DSL for new users because of it’s limitations. I cannot recommend ECMAScript 5.1 because it’s going to go away as soon as OH moves to the next Java version. I cannot recommend Jython because it’s stuck on version 2.7.1 and is based on an all but abandoned upstream project so might break at any moment with no chance of being fixed.

With Blockly you can save a variable from one run of one script to the next, but not easily share variables between rules unless you have one rule call another.

With JS Scripting there is a cache which is map shared by all JS Scripting rules. You can share variables between scripts by putting it into the cache. There is talk of trying to get this into the core so all languages can benefit but I’m not sure how long that will take.

In all the rules languages, a variable defined at the top of the file can be accessed by all the rules defined in that file. These are often referred to as “global” variables, though they are only global to the one file.

Rules have the following metadata properties:

  • UID
  • Name
  • Description
  • tags

You can use any or all of these as a way to visually group (or group through search) a collection of rules.

You can create adhoc groups of rules, Items, and Things on the Developer Sidebar (alt-shift-d). For example, if working on heating, open the sidebar and search for all the Things, Items, and Rules that work with heating and pin them there. While the sidebar is open you have access to everything you are working on right there.

With files you can group rules into separate files. For some languages you can use subfolders too (not Rules DSL).

See Design Pattern: Expire Binding Based Timers and Design Pattern: Motion Sensor Timer. Both of these need to be rewritten but they include Rules DSL examples which should work. If nothing else they present the concept and approach.

But to answer the specific question, the timer will start as soon as the Item enters a state different from the expire state. To cancel the timer update the Item back to the expired state. The rule that triggers when the timer goes off triggers on commands so it won’t be run with the update.