SNMP thing configuration

Hi.

I’m trying to setup this SNMP thing:

Thing snmp:target:poeswitch [ hostname="192.168.1.178", protocol="v2c", community="public" ] {
    Channels:
        Type switch : sw_poe_tel_cv       [ oid="1.3.6.1.2.1.105.1.1.1.3.1.13", mode="READ_WRITE", datatype="UINT32", onvalue="1", offvalue="2" ]
        Type switch : sw_poe_tel_escr     [ oid="1.3.6.1.2.1.105.1.1.1.3.1.14", mode="READ_WRITE", datatype="UINT32", onvalue="1", offvalue="2" ]
        Type switch : sw_poe_tel_sala     [ oid="1.3.6.1.2.1.105.1.1.1.3.1.15", mode="READ_WRITE", datatype="UINT32", onvalue="1", offvalue="2" ]
        Type switch : sw_poe_tel_sot      [ oid="1.3.6.1.2.1.105.1.1.1.3.1.16", mode="READ_WRITE", datatype="UINT32", onvalue="1", offvalue="2" ]
        Type switch : sw_poe_ap_cv        [ oid="1.3.6.1.2.1.105.1.1.1.3.1.19", mode="READ_WRITE", datatype="UINT32", onvalue="1", offvalue="2" ]
        Type switch : sw_poe_ap_rc1       [ oid="1.3.6.1.2.1.105.1.1.1.3.1.20", mode="READ_WRITE", datatype="UINT32", onvalue="1", offvalue="2" ]
        Type switch : sw_poe_ap_rc2       [ oid="1.3.6.1.2.1.105.1.1.1.3.1.21", mode="READ_WRITE", datatype="UINT32", onvalue="1", offvalue="2" ]
        Type switch : sw_poe_ap_1a        [ oid="1.3.6.1.2.1.105.1.1.1.3.1.22", mode="READ_WRITE", datatype="UINT32", onvalue="1", offvalue="2" ]
        Type switch : sw_poe_ap_sot       [ oid="1.3.6.1.2.1.105.1.1.1.3.1.24", mode="READ_WRITE", datatype="UINT32", onvalue="1", offvalue="2" ]
        Type switch : sw_poe_switch_tv    [ oid="1.3.6.1.2.1.105.1.1.1.3.1.23", mode="READ_WRITE", datatype="UINT32", onvalue="1", offvalue="2" ] 
}

But the logs show that the values are returned, but cannot be mapped!

01:05:03.774 [TRACE] [nding.snmp.internal.SnmpTargetHandler] - snmp:target:poeswitch received RESPONSE[requestID=1520789983, errorStatus=Success(0), errorIndex=0, VBS[1.3.6.1.2.1.105.1.1.1.3.1.19 = 1; 1.3.6.1.2.1.105.1.1.1.3.1.20 = 1; 1.3.6.1.2.1.105.1.1.1.3.1.23 = 2; 1.3.6.1.2.1.105.1.1.1.3.1.21 = 1; 1.3.6.1.2.1.105.1.1.1.3.1.24 = 1; 1.3.6.1.2.1.105.1.1.1.3.1.14 = 1; 1.3.6.1.2.1.105.1.1.1.3.1.15 = 1; 1.3.6.1.2.1.105.1.1.1.3.1.16 = 1; 1.3.6.1.2.1.105.1.1.1.3.1.13 = 1; 1.3.6.1.2.1.105.1.1.1.3.1.22 = 1]]
01:05:03.812 [DEBUG] [nding.snmp.internal.SnmpTargetHandler] - channel snmp:target:poeswitch:sw_poe_ap_cv received unmapped value 1 
01:05:03.823 [DEBUG] [nding.snmp.internal.SnmpTargetHandler] - channel snmp:target:poeswitch:sw_poe_ap_rc1 received unmapped value 1 
01:05:03.832 [DEBUG] [nding.snmp.internal.SnmpTargetHandler] - channel snmp:target:poeswitch:sw_poe_switch_tv received unmapped value 2 
01:05:03.847 [DEBUG] [nding.snmp.internal.SnmpTargetHandler] - channel snmp:target:poeswitch:sw_poe_ap_rc2 received unmapped value 1 
01:05:03.860 [DEBUG] [nding.snmp.internal.SnmpTargetHandler] - channel snmp:target:poeswitch:sw_poe_ap_sot received unmapped value 1 
01:05:03.869 [DEBUG] [nding.snmp.internal.SnmpTargetHandler] - channel snmp:target:poeswitch:sw_poe_tel_escr received unmapped value 1 
01:05:03.879 [DEBUG] [nding.snmp.internal.SnmpTargetHandler] - channel snmp:target:poeswitch:sw_poe_tel_sala received unmapped value 1 
01:05:03.905 [DEBUG] [nding.snmp.internal.SnmpTargetHandler] - channel snmp:target:poeswitch:sw_poe_tel_sot received unmapped value 1 
01:05:03.923 [DEBUG] [nding.snmp.internal.SnmpTargetHandler] - channel snmp:target:poeswitch:sw_poe_tel_cv received unmapped value 1 
01:05:03.934 [DEBUG] [nding.snmp.internal.SnmpTargetHandler] - channel snmp:target:poeswitch:sw_poe_ap_1a received unmapped value 1 

