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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

How to limiting the usage of a thingtemplate for a limited number of things

jjakuby
1-Visitor

How to limiting the usage of a thingtemplate for a limited number of things

Hey Guys,

I trying to create a thingtemplate with services and properties and which will be later used for things as a basic thingtemplate. But I want to make a "rule" which only allows to use that thingtemplate for things with the name Device1*-DeviceN*...while N represents the maximum number of device which would be 10. Is there the possibilitie to do so or is it not possible to be such precise without configuring out ofthe box?

Looking towards your answer

Thanks and Cheers

Jamshed

2 REPLIES 2

Not out of the box. But one approach will be to have a Subscription on the ThingTemplate to ThingStart event, and if the Thing it's not called "DeviceNN" then delete itself. I've tested it right now ant it works:


Code for subscription to ThingStart event:


if ("contitionToNotAllowTheThingWithTheGivenName") {

   Resources["EntityServices"].DeleteThing({ name: me.name });

}

Hello Carles,

thanks for your reply, I think that this could be the correct direction. The point is, that this thingtemplate will be used for specific typ of things. Other things can exist but they will have another basic thingtemplate. My idea was to define that my created thingtemplate can be only used for device1*-device10*...so 10 is the maximum number of that specific thing called deviceN*. So the thingtemplate only has to check if the thing is called Device1* or Device2* and so on and if the maximum amount of 10 is passed for example device11* would not work anymore

Announcements


Top Tags