SNMP v2: Could not convert 12.5 to number

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).

Is there any workaround I could use?

Thanks for your help,
Juelicher

Can you show the thing/channel configuration?

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" ]
}

The items configuration:

//WAN RX & TX Count
Number Network_Router_RX_Count                       "Empfangen: [%,d Bytes]"                    <chart>     (gNetworkRouter)        { channel="snmp:target:router:Network_Router_RX_Count" }
Number Network_Router_TX_Count                       "Gesendet:  [%,d Bytes]"                    <chart>             (gNetworkRouter)        { channel="snmp:target:router:Network_Router_TX_Count" }

//Aktuelle Geschwindigkeit VDSL
Number Network_Router_RX_Speed                       "VDSL RX Geschw. [%d kBit/s]"       <chart>             (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_RX_Speed" }
Number Network_Router_TX_Speed                       "VDSL TX Geschw. [%d kBit/s]"       <chart>             (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_TX_Speed" }

//Verbindungsparameter VDSL
Number Network_Router_RX_Speed_Attainable   "VDSL RX max. Geschw. [%d kBit/s]"  <chart>              (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_RX_Speed_Attainable" }
Number Network_Router_TX_Speed_Attainable   "VDSL TX max. Geschw. [%d kBit/s]"  <chart>              (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_TX_Speed_Attainable" }

// Number Network_Router_RX_SNR                 "VDSL RX SNR [%.1f db]"             <chart>             (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_RX_SNR" }
Number Network_Router_TX_SNR                 "VDSL TX SNR [%.1f db]"             <chart>             (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_TX_SNR" }
Number Network_Router_RX_ATTN                        "VDSL RX Dämpfung [%.1f db]"        <chart>             (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_RX_ATTN" }
Number Network_Router_TX_ATTN                        "VDSL TX Dämpfung [%.1f db]"        <chart>             (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_TX_ATTN" }

Number Network_Router_RX_Interleave         "VDSL RX Interleave [%.2f ms]"      <chart>              (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_RX_Interleave" }
Number Network_Router_TX_Interleave          "VDSL TX Interleave [%.2f ms]"      <chart>             (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_TX_Interleave" }

Number Network_Router_RX_CRC_Error          "VDSL RX CRC Fehler [%d]"           <chart>              (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_RX_CRC_Error" }
Number Network_Router_TX_CRC_Error           "VDSL TX CRC Fehler [%d]"           <chart>             (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_TX_CRC_Error" }

Number Network_Router_RX_INP_Symbol         "VDSL RX INP-Symbole [%.1f]"        <chart>              (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_RX_INP_Symbol" }
Number Network_Router_TX_INP_Symbol          "VDSL TX INP-Symbole [%.1f]"        <chart>             (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_TX_INP_Symbol" }

//VDSL Uptime
Number Network_Router_VDSL_Uptime                "Lancom VDSL Uptime [%d s]"         <time>          (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_VDSL_Uptime" }

//Externe IP Adresse
String Network_Router_IP_External            "External IP [%s]"                      <internet>      (gNetworkRouterLine)    { channel="snmp:target:router:Network_Router_IP_External" }

//Router System Uptime
String Network_Router_Uptime                 "Lancom Uptime [%s ticks]"          <time>                                          { channel="snmp:target:router:Network_Router_Uptime" }

//Router Hardware Informationen
Number Network_Router_CPU_Load_300s     "CPU load 300s [%d %%]"         <chart>     (gNetworkMonitor)   { channel="snmp:target:router:Network_Router_CPU_Load_300s" }
Number Network_Router_Memory_Free       "Freie Speicher [%,d kByte]"    <chart>              (gNetworkMonitor)   { channel="snmp:target:router:Network_Router_Memory_Free" }
Number Network_Router_Temperature       "Temperatur [%d °C]"            <chart>              (gNetworkMonitor)   { channel="snmp:target:router:Network_Router_Temperature" }

SNMP does not support float by default. What kind of device is sending that data?

This probably is a string value.

1 Like

To add, the binding doc does describe the number channel’s datatype parameter and default - all integer types.

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.

Juelicher

1 Like