Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
I have a problem with calling services from a thing that uses a particular ThingTemplate.
I am creating the Thing programmatically:
var params = {
thingTemplateName: equipmentTemplate,
description: description,
name: equipmentName
};
Resources["EntityServices"].CreateThing(params);
Things[equipmentName].EnableThing();
Things[equipmentName].RestartThing();
Which works fine, but when I try to call a service from that Thing:
...
Things[equipmentName].AddVisibilityPermission(params);
Then it throws a Things[equipmentName] is not running error.
This only happens when using one particular ThingTemplate as the 'equipmentTemplate', all other templates 'run' fine.
Does any one know why this might be happening? I can't find any permission issues, spelling errors or anything in that ThingTemplate. We did just upgrade to 6.5 - Would that have anything to do with this one ThingTemplate?
Solved! Go to Solution.
Do you know if the RestartThing is completing?. and if so; when the new Thing is added and it shows up in server; can you then run your visibility permission service?. maybe it's timing issue.....
Do you know if the RestartThing is completing?. and if so; when the new Thing is added and it shows up in server; can you then run your visibility permission service?. maybe it's timing issue.....
The RestartThing should be completing, I can warn the Thing[equipmentName].name afterward.
The thing is removed when the service is called because I have it in a trycatch as to not create any ghost things. So it doesn't actually show up on the server.
What Template is the 'equipmentTemplate' based on?
Thanks for the help guys, it turns out it was a timing issue. A ThingStart subscription was being called, and I guess it didn't like that. Thanks!