Optimization of rule

Right, the Item names are so long and complicated I didn’t notice they are different. Item names are the model of your home automation. They shouldn’t contain technology specific stuff in the name. The whole point is you don’t have to care what technology the Items are linked to.

So just put the Item names into a List or a Map and grab the Item name out of it.

Though an even better approach would be to name them so you can build the Item name from the index.

    val List<String> itms = newArrayList("28FFF0888317044E",
                                         "28FF0E8B831704C2",
                                         "28FFF3B39017052C",
                                         "28FF8B89831704DC")
                               
    for (i : 0 ..< 4) {
        try {
            adr = json_status.split("\\;").get(i*2).split("\\:").get(1)
            value = Float::parseFloat( json_status.split("\\;").get(i*2+1).split("\\:").get(1)

            adr_hex = new StringBuilder
            if(adr != "") {
                adr.split("\\.").forEach[ b |
                    val num = Integer::parseInt(b)
                    adr_hex.append(if(num < 16) "0" else Integer::toHexString(val_int).toUpperCase)
                    postUpdate("strLocalWeatherTempDach_"+itms.get(i)+"_ADR", adr_hex.toString)
                    postUpdate("strLocalWeatherTempDach_"+itms.get(i)+"_Val", value.toString)
                ]
            }
        }
        catch(Exception e){
            // log an error message
        }
    }

Or with naming similar to Design Pattern: Associated Items

    for (i : 0 ..< 4) {
        try {
            adr = json_status.split("\\;").get(i*2).split("\\:").get(1)
            value = Float::parseFloat( json_status.split("\\;").get(i*2+1).split("\\:").get(1)

            adr_hex = new StringBuilder
            if(adr != "") {
                adr.split("\\.").forEach[ b |
                    val num = Integer::parseInt(b)
                    adr_hex.append(if(num < 16) "0" else Integer::toHexString(val_int).toUpperCase)
                    postUpdate("strLocalWeatherTempDach_"+i+"_ADR", adr_hex.toString)
                    postUpdate("strLocalWeatherTempDach_"+i+"_Val", value.toString)
                ]
            }
        }
        catch(Exception e){
            // log an error message
        }
    }

If you put your Items into a Group (e.g. Group:String gStrLocalWeather) you can replace

		strLocalWeatherTempDach_28FF8B89831704DC_Adr.postUpdate("Requesting")
		strLocalWeatherTempDach_28FFF0888317044E_Adr.postUpdate("Requesting")
		strLocalWeatherTempDach_28FFF3B39017052C_Adr.postUpdate("Requesting")
		strLocalWeatherTempDach_28FF0E8B831704C2_Adr.postUpdate("Requesting")

with

                gStrLocalWeather.postUpdate("Requesting")

You can eliminate the sendHttpGetRequest by using the caching config with the HTTP binding. That would eliminate the need for the whole updating the Items to “Requesting” anyway.

I’m pretty sure sendHttpGetRequest does not throw any exceptions so the whole try catch on that part of the rule is redundant code that can never be executed.

I assume you are not just using the JSONPATH transfromation because you need to do further transformation of the text that came from the JSONPATH. If that’s the case, you could use HTTP binding - openHAB 2 version which is going to replace the existing HTTP 1.x binding anyway. Then you can chain transformations together to, for example, extract the JSON element you need and then use the REGEX transform and JavaScript transform to further extract from that.

If you did that, 90% of this rule, if not the entire rule would simply go away.