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

How to create thingworx app to change properties value by random number with timer?

SOLVED
ppandarkar-2
Aquamarine

How to create thingworx app to change properties value by random number with timer?

Hi,

I want to create a things which properties should get change in some interval of time e.g. 30second with random number. So pls can you suggest how to do this.

 

I have created thing template and things but unable to link and configure timer.

 

So pls can you suggest how to do this, mainly i am facing issue to configure timer thing which will run in 30sec and change properties value.

 

Regards,

Prashant Pandarkar

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to create thingworx app to change properties value by random number with timer?

Hi,

 

Create a thing, choose its template "Timer", insert "Run as User" the user you want to run; Update rate: 30000; check Enabled checkbox.

Go to Subscriptions of Timer, create new, choose event = Timer.

 

I have used the following code: 

Things["mything"].prop1 = Math.floor(Math.random() * 10);
logger.warn("Value: " +Things["test_timer"].prop1);

 

Then Save.

 

my thing = a thing different than the timer;

prop1 = number property;

 

Every 30 sec, the prop1 is updated and the value is written in Script.log

 

Hope it helps,

Raluca Edu

View solution in original post

3 REPLIES 3

Re: How to create thingworx app to change properties value by random number with timer?

Hi,

 

Create a thing, choose its template "Timer", insert "Run as User" the user you want to run; Update rate: 30000; check Enabled checkbox.

Go to Subscriptions of Timer, create new, choose event = Timer.

 

I have used the following code: 

Things["mything"].prop1 = Math.floor(Math.random() * 10);
logger.warn("Value: " +Things["test_timer"].prop1);

 

Then Save.

 

my thing = a thing different than the timer;

prop1 = number property;

 

Every 30 sec, the prop1 is updated and the value is written in Script.log

 

Hope it helps,

Raluca Edu

View solution in original post

Re: How to create thingworx app to change properties value by random number with timer?

Hi Raluca..

 

Thanks for your comment. The given solution seems to be working for me.

Thank you very much.

 

Regards,

Prashant Pandarkar

Re: How to create thingworx app to change properties value by random number with timer?

Hi @ppandarkar-2.

 

If the response provided by Raluca answered your question, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.