JSONPATH extract more than 1 value to update 1 Item

Hi!
How can i extract more than 1 value from a JSON message to only one item.
JSON Message looks like this:

{
"plugin": "124",
"mode": "on",
"lastmode": "on",
"fadetime": "500",
"fadedelay": "5",
"dim": "255",
"rgb": "ffff66",
"hue": "60",
"saturation": "60",
"brightness": "100",
"bgcolor": "",
"count": "1",
"speed": "25",
"pixelcount": "75"
}

i can easily extract one value by using the Incoming Value Transformations

JSONPATH:$.brightness

as the state of the item.

i want to return the state of the item like:
hue, saturation, brightness
to show the current state of the item (for homekit integration)
is it possible to show more than one transformation in one item?
Tried chaining but every time it returns more values the whole thing gets an error an stops working

Chaining won’t do what you are wanting. To do exactly what you want you will need to use rules to concatenate the values.

However, you have the RGB value too, though in hex - doesn’t that work for you?

Thanks!
I need it as a feedback for my homekit to return those states as HSV since homekit uses those 3 values…
when i use

JSONPATH:$.hue, ∩saturation, ∩brightness

it shows the right values, but the thing throws an error and nothing works…

[WARN ] [rnal.handler.GenericMQTTThingHandler] - Channel configuration error

java.lang.IllegalArgumentException: The transformation pattern must consist of the type and the pattern separated by a colon

I think you will have to use a JS javascript transform, where you can extract and concatenate any JSON values you want into a single string.

Thanks! Just installed JS Transformations! How can i extract JSON with JS? :innocent:

You will have to write a javascript to do that.

Here’s an example javascript that does a different job on JSON

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