Configuration Issue for SNMP Float Variable

Hello,

I need some help configuring SNMP float fields using the SNMP 2 binding. The fields in question are defined as float fields. Based on the documentation I believe that I am supposed to define the thing and item as strings, adding datatype=“FLOAT” to the thing definition. When I save the .thing file the following warning is displayed in the log regardless of if the item is defined as a number or a string. (Synology’s documentation states that all SNMP OIDs are read-only.)

2021-06-11 23:30:23.920 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Diskstation.items'
2021-06-11 23:30:24.112 [WARN ] [ding.snmp.internal.SnmpTargetHandler] - can't process command REFRESH to snmp:target:Diskstation:UPS_Load: no writable channel found

Changing the configuration from string to number eliminates the warning message in the log, but the value is always NULL.

MIB Browser confirms that the Diskstation returns the correct value in the field (0x9F 78 04 41 30 00 00 for 11.0 percent load).

How can I configure these float fields?

Thing definition

Type string: UPS_Load                   [oid=".1.3.6.1.4.1.6574.4.2.12.1.0", mode="READ", datatype="FLOAT"]

Item definition

String Diskstation_UPS_Load    "UPS Load [%s]"  channel="snmp:target:Diskstation:UPS_Load" }                                          

Thanks in advance for your help.

  • Platform information:
    • Hardware: Synology RS1221+
    • OS: DSM 6.2.4, Docker 20.10.3
    • Java Runtime Environment: Java 11
    • openHAB version: 3.0.2
  • Target Hardware: Synology DS1812+,
  • Target OS: DSM 6.2.4. SNMP v2c.

I‘m not sure what the bug is, but REFRESH should always handled. Can you show the thing configuration.

Thing snmp:target:Diskstation "Synology Diskstation (SNMP)"[ hostname="192.168.0.10", protocol="v2c"] {
    Channels: 
Type string : UPS_Load                   [oid=".1.3.6.1.4.1.6574.4.2.12.1.0", mode="READ", datatype="FLOAT"]
}

Do you have a link to the MIB? I have a synology but no UPS, so I get noSuchInstance.

The “writable” in the message is a bug. It should be “readable”, but that doesn’t explain why no channel was found.

Thank you for your help and sorry for the late reply – it was after 1am when I made the previous replay and I needed some sleep. The link to the MIB files is:

https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/All/enu/Synology_MIB_File.zip

I believe the info you are looking for is

upsInfoLoad              OBJECT IDENTIFIER ::= { upsInfo 12 }

upsInfoLoadValue OBJECT-TYPE
    SYNTAX     Float
	UNITS      "percentage"
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Load on UPS (percent)"
    ::= { upsInfoLoad 1 }

This is a link to the current documentation.

This shows the values that MIB Browser returns for the OID:

I didn’t mention it before, but all four of the Float fields from the Synology have the same issue.

        Type string : UPS_Load                   [oid=".1.3.6.1.4.1.6574.4.2.12.1.0", mode="READ", datatype="FLOAT"]
        Type number : UPS_Charge                 [oid=".1.3.6.1.4.1.6574.4.3.1.1.0", mode="READ", datatype="FLOAT"]
        Type number : UPS_Warning                [oid=".1.3.6.1.4.1.6574.4.3.1.4.0", mode="READ", datatype="FLOAT"]
        Type number : UPS_Type                   [oid=".1.3.6.1.4.1.6574.4.3.12.0", mode="READ", datatype="FLOAT"]

Let me know if there’s anything I can do to help.

If I’m not mistaken, your issue is that opaque value handling is not supported by the openHAB SNMP binding.

The MIB imports type Float from NET-SNMP-TC and that reads:

Float ::= TEXTUAL-CONVENTION
    STATUS      current
    DESCRIPTION
        "A single precision floating-point number.  The semantics
         and encoding are identical for type 'single' defined in
         IEEE Standard for Binary Floating-Point,
         ANSI/IEEE Std 754-1985.
         The value is restricted to the BER serialization of
         the following ASN.1 type:
             FLOATTYPE ::= [120] IMPLICIT FloatType
         (note: the value 120 is the sum of '30'h and '48'h)
         The BER serialization of the length for values of
         this type must use the definite length, short
         encoding form.

         For example, the BER serialization of value 123
         of type FLOATTYPE is '9f780442f60000'h.  (The tag
         is '9f78'h; the length is '04'h; and the value is
         '42f60000'h.) The BER serialization of value
         '9f780442f60000'h of data type Opaque is
         '44079f780442f60000'h. (The tag is '44'h; the length
         is '07'h; and the value is '9f780442f60000'h.)"
    SYNTAX Opaque (SIZE (7))

I guess I don’t understand the formatting. While the MIB Browser says the type is Opaque it looks to me like the actual hex value that it displays is in BER format.

Are you aware of any work-arounds that I could use, maybe JavaScript or something?

Thanks again for your help.