Page 1 of 1

Set value of device

Posted: 14 Mar 2023, 11:45
by mackowiakp
Is it possibile to set actual value of device from rule?
Just in my case set ping fails to zero.
J want to count number of fails in period of time and than reset this value (from rule).

Re: Set value of device

Posted: 14 Mar 2023, 12:32
by TD-er
You can call TaskValueSet.
However, if you want to run this on something other than a Dummy, you need to also check the checkbox on tools->Advanced "Allow TaskValueSet on all plugins"

N.B. this then only sets the output value, but it isn't guaranteed the plugin actually uses this value for its next update after it is initialized.

Re: Set value of device

Posted: 14 Mar 2023, 12:41
by mackowiakp
THX, will try

Re: Set value of device

Posted: 14 Mar 2023, 13:46
by Ath
The ping plugin has a command to (re)set the value, but the command structure is bit different:

Code: Select all

pingset,<taskname|tasknumber>,<value>
NB: The value should be in range -1023 .. 1023.
NB2: When enabling TaskValueSet for all devices, then the TaskValueSet command will also work, as the plugin increments the currently set 'Fails' value.

I was just thinking of how this can be simplified, and still be backward compatible with older scripts, to be used like:

Code: Select all

pingset,<value>
// with multiple instances:
[ping1].pingset,<value1>
[ping2].pingset,<value2>
For addressing a specific task we have, for quite some time already, that "[taskname]." prefix, where the square brackets are optional.

Re: Set value of device

Posted: 14 Mar 2023, 14:42
by mackowiakp
OK, works!
THX once more.