What would be the best way to implement a delay for an SNMP Get operation, when the device needs some time to process a WRITE-only SNMP Set parameter?
Example :
- a 'Load Presets' BUTTON. (write only SNMP action)
- the device needs some time to prepare the presets
In this particular case we cannot immediately retrieve the Presets, because the device needs some time to prepare them.
What is the best practice for delaying the SNMP Get operation after having executed the SNMP set action?
Hi Filiep,
I have made a small test connector using the below approach. When checking the stream viewer the delay is done correctly before the GET is executed.
Approach:
- A write parameter with SNMP OID + options="snmpSet" triggers a QAction.
- This QAction will sleep for 5seconds and force the execution of a trigger (protocol.CheckTrigger method)
System.Threading.Thread.Sleep(5000);
protocol.CheckTrigger(50); - The trigger will execute an action that will run a Group 50 containing the linked params. (execute next)
Note that the options="snmpSet" will immediately copy the write value into the corresponding read param.
I used the default snmp system contact and system name as test setup.
A timer will run a group 10 with only the contact param. As soon as I write the contact value, the qaction runs and eventually a group 50 is launched to get both the contact and name parameters.
Alternative you can use the next attribute. Important note on this is that the this attribute is applied as a delay between 2 items defined in the <Content> of the component.
For example: A Group (poll action) with 2 action
<Group id="1">
<Name>Test</Name>
<Description>Test</Description>
<Type>poll action</Type>
<Content>
<Action next="5000">1</Action>
<Action>2</Action>
</Content>
</Group>
The Action 1 will be executed as soon as the group is triggered. Then it will wait 5s before the next item = Action 2 is executed.
This could mean Action 1 needs to be dummy action that does nothing if you simply want to wait X time before something needs to happen when this group is being executed from the protocol Queue.
For your use case this would mean the following approach:
- A write parameter with SNMP OID + options="snmpSet" triggers a Trigger
- This Trigger runs an action that will run a Group. (the next attribute is not supported on triggers)
- This Group is of type poll action containing 2 actions as described above where the 1st action does nothing. and the 2nd action will run a group that does the polling of the required snmp parameters.
Another option, would be just to have a Trigger (on write param) > Action (sleep with your time) then Action (execute SNMP Group).
The second solution is indeed as we implemented it.
The first solution for some reason did not work, I would gladly retest it, but the device was not supposed to be available for doing sets anymore, and a simulation is not entirely reliable for this.