From a55be34bc0900dfbd7e9d85cd0406136cb7c130c Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 15 Mar 2023 10:22:34 +0000 Subject: [PATCH] major change to snmp node to not stringify octet string type. --- io/snmp/README.md | 3 +++ io/snmp/package.json | 4 ++-- io/snmp/snmp.js | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/io/snmp/README.md b/io/snmp/README.md index 41e26cd7..7dd5062d 100644 --- a/io/snmp/README.md +++ b/io/snmp/README.md @@ -9,6 +9,9 @@ fetch values from SNMP enabled hosts. Supports v1, v2c and v3. * SNMP table - Simple SNMP oid table fetcher * SNMP walker - Simple SNMP oid walker fetcher +## v2 Breaking Change +v2 has a breaking change in that the single snmp node no longer tries to stringify an octet string type (04). This makes it consistent with the other nodes in this bundle. this means the user now has to convert to a string if required but has better control of how they wish to do that. + Install ------- diff --git a/io/snmp/package.json b/io/snmp/package.json index 3df8a7cf..e64f3ec0 100644 --- a/io/snmp/package.json +++ b/io/snmp/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-snmp", - "version" : "1.0.6", + "version" : "2.0.0", "description" : "A Node-RED node that gets and sets SNMP oid values. Supports v1, v2c and v3", "dependencies" : { - "net-snmp" : "^3.8.2" + "net-snmp" : "^3.9.0" }, "repository" : { "type":"git", diff --git a/io/snmp/snmp.js b/io/snmp/snmp.js index 22549fb5..3853e5fa 100644 --- a/io/snmp/snmp.js +++ b/io/snmp/snmp.js @@ -253,9 +253,9 @@ module.exports = function (RED) { node.error(SNMP.varbindError(vb), msg); vb._error = SNMP.varbindError(vb); //add _error to msg so users can determine the varbind is not valid } - else { - if (vb.type == 4) { vb.value = vb.value.toString(); } - } + // else { + // if (vb.type == 4) { vb.value = vb.value.toString(); } + // } vb.tstr = SNMP.ObjectType[vb.type]; } msg.payload = varbinds;