HTTP Channel for JSON only if other Channel has specific status

I got a JSON I want to take the values to some channels of an http-Thing.

Generally it works fine, but I got a lot of warnings, because the JSON changes depends on values.

So for example a block with detailed timer informations only there if timeractive is true.

Is there a way to let a channel only read the JSON if another one got successfull?

here an example of the things:

        Type number : timer       "Timer"        [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.timer.status" ]
        Type string : timer-date  "Timer Date"   [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.timer.next.date" ]
        Type string : timer-time  "Timer Time"   [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.timer.next.time" ]
        Type number : timer-unix  "Timer Unix"   [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.timer.next.unix" ]

So is there a way (syntax totally wrong, just as an example) like:

        Type string : timer-date  "Timer Date"   [ mode="READONLY", dependsOn="timer==true", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.timer.next.date" ]

Hope my crude explanation is understandable :slight_smile:

No.

But let’s recast the question - can you only try to extract “this” JSON element if “that” JSON element is also present? Yes.

There are hundreds of examples of doing this using chained transformations in MQTT, with REGEX and JSONPATH.
I don’t know if HTTP supports chaining, but you may able to achieve the same effect with a JS scripted transform performing both roles. The difficulty there is what to return for “not present”.

Well, it works, but I want to get rid of the warnings in log. :wink:

Okay, I looked for you and yes HTTP binding supports chained transformations. So you should be able to set up a “pre-select” REGEX with a JSONPATH just like the MQTT examples.

Thanks a lot. Then I will look into that examples. :+1: