Way to save system settings

Dear Community,

I want to make settings files for my home automation, so the system can read it and populate its values to system variables (items),
Therefore, I would like to take your advises for couple of questions:

  • What is best practice to use for saving settings, a set of Items, or (global) variables ?
  • What is the recommended settings file, I am thinking to make it xml file, (I am listing just raw file to clear the idea):

Have you considered just using a HashMap in your rule file?

val HashMap<String,HashMap<String,Integer>> HABSettings = newHashMap(
    "RGBW"  -> (newHashMap(
        "MaxDim"            -> 90,
        "DimPeriod"         -> 20,
        "DayColor"          -> 205,
        "AfternoonColor"    -> 58,
        "NightColor"        -> 160)
    "AC"    -> (newHashMap(
        "DayTemmp"          -> 90,
        "NightTemp"         -> 20)
    "Light" -> (newHashMap(
        "EveningDim"        -> 90,
        "NightDim"          -> 20)

Then access it with…


You can programmatically change values, but the hardcoded values will reset after a restart or rule file save.


If you want to use files, there was a recent tutorial on using configuration files with JSR223 w/ the lucid modules.

I also had a recent discussion about this with @rlkoshak and was playing around with some examples.

To summarize the link Scott provided, your options are: