Skip to main content
SwapnilP
13-Aquamarine
Mar 28, 2024 2:15 PM UTC
Solved

can we create thingshape from thing/thingtemplate ? If Yes, How ?

I am aware of creating a thingtemplate from thing but not sure about thingshape.

Rocko
RockoAnswer
19-Tanzanite
Mar 28, 2024 4:53 PM UTC

Well, not OOTB.

One reason is that Shapes do not have Templates themselves, therefore more things might be broken if you go from Thing to Shape:

When you create a template from a thing, that template will have the same parent template as the original thing.

This way all services provides by the things template hierarchy up to GenericThing are also available in the template. The services will most probably work (unless you hardcoded the thing name instead of using "me"), and all properties are there,

For Shapes it's more complicated - let's say your thing has two properties p1 and p2, while p2 is not defined on the thing, but on its template two levels up.

Now, the expectation is the shape should clearly have p1, but what about p2? Should it be in or not? Same is true for services, but they are even more complex as they may refer to the previous properties. This could lead to missing or even broken services. I think it's due to this complexity (which would need an own UI) that it's not OOTB functionality.

 

If you have to do it due to refactoring, so more or less a one time effort, I would export the thing's XML and copy over the sections to a shape you created. At least for the services.

 

 

2 replies

Rocko
Rocko19-TanzaniteAnswer
19-Tanzanite
Mar 28, 2024 4:53 PM UTC

Well, not OOTB.

One reason is that Shapes do not have Templates themselves, therefore more things might be broken if you go from Thing to Shape:

When you create a template from a thing, that template will have the same parent template as the original thing.

This way all services provides by the things template hierarchy up to GenericThing are also available in the template. The services will most probably work (unless you hardcoded the thing name instead of using "me"), and all properties are there,

For Shapes it's more complicated - let's say your thing has two properties p1 and p2, while p2 is not defined on the thing, but on its template two levels up.

Now, the expectation is the shape should clearly have p1, but what about p2? Should it be in or not? Same is true for services, but they are even more complex as they may refer to the previous properties. This could lead to missing or even broken services. I think it's due to this complexity (which would need an own UI) that it's not OOTB functionality.

 

If you have to do it due to refactoring, so more or less a one time effort, I would export the thing's XML and copy over the sections to a shape you created. At least for the services.

 

 

Translate
SwapnilP
SwapnilP13-AquamarineAuthor
13-Aquamarine
Mar 29, 2024 5:31 AM UTC

Thank you @Rocko . It makes sense now. I will export the thing's XML and copy over the sections to a shape for now. 

Translate
Swapnil