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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Set Update rate of timer at run time

magrawal
2-Explorer

Set Update rate of timer at run time

Is there a way to set update rate f timer dynamically, I am looking for a way to reset the timer when a service executes.

3 REPLIES 3
qngo
12-Amethyst
(To:magrawal)

Yes, you can update its Configuration Table.

For example:

- Retrieve the actual configuration table of the thing Timer and create a DataShape ("TimerSettingsDS") from the result

var result = Things["thing_name"].GetConfigurationTable({tableName: "Settings"});

- Service to update the configuration table "Settings" of the thing Timer

var values = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({dataShapeName: "TimerSettingsDS"});

values.AddRow({

    runAsUser : undefined,

    updateRate : 30000, // new update rate

    enabled: true // activate or deactivate the timer

});

var params = {

  configurationTable: values /* INFOTABLE */,

  persistent: true /* BOOLEAN */,

  tableName: "Settings" /* STRING */

};

Things["thing_name"].SetConfigurationTable(params);

ankigupta
12-Amethyst
(To:magrawal)

Use RestartThing Service to reset the timer.

jgorsline
12-Amethyst
(To:magrawal)

Meenakshi,

Any update on this? Were any of the posts in the discussion helpful? If so, could you click on the "correct answer" or "mark as helpful" button and let us know?

Announcements


Top Tags