cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How to pass one thing properties, services,, subscription to the another thing.

Pratik_Aswale
9-Granite

How to pass one thing properties, services,, subscription to the another thing.

Hi Developers,

 

In my use case I have t1 and t2 thing.  I want to pass all t1 Thing  properties, services and subscriptions to the t2 Thing. Is it possible? If yes then how can we do this?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Not sure what you'r trying to do here, but have you thought about using a common ThingTemplate for that? You create the properties and services in a ThingTemplate, and then when you run CreateThing instead of passing GenericThing you pass your ThingTemplate and the new Thing will inherit all properties and services of the template.

This is a much more robust approach, and the purpose of thing templates.

 

If you're on your thing t1, in Composer in the "More" dropdown you will even have a "Create ThingTemplate" option to support you with the process.

View solution in original post

9 REPLIES 9

What do you mean pass?

 

If you want pass the property values, you can use the local bindings or Services

Or you can duplicate the t1 and rename into t2.

 

Explain your usecase further...

If you mean copy over property and service definitions, you can do that manually in the Composer, but this is very tedious.

I've seen a Helper around which copies services from one entity to another, so you could write yourself a tool for that if you have that use case more often. The fastest, but also a bit fragile way if not done correctly is to export the things to XML, manually copy over the definitions in question and then import again.

 

Hi @Rocko 

 

Thanks for your replay....

 

As you said yes we can do by using that method. 

In my usecase I created a thing by  using a createThing service which I pass  input parameter like:-

 

 

 
Pratik_A_1-1711428219112.pngPratik_A_0-1711428115284.png
Now, Thing is created successfully. In That blank thing I wanted to add same properties, subscriptions and services which I have already another one thing. So whenever we create a new thing by using createThing service can we also add or pass  properties, subscriptions and services to that newly created thing at the same time or in same service ?
 

 

Not sure what you'r trying to do here, but have you thought about using a common ThingTemplate for that? You create the properties and services in a ThingTemplate, and then when you run CreateThing instead of passing GenericThing you pass your ThingTemplate and the new Thing will inherit all properties and services of the template.

This is a much more robust approach, and the purpose of thing templates.

 

If you're on your thing t1, in Composer in the "More" dropdown you will even have a "Create ThingTemplate" option to support you with the process.

Hi @Rocko ....

Yes its works for me by creating a new ThingTemplate insted of GenericThing and assigning to a  createThing service .

but In  newly created thing I m not able to bind Kepware tags to the  Thing property. It shows Disable option whenever I hover a courser on Binding.

Pratik_A_1-1711446915417.png

 

Thanks.

 

Your ThingTemplate then should have RemoteThing as Base Thing Template, not Generic Thing. You can check this on your thing t1, somewhere in the template hierarchy will be RemoteThing.

@Rocko 

I m trying to connect industrial connection but below error occuring, if you know please tell me.

Pratik_A_0-1711448612267.png

 

Hard to tell without knowing your used templates, but is the Industrial Thing connected? After CreateThing, did you run EnableThing and RestartThing as suggested here?

Things["TestThing"].EnableThing();
Things["TestThing"].RestartThing();

 

@Rocko 

Yes, Now its working fine.

Thank a lot.

Top Tags