# Button to trigger snmpset

**URL:** <https://discourse.nodered.org/t/button-to-trigger-snmpset/3540>\
**Category:** General\
**Created:** [28 September 2018 15:28 UTC](https://discourse.nodered.org/t/button-to-trigger-snmpset/3540 "2018-09-28T15:28:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RackIoT](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@RackIoT](https://discourse.nodered.org/u/RackIoT)\
**Post date:** [28 September 2018 15:28 UTC](https://discourse.nodered.org/t/button-to-trigger-snmpset/3540/1 "2018-09-28T15:28:25Z")

</div>

HI All

I am a real noob at pi/node-red, so please excuse what may seem quite simple, but I have tried every way I can research to get this working but cant find a solution.

I need to do a simple thing.

Click a button on UI and on the flow I linked a button to a snmpset node to trigget and snmp set.

Below is the set command from pi command,,,,,,

snmpset -c public -v 2c 192.168.0.29 1.3.6.1.4.1.362.5.5.2.0 i 1

I have a flow with the following:

Button---------snmpset

Button Settings : Label, payload set to number 1  
snmpset node settings: Set Host, community and version correctly and the following in varbinds: [{ "oid":"1.3.6.1.4.1.362.5.5.1.0","type":"Integer","value":"1" }]

I cant seem to get the cli command executed.

Any help, as i think it is the syntax of the varbinds?

No matter what I change i cant seem to get it working, error i get from above is "TypeError: argument must be a Number"

thanks

---

<div class="post-metadata">

**Author:** ![RackIoT](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@RackIoT](https://discourse.nodered.org/u/RackIoT)\
**Post date:** [2 October 2018 12:35 UTC](https://discourse.nodered.org/t/button-to-trigger-snmpset/3540/2 "2018-10-02T12:35:08Z")

</div>

HI All

Further to my last post.

I believe the issue I was facing sits on the snmpset node.

I have a varbing presenting exactly that same as what a MIB broswser send to the snmp lock I am using, but the node refuses to send the snmpset as it claims that there is a type error and the value should be a number, which it is as can be seen below.

Further to my last post, I have managed to get the msg.payload from the button to present what looks to be correct to the snmpset node, but I dont think that the node works properly as it is rejecting the below and the value is clearly a number.

02/10/2018, 13:23:21[node: 2e0616b2.e17cd2](http://192.168.0.200:1880/#)msg : Object

object

payload: 1

socketid: "F\_tBcepE7mUh0OoZAAAO"

\_msgid: "67b0c260.37261c"

value: 1

varbinds: array[1]

0: object

host: "192.168.0.29"

version: "v2c"

oid: "1.3.6.1.4.1.362.5.5.1.0"

type: "Integer"

value: "1"

02/10/2018, 13:23:21[node: 8fa6a9e.9339f58](http://192.168.0.200:1880/#)

msg : string[36]

"TypeError: argument must be a Number"

![snmpsetpic](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/8af916549946ba0fec7ca8a309475de11ce1a720.jpeg)

The above pic is a screen grab from the mib browser.

Please can someone help with this i really need this to be working and need some help from this community forum.

Thanks  
Philip

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 October 2018 12:45 UTC](https://discourse.nodered.org/t/button-to-trigger-snmpset/3540/3 "2018-10-02T12:45:35Z")

</div>

can you post the relevant part of your flow - so we can see where exactly the error is coming from.  
In that list it says `value: "1"` which is of course a string... but it's not clear if that is what is being sent in or from where - or if the node should handle anyway - etc etc

Did you try setting `"value":1` instead

---

<div class="post-metadata">

**Author:** ![RackIoT](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@RackIoT](https://discourse.nodered.org/u/RackIoT)\
**Post date:** [3 October 2018 08:29 UTC](https://discourse.nodered.org/t/button-to-trigger-snmpset/3540/4 "2018-10-03T08:29:35Z")

</div>

Hi Dceejay

Please find the complete flow below.

```auto
[{"id":"12129b63.cd3f75","type":"ui_button","z":"7fbaebaa.be868c","name":"","group":"61b9ce8e.51abc","order":0,"width":0,"height":0,"passthru":false,"label":"Front Door","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"","x":130,"y":60,"wires":[["67e27da3.5d61cc"]]},{"id":"8fa6a9e.9339f58","type":"snmp set","z":"7fbaebaa.be868c","host":"192.168.0.29","community":"public","version":"2c","varbinds":"","timeout":5,"name":"","x":590,"y":20,"wires":[]},{"id":"2e0616b2.e17cd2","type":"debug","z":"7fbaebaa.be868c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":560,"y":120,"wires":[]},{"id":"67e27da3.5d61cc","type":"function","z":"7fbaebaa.be868c","name":"","func":"msg.value = msg.payload;\nmsg.varbinds = [{\"host\": \"192.168.0.29\",\"version\": \"v2c\",\"oid\":\"1.3.6.1.4.1.362.5.5.1.0\",\"type\":\"Integer\",\"value\":\"\"+msg.payload+\"\"}]\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":60,"wires":[["2e0616b2.e17cd2","8fa6a9e.9339f58"]]},{"id":"61b9ce8e.51abc","type":"ui_group","z":"","name":"Rack 1","tab":"aaa9644c.4e4138","order":1,"disp":true,"width":"5","collapse":true},{"id":"aaa9644c.4e4138","type":"ui_tab","z":"","name":"Racks","icon":"dashboard","order":2}]

```

---

<div class="post-metadata">

**Author:** ![RackIoT](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@RackIoT](https://discourse.nodered.org/u/RackIoT)\
**Post date:** [3 October 2018 08:32 UTC](https://discourse.nodered.org/t/button-to-trigger-snmpset/3540/5 "2018-10-03T08:32:58Z")

</div>

Below is what i get in the debug window when i click on the button on ui.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e1e2d858de6931ed49080a9e91ebc0978ca88d5a.png)

---

<div class="post-metadata">

**Author:** ![RackIoT](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@RackIoT](https://discourse.nodered.org/u/RackIoT)\
**Post date:** [3 October 2018 08:37 UTC](https://discourse.nodered.org/t/button-to-trigger-snmpset/3540/7 "2018-10-03T08:37:21Z")

</div>

below is from a MIB browser executing a successful snmpset.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/efba55db7e8d39088f6565057c7ef7ff6b3bb2d6.png)
