As @jimtng suggests there is more than one way to do it.
I do not have access to my openHAB environment for testing now so the following is just a guide.
The correct way is the one that works every time and if you change something it will adapt.
You can defiantly and should use JSON path transformation.
First install the JSON and REGEX transformation pattern if you have not already.
Setup a channel for each item you want to control. Lets look at one switch.
Example from doc is
Type switch : power [ stateTopic="stat/bedroom1-switch/RESULT", transformationPattern="REGEX:(.*POWER.*)∩JSONPATH:$.POWER", commandTopic="cmnd/bedroom1-switch/POWER" ]
Now to adapt it to what you want to achieve break it down to parts
Type switch : power [
stateTopic="stat/bedroom1-switch/RESULT" // You know this one is NSPanelKamer/RESULT
transformationPattern="REGEX:(.*POWER.*)∩JSONPATH:$.POWER", // This is magic
To make the magic happen properly with REGEX I need more result examples. If tasmota sends a message that dose not have what we are looking for then it will log an error in openHAB logs so you can filter out the results we don’t want.
∩ is not n its an intersection if we want to chain transformations.
JSONPATH is what you asked about using and it is fantastic if you know how to use it.
In the channel you want on or off ![:slight_smile: :slight_smile:](https://community.openhab.org/images/emoji/twitter/slight_smile.png?v=12)
//your example result json
{
"NSPanel":{
"ctype":"group",
"id":"2",
"params":{
"switches":[
{
"switch":"on",
"outlet":0
},
{
"switch":"off",
"outlet":1
}
]
}
}
}
transformationPattern="REGEX:(.*switches.*)∩JSONPATH:$.NSPanel.params.switches[?(@.outlet == 0)].switch"
transformationPattern="REGEX:(.*switches.*)∩JSONPATH:$.NSPanel.params.switches[?(@.outlet == 1)].switch"
//REGEX if the result has the string "switches" in it then we want it so send it to next transformation
//JSONPATH goto NSPanel.params.switches and look for outlet 0 then send me the value of switch
As the online jayway validator is down I cant 100% test this
When this dosn’t work look in the openHAB logs to see why.