Hi, yesterday I tried to replace the SNMP 1 binding by the new one. I was able to configure it and it collects data from the device, but there are quite a few errors with number items, e.g.:
2019-08-12 00:15:23.177 [WARN ] [ding.snmp.internal.SnmpTargetHandler] - could not convert 12.5 to number for channel snmp:target:router:Network_Router_RX_SNR
Maybe this is caused because I use a german locale for openhab, which uses a “,” instead of a “.” as decimal separator, but the device I am collection data from uses a “.” (the value 12.5 in the above message is the correct value retrieved from the device).
My things (replaced the community with a dummy string:
Thing snmp:target:router [ hostname="192.168.1.1", community="abcd", protocol="v2c", refresh=600 ] {
Channels:
Type number : Network_Router_RX_Count [ oid=".1.3.6.1.4.1.2356.11.1.72.2.1.3.4.86.68.83.76", mode="READ" ]
Type number : Network_Router_TX_Count [ oid=".1.3.6.1.4.1.2356.11.1.72.2.1.2.4.86.68.83.76", mode="READ" ]
Type number : Network_Router_RX_Speed [ oid=".1.3.6.1.4.1.2356.11.1.75.5.0", mode="READ" ]
Type number : Network_Router_TX_Speed [ oid=".1.3.6.1.4.1.2356.11.1.75.4.0", mode="READ" ]
Type number : Network_Router_RX_Speed_Attainable [ oid=".1.3.6.1.4.1.2356.11.1.75.36.0", mode="READ" ]
Type number : Network_Router_TX_Speed_Attainable [ oid=".1.3.6.1.4.1.2356.11.1.75.37.0", mode="READ" ]
Type number : Network_Router_RX_SNR [ oid=".1.3.6.1.4.1.2356.11.1.75.6.0", mode="READ" ]
Type number : Network_Router_TX_SNR [ oid=".1.3.6.1.4.1.2356.11.1.75.7.0", mode="READ" ]
Type number : Network_Router_RX_ATTN [ oid=".1.3.6.1.4.1.2356.11.1.75.8.0", mode="READ" ]
Type number : Network_Router_TX_ATTN [ oid=".1.3.6.1.4.1.2356.11.1.75.9.0", mode="READ" ]
Type number : Network_Router_RX_Interleave [ oid=".1.3.6.1.4.1.2356.11.1.75.11.0", mode="READ" ]
Type number : Network_Router_TX_Interleave [ oid=".1.3.6.1.4.1.2356.11.1.75.10.0", mode="READ" ]
Type number : Network_Router_RX_CRC_Error [ oid=".1.3.6.1.4.1.2356.11.1.75.25.102.0", mode="READ" ]
Type number : Network_Router_TX_CRC_Error [ oid=".1.3.6.1.4.1.2356.11.1.75.25.122.0", mode="READ" ]
Type number : Network_Router_RX_INP_Symbol [ oid=".1.3.6.1.4.1.2356.11.1.75.34.0", mode="READ" ]
Type number : Network_Router_TX_INP_Symbol [ oid=".1.3.6.1.4.1.2356.11.1.75.35.0", mode="READ" ]
Type number : Network_Router_VDSL_Uptime [ oid=".1.3.6.1.4.1.2356.11.1.75.54.0", mode="READ" ]
Type string : Network_Router_IP_External [ oid=".1.3.6.1.4.1.2356.11.1.4.13.1.1.3.8.84.45.67.76.83.85.82.70", mode="READ" ]
Type string : Network_Router_Uptime [ oid=".1.3.6.1.2.1.1.3.0", mode="READ" ]
Type number : Network_Router_CPU_Load_300s [ oid=".1.3.6.1.4.1.2356.11.1.47.15.0", mode="READ" ]
Type number : Network_Router_Memory_Free [ oid=".1.3.6.1.4.1.2356.11.1.47.5.0", mode="READ" ]
Type number : Network_Router_Temperature [ oid=".1.3.6.1.4.1.2356.11.1.47.20.0", mode="READ" ]
}
I have prepared an update. Please try bundle:update <number> https://janessa.me/esh/org.openhab.binding.snmp-float.jar. You should find a new datatype “Float” for the Number-channels.
SNMP does not support float by default. What kind of device is sending that data?
A Lancom router, the same oid worked flawlessly with the snmp 1 binding and a Number item
To add, the binding doc does describe the number channel’s datatype parameter and default - all integer types.
I have read the documentation, it states " The datatype parameter is needed in some special cases where data is written to the target." So I assumed, that this does not apply when reading data.
@J-N-K
Thanks a lot, I will try it and be back with feedback!
Sorry, to be so late, I thought I already posted an update yesterday evening but somehow I only wrote it, without sending…
I have updated the binding using bundle:update and added datatype=“FLOAT” to my things configuration. So far this works flawless and fixes my problem!!
Thanks a lot for your fast help!! One more 1.x binding to be retired
SNMP does not support float by default. What kind of device is sending that data? This probably is a string value.
This made me check the router MIB for the datatype and indeed, it is a string value. Strangly I have never noticed that and I am using these oid for quite some time, with different tools, including the snmp 1 binding. Nevertheless I think, that adding the Float datatype is a usefull feature. I use the VDSL quality parameters to send a warning when they are below a certain threshold (started with this, after I had lots of problems with my provider) and the alternative would be to convert all the values in rules.