OH 2.5 upgrade to OH 3, transform("JSONPATH") not working?

Hi All,

Feel kind of stupid but cannot find out why my 2.5 rules are not working:

In rule below, the “Goodwe3_Raw” comes from MQTT and contains a valid JSON string.
All 4 variables should contain only of part the json, but now return the original string again.

This code has been running for quite some time on OH 2.5. So I guess I am missing some components I need to install? Or did the syntax change?

Greetings Matthijs

rule "GoodWe3_Update"
when 
    Item Goodwe3_Raw received update
then
    var String json    = Goodwe3_Raw.state.toString
    
    if (json.toString.contains("total_power")) 
    {
        var String tijdstip         = transform("JSONPATH", "$.time",          json)
		var String power            = transform("JSONPATH", "$.power",         json)
        var String today            = transform("JSONPATH", "$.day_total",     json)
        var String total        	= transform("JSONPATH", "$.total_power",   json)

	    logInfo("GoodWe", "GoodWe3 update        : " + power + " Watt") 

        Goodwe3_Time.sendCommand(tijdstip)
        Goodwe3_Power.sendCommand(power)
		Goodwe3_Today.sendCommand(today)
		Goodwe3_Total.sendCommand(total)

Sorry, found it!

The “Transformation Add-ons” contains the “JSONPath Transformation” plug-in.
Still getting used to the new interface.

Greetings Matthijs

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.