What am I missing? I think I’ve followed the documentation correctly.

Thanks.

This is how i set up my items. with pre 2.5.0 bindings, when i got port 161 to behave(linux)
I used the PaperUI to add the snmp devices “things”

String Switch_AName "Name[ %s ]" 	{snmp="<[10.0.0.103:private:.1.3.6.1.2.1.1.5.0:10000]"}

String Switch_Auptime "Uptime[ %s ]" 	{snmp="<[10.0.0.103:private:.1.3.6.1.2.1.1.3.0:10000]"}

From memory it should be:

on=“1”, off=“2”

You used “onvalue” and “offvalue”.

The values come back as numerical ,

example
if the items are ON / OFF, I used a transform map

 1=ON
2=OFF
undefined=unknown
-=unknown

@Chod that is the configuration for snmp v1. I’m using v2. Thanks.

I was using this with 2.4.0 , yes im guess the older binding, hence why ( just noticed , its not working )
might have to compare more notes

@job I used onvalue/offvalue as per documentation:

Anyway, I tried your suggestion, but doesn’t work either.

1 Like

have you sorted the snmp port and public or private passwords

@Chod Yes. the first line of the logs shows that the response is obtained. Only mapping fails.

sorry, yes re read all your initial post, am looking at the docs,i will try the PaperUI method see if that give any clues

I guess you cannot use MAP(suitable.map) in the thing configuration

Using Paper UI (new binding) its working ( well i got the unique name from one of my switch )

you add your devices as a snmp target “Thing” with its IP and public/private etc then add channels in the gui, not sure it helps you from a full manual setup

Uhh. Sorry, i was thinking about mqtt binding.

Hi,

I got exact same issue here:

2020-01-24 11:55:40.532 [DEBUG] [ding.snmp.internal.SnmpTargetHandler] - channel snmp:target:relayboard1:relay1State received unmapped value 0

with:

Type switch : relay1State [ oid=".1.3.6.1.4.1.42505.6.2.3.1.3.0", mode="READ_WRITE", datatype="UINT32", onvalue="1", offvalue="0" ]

Did you find something ?

Best regards,

A.

Hi @aligot,

Not sure why, the binding started working correctly. Any of the following did the trick:
a) Added a SNMP thing on PaperUI, to compare the settings
b) changed type to INT32
c) openhab service restart

Good luck

With a current OH 3.2 M3 I have the same issues. I tried also the different datatypes as suggested in the thread, but it also didn’t help.

Is the switch type working at all?

As a reference I have a Number and a Switch item for the same data point. Only the Switch item does not work:

2021-10-30 18:20:17.723 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'num_Router_Port2_Oper' changed from 1 to 2
2021-10-30 18:21:17.729 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'num_Router_Port2_Oper' changed from 2 to 1

2021-10-30 18:20:17.698 [DEBUG] [ding.snmp.internal.SnmpTargetHandler] - channel snmp:target:Router:oper_Port2 received unmapped value 2 
2021-10-30 18:20:17.699 [DEBUG] [ding.snmp.internal.SnmpTargetHandler] - channel snmp:target:Router:oper_Port2 received unmapped value 2 
2021-10-30 18:21:17.701 [DEBUG] [ding.snmp.internal.SnmpTargetHandler] - channel snmp:target:Router:oper_Port2 received unmapped value 1

Item definition:

Number:Dimensionless    num_Router_Port2_Oper         "Port2 used [%d]"          <none>    (gRouter, gRestoreOnStartup, gLog, gDel2M)    ["Measurement"]          {channel="snmp:target:Router:oper_Port2_n"}
Switch                  swi_Router_Port2_Oper         "Port2 used [%s]"          <none>    (gRouter, gRestoreOnStartup, gLog, gDel2M)    ["Measurement"]          {channel="snmp:target:Router:oper_Port2"}

The channel definitions are:

Type number: oper_Port2_n      [ oid=".1.3.6.1.2.1.2.2.1.8.15", mode="READ", doNotLogException="true" ]
Type switch: oper_Port2        [ oid=".1.3.6.1.2.1.2.2.1.8.15", mode="READ", datatype="INT32", onValue="1", offValue="2" ]