How to pass one thing properties, services,, subscription to the another thing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
Solved! Go to Solution.
- Labels:
-
Coding
-
Connectivity
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I m trying to connect industrial connection but below error occuring, if you know please tell me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
