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
Solved! Go to Solution.
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
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
Hi Raluca..
Thanks for your comment. The given solution seems to be working for me.
Thank you very much.
Regards,
Prashant Pandarkar
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