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

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

I have question about create thing using snippet

CHASEONHO
18-Opal

I have question about create thing using snippet

I create thing using snippet

n,T is Input parameter

so i create test1

and i want set this property

but Thing was created by snippet couldn't change properties

i input some test message in property Test1 Value

and click Set But

anything change...

.

.

.

but i create Thing using Create Thing in more button

it was changed properties

why i create thing with snippet can't change properties?

how i can make change properties with create thing using snippet?

1 ACCEPTED SOLUTION

Accepted Solutions
AnnaAn
13-Aquamarine
(To:CHASEONHO)

Hi Sehnho Cha,

Could you do again following below from scratch:

1. in an existing Thing, create a new Service and author it like:


var params = {
name: name /* STRING */,
description: undefined /* STRING */,
thingTemplateName: TemplateName /* THINGTEMPLATENAME */,
tags: undefined /* TAGS */
};

// no return
Resources["EntityServices"].CreateThing(params);


Things[name].EnableThing();
Things[name].RestartThing();

name, TemplateName is input parameter

2.Go to the thing created by snippet, and add a new property manually, and then set a value for it and see if property is changed.

3. If property is still not changed, please check your new created thing's General Information, and see if the Active is checked.

Thanks,

Br,

Anna

View solution in original post

6 REPLIES 6
AnnaAn
13-Aquamarine
(To:CHASEONHO)

Dear Seonho Cha,

By default after you programmically create a Thing, it's still inactive. You need Enable it with adding this code in your script:

Things[YOURTHINGNAME].EnableThing();

and try it again.

Thanks,

Br,

Anna

Thanks Anna An

i try "Things[YOURTHINGNAME].EnableThing();" this script in my script

but doesn't changed...

this is make with create Thing in more button in Template

this thing was Depedns On display

and this is create thing with snippet

and any depends on don't display

is this issue make problem?

how can fix it?

AnnaAn
13-Aquamarine
(To:CHASEONHO)

Hi Sehnho Cha,

Could you do again following below from scratch:

1. in an existing Thing, create a new Service and author it like:


var params = {
name: name /* STRING */,
description: undefined /* STRING */,
thingTemplateName: TemplateName /* THINGTEMPLATENAME */,
tags: undefined /* TAGS */
};

// no return
Resources["EntityServices"].CreateThing(params);


Things[name].EnableThing();
Things[name].RestartThing();

name, TemplateName is input parameter

2.Go to the thing created by snippet, and add a new property manually, and then set a value for it and see if property is changed.

3. If property is still not changed, please check your new created thing's General Information, and see if the Active is checked.

Thanks,

Br,

Anna

Thanks Anna An

i check that

and activity is not checked

how i check when i create thing with snippet?

AnnaAn
13-Aquamarine
(To:CHASEONHO)

hI Seonho Cha,

If you called EnableThing() properly, Thing should be active.

If you like, please join my webex room to have a look. https://ptc.webex.com/join/lan

my room number is: 800 022 691

Thanks,

Br,

Anna

thanks i did it! really thanks!

Top Tags