Button to trigger snmpset


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 i 1

I have a flow with the following:


Button Settings : Label, payload set to number 1
snmpset node settings: Set Host, community and version correctly and the following in varbinds: [ { "oid":"","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"




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:21node: 2e0616b2.e17cd2msg : Object


payload: 1

socketid: "F_tBcepE7mUh0OoZAAAO"

_msgid: "67b0c260.37261c"

value: 1

varbinds: array[1]

0: object

host: ""

version: "v2c"

oid: ""

type: "Integer"

value: "1"

02/10/2018, 13:23:21node: 8fa6a9e.9339f58

msg : string[36]

"TypeError: argument must be a Number"

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.




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



Hi Dceejay

Please find the complete flow below.

[{"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":"","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\": \"\",\"version\": \"v2c\",\"oid\":\"\",\"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}]


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




below is from a MIB browser executing a successful snmpset.