How to Create multiple Channel dynamically using a single Topic?

Thing topic CMI "CMI" @ "keller" {
    Type number : A [stateTopic="CMI/data", transformationPattern="JSONPATH:$"]
Type number : B [stateTopic="CMI/data", transformationPattern="JSONPATH:$"]
    }  ```

there are multiple values in an object like a,b,c,d...

With so little information provided it’s really hard to understand what you are asking. Assuming you mean that you have a message that is published to a single topic that you want to split apart and update multiple Items, the answer is to create a Channel for each piece of data and use a transform to pull out the right value for each Channel.

But that’s what you are already doing so what’s the question?

Hello rich, Thanks for Reply,

let me try again to explain

I am having a topic CMI, and i want to create multiple channels in this topic like i had already created two channel,

my question "Is there any way to create multple channels dynamically?

 Type number : A [stateTopic="CMI/data", transformationPattern="JSONPATH:$"]
 Type number : B[stateTopic="CMI/data", transformationPattern="JSONPATH:$"]
 Type number : C [stateTopic="CMI/data", transformationPattern="JSONPATH:$"]

as my stateTopic CMI/data giving me an object, so can I create channels using keys of that object. any way to create using loop…

I am a beginner.


No, that’s not possible. At least not using .things files. There is a REST API so you could write an external script or use some of the advanced features of JavaScript or Python rules to dynamically create the Thing. But honestly, that would be way more work than just defining your Thing’s Channels manually.

1 Like

If you have control of the “target” device/service, you might consider using Homie or HomeAssistant self-identifying protocols. That’s not really dynamic though,more self configuring.