Set value of device

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mackowiakp
Normal user
Posts: 527
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Set value of device

#1 Post by mackowiakp » 14 Mar 2023, 11:45

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).

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Set value of device

#2 Post by TD-er » 14 Mar 2023, 12:32

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.

mackowiakp
Normal user
Posts: 527
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Set value of device

#3 Post by mackowiakp » 14 Mar 2023, 12:41

THX, will try

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Set value of device

#4 Post by Ath » 14 Mar 2023, 13:46

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.
/Ton (PayPal.me)

mackowiakp
Normal user
Posts: 527
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Set value of device

#5 Post by mackowiakp » 14 Mar 2023, 14:42

OK, works!
THX once more.

Post Reply

Who is online

Users browsing this forum: No registered users and 37 guests