Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Solved! Go to Solution.
Hi,
What you are trying to achieve, I hope you have tried it using manual steps.
So in that case you just need a way to do that programatically, it could be a tricky process, but to answer your question in a precise manner it would need a little more understanding of your model.
However at this point I can point you to some services which you can try, evaluate and then build your own code using it.
1) For dynamically creating a thing you can use -
var params = {
name: "MyThing" /* STRING */,
description: "Thing Description" /* STRING */,
thingTemplateName: "generic" /* THINGTEMPLATENAME */,
tags: <tags> /* TAGS */
};
// no return
try
{
Resources["EntityServices"].CreateThing(params);
Things["MyThing"].EnableThing();
Things["MyThing"].RestartThing();
}
catch(err)
{
logger.debug("Unable to create thing; err: " + String(err));
Resources["EntityServices"].DeleteThing({name: "MyThing"});
}
2) For Remote binding use the service "SetRemotePropertyBinding" which is available in GenericThing template
You can also refer to
Hope it helps.
Regards
Aditya
Hi,
What you are trying to achieve, I hope you have tried it using manual steps.
So in that case you just need a way to do that programatically, it could be a tricky process, but to answer your question in a precise manner it would need a little more understanding of your model.
However at this point I can point you to some services which you can try, evaluate and then build your own code using it.
1) For dynamically creating a thing you can use -
var params = {
name: "MyThing" /* STRING */,
description: "Thing Description" /* STRING */,
thingTemplateName: "generic" /* THINGTEMPLATENAME */,
tags: <tags> /* TAGS */
};
// no return
try
{
Resources["EntityServices"].CreateThing(params);
Things["MyThing"].EnableThing();
Things["MyThing"].RestartThing();
}
catch(err)
{
logger.debug("Unable to create thing; err: " + String(err));
Resources["EntityServices"].DeleteThing({name: "MyThing"});
}
2) For Remote binding use the service "SetRemotePropertyBinding" which is available in GenericThing template
You can also refer to
Hope it helps.
Regards
Aditya