event generation snmp traps

140 views
Skip to first unread message

ope...@lb-automation.de

unread,
Feb 29, 2012, 7:11:50 AM2/29/12
to openhab, teic...@gmail.com
i have a weather station i read the weather station out for getting
the information into openhab i have an agent that sends snmp-traps so
far so good. but only one trap is recognized ...

debug-log

13:03:12.001 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=13:03:11.00,enterprise=1.3.6.1.4.1.47.2.2.1.1.9,genericTrap=17,specificTrap=0,
VBS[1.3.6.1.4.1.47.2.2.1.1.9 = Sensor Nr.: 9;
1.3.6.1.4.1.47.2.2.1.11.9 = 11.1]]'
13:03:12.009 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=13:03:12.00,enterprise=1.3.6.1.4.1.47.2.2.1.1.9,genericTrap=17,specificTrap=0,
VBS[1.3.6.1.4.1.47.2.2.1.1.9 = Sensor Nr.: 9;
1.3.6.1.4.1.47.2.2.1.10.9 = 78]]'
13:03:12.017 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=13:03:12.00,enterprise=1.3.6.1.4.1.47.2.2.1.1.0,genericTrap=17,specificTrap=0,
VBS[1.3.6.1.4.1.47.2.2.1.1.0 = Sensor Nr.: 0;
1.3.6.1.4.1.47.2.2.1.11.0 = 20.9]]'
13:03:12.025 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=13:03:12.00,enterprise=1.3.6.1.4.1.47.2.2.1.1.0,genericTrap=17,specificTrap=0,
VBS[1.3.6.1.4.1.47.2.2.1.1.0 = Sensor Nr.: 0;
1.3.6.1.4.1.47.2.2.1.10.0 = 49]]'
13:03:12.033 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=13:03:12.00,enterprise=1.3.6.1.4.1.47.2.2.1.1.2,genericTrap=17,specificTrap=0,
VBS[1.3.6.1.4.1.47.2.2.1.1.2 = Sensor Nr.: 2;
1.3.6.1.4.1.47.2.2.1.11.2 = 23.3]]'
13:03:12.042 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=13:03:12.00,enterprise=1.3.6.1.4.1.47.2.2.1.1.2,genericTrap=17,specificTrap=0,
VBS[1.3.6.1.4.1.47.2.2.1.1.2 = Sensor Nr.: 2;
1.3.6.1.4.1.47.2.2.1.10.2 = 42]]'
13:03:12.050 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=13:03:12.00,enterprise=1.3.6.1.4.1.47.2.2.1.1.5,genericTrap=17,specificTrap=0,
VBS[1.3.6.1.4.1.47.2.2.1.1.5 = Sensor Nr.: 5;
1.3.6.1.4.1.47.2.2.1.11.5 = 22.3]]'
13:03:12.051 [EventAdmin Async Event Dispatcher Thread] INFO
runtime.busevents - SNMP_KiZi_Temperatur state updated to 22.3
13:03:12.058 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=13:03:12.00,enterprise=1.3.6.1.4.1.47.2.2.1.1.5,genericTrap=17,specificTrap=0,
VBS[1.3.6.1.4.1.47.2.2.1.1.5 = Sensor Nr.: 5;
1.3.6.1.4.1.47.2.2.1.10.5 = 46]]'

configuration

String SNMP_WoZi_Temperatur "Wohnzimmer [%s °C]" <temperature>
(Status) { snmp="1.3.6.1.4.1.47.2.2.1.11.2" }
String SNMP_WoZi_Feuchte "Wohnzimmer [%s %]" <temperature>
(Status) { snmp="1.3.6.1.4.1.47.2.2.1.10.2" }

String SNMP_KiZi_Temperatur "Kinderzimmer [%s °C]" <temperature>
(Status) { snmp="1.3.6.1.4.1.47.2.2.1.11.5" }
String SNMP_KiZi_Feuchte "Kinderzimmer [%s %]" <temperature>
(Status) { snmp="1.3.6.1.4.1.47.2.2.1.10.5" }

String SNMP_Outdoor_Temperatur "Aussen [%s °C]" <temperature>
(Status) { snmp="1.3.6.1.4.1.47.2.2.1.11.9" }
String SNMP_Outdoor_Feuchte "Aussen [%s %]" <temperature>
(Status) { snmp="1.3.6.1.4.1.47.2.2.1.10.9" }

thanks in advance for help

lars

Thomas Eichstädt-Engelen

unread,
Feb 29, 2012, 7:59:47 AM2/29/12
to ope...@googlegroups.com
Hi Lars,

are you familiar with Eclipse? You could set a breakpoint on line 184 in class SnmpBinding and see which variable value is extracted from the PDU.

Regards,

Thomas E.-E.

ope...@lb-automation.de

unread,
Feb 29, 2012, 10:03:45 AM2/29/12
to openhab
no i havent´t set up eclipse for openhab. as you can see only
13:03:12.051 [EventAdmin Async Event Dispatcher Thread] INFO
runtime.busevents - SNMP_KiZi_Temperatur state updated to 22.3
only

13:03:12.050 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=13:03:12.00,enterprise=1.3.6.1.4.1.47.2.2.1.1.5,genericTrap=17,specificTrap=0,
VBS[1.3.6.1.4.1.47.2.2.1.1.5 = Sensor Nr.: 5;
1.3.6.1.4.1.47.2.2.1.11.5 = 22.3]]'

is processed. why only one trapis handled are there limitations ? more
than one trap should be processed .... how is the handling inside
opnehab / snmpbinding ?



On 29 Feb., 13:59, Thomas Eichstädt-Engelen <teich...@googlemail.com>
wrote:
> Hi Lars,
>
> are you familiar with Eclipse? You could set a breakpoint on line 184 in class SnmpBinding and see which variable value is extracted from the PDU.
>
> Regards,
>
> Thomas E.-E.
>

Thomas Eichstädt-Engelen

unread,
Feb 29, 2012, 10:24:56 AM2/29/12
to ope...@googlegroups.com

> is processed. why only one trap is handled are there limitations ?

no, conceptually there is no limitation. From your logging-fragments i don't see the reason why the items weren't get updated appropriately :(

> more than one trap should be processed ….

you are absolutely right ;-)

> how is the handling inside
> opnehab / snmpbinding ?

For each incoming SNMP-Trap openHAB iterates through all BindingProviders and for each BindingProvider iterates through its items. So it could be possible that the other items simply aren't configured properly (although i don't see any error right now).

Did you use the openHAB-Designer to create the *.items-File? If not, could you please use it? After opening the items-File (and changing something, because the refresh isn't working properly right now) a Syntax-Check is performed. Does the Designer find any reason?

Regards,

Thomas E.-E.

ope...@lb-automation.de

unread,
Feb 29, 2012, 3:10:07 PM2/29/12
to openhab
i did not used the designer .... but now i have used it. changed
something saved and also i have done validate no errors ...

On 29 Feb., 16:24, Thomas Eichstädt-Engelen <teich...@googlemail.com>
wrote:

ope...@lb-automation.de

unread,
Feb 29, 2012, 3:29:01 PM2/29/12
to openhab
i added some logger output

21:23:52.103 [FolderObserver] DEBUG o.o.m.c.i.folder.FolderObserver -
Refreshing folder 'rules'
21:23:52.103 [FolderObserver] DEBUG o.o.m.c.i.folder.FolderObserver -
Refreshing folder 'sitemaps'
21:23:52.103 [FolderObserver] DEBUG o.o.m.c.i.folder.FolderObserver -
Refreshing folder 'scripts'
21:23:52.103 [FolderObserver] DEBUG o.o.m.c.i.folder.FolderObserver -
Refreshing folder 'items'
21:23:53.347 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:23:53.00,enterprise=1.3.6.1.4.1.47.2.2.1.11.9,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.11.9 = 10.6]]'
21:23:53.347 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:23:53.347 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:23:53.413 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:23:53.00,enterprise=1.3.6.1.4.1.47.2.2.1.10.9,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.10.9 = 80]]'
21:23:53.413 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:23:53.413 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:23:53.449 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:23:53.00,enterprise=1.3.6.1.4.1.47.2.2.1.11.0,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.11.0 = 20.8]]'
21:23:53.449 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:23:53.449 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:23:53.579 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:23:53.00,enterprise=1.3.6.1.4.1.47.2.2.1.10.0,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.10.0 = 58]]'
21:23:53.580 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:23:53.580 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:23:53.685 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:23:53.00,enterprise=1.3.6.1.4.1.47.2.2.1.11.2,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.11.2 = 23.0]]'
21:23:53.685 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:23:53.685 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:23:53.776 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:23:53.00,enterprise=1.3.6.1.4.1.47.2.2.1.10.2,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.10.2 = 44]]'
21:23:53.776 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:23:53.776 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:23:53.783 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:23:53.00,enterprise=1.3.6.1.4.1.47.2.2.1.11.5,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.11.5 = 21.6]]'
21:23:53.783 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:23:53.783 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:23:53.784 [EventAdmin Async Event Dispatcher Thread] INFO
runtime.busevents - SNMP_KiZi_Temperatur state updated to 21.6
21:23:53.792 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:23:53.00,enterprise=1.3.6.1.4.1.47.2.2.1.10.5,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.10.5 = 50]]'
21:23:53.792 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:23:53.792 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:23:56.446 [Scanner-0] DEBUG org.eclipse.jetty.util.Scanner -
scanned [/var/spool/asterisk/monitor/Projekte/openHAB/openhab-
runtime-0.9.0/contexts]: {}

ope...@lb-automation.de

unread,
Feb 29, 2012, 3:33:34 PM2/29/12
to openhab
for (String itemName : provider.getItemNames()) {
logger.debug("OID '{}'", provider.getOID(itemName));
OID oid = provider.getOID(itemName);
Variable variable = pdu.getVariable(oid);
eventPublisher.postUpdate(itemName, new
StringType(variable.toString()));
break; <=============== for what this break is for ?

he detects all traps in the same provider. is that okay ? all differnt
traps are then different names, so the for loop hast to iterate over
all item names ...

Thomas Eichstädt-Engelen

unread,
Feb 29, 2012, 3:46:09 PM2/29/12
to ope...@googlegroups.com
Hi Lars,

you are absolutely right! This "break" is nonsense :-/

Thank you very much for diving into the code and providing that solution :-)

The fix is checked in already!

Regards,

Thomas E.-E.

ope...@lb-automation.de

unread,
Feb 29, 2012, 3:50:53 PM2/29/12
to openhab
you tried it ? i think it will not work either ... i just
recompile ...
is there a possibility to just compile the snmp binding ? i´m working
on a linux console prompt ...


On 29 Feb., 21:46, Thomas Eichstädt-Engelen <teich...@googlemail.com>
wrote:
> Hi Lars,
>
> you are absolutely right! This "break" is nonsense :-/
>
> Thank you very much for diving into the code and providing that solution :-)
>
> The fix is checked in already!
>
> Regards,
>
> Thomas E.-E.
>

ope...@lb-automation.de

unread,
Feb 29, 2012, 3:56:36 PM2/29/12
to openhab
21:51:30.002 [DefaultQuartzScheduler_Worker-3] ERROR
o.o.io.multimedia.actions.Audio - No TTS service available - tried to
say: 3
21:51:31.443 [Scanner-0] DEBUG org.eclipse.jetty.util.Scanner -
scanned [/var/spool/asterisk/monitor/Projekte/openHAB/openhab-
runtime-0.9.0/contexts]: {}
21:51:31.937 [Scanner-1] DEBUG org.eclipse.jetty.util.Scanner -
scanned [/var/spool/asterisk/monitor/Projekte/openHAB/openhab-
runtime-0.9.0/webapps]: {}
21:51:31.942 [Scanner-2] DEBUG org.eclipse.jetty.util.Scanner -
scanned [/var/spool/asterisk/monitor/Projekte/openHAB/openhab-
runtime-0.9.0/contexts]: {}
21:51:33.312 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:51:33.00,enterprise=1.3.6.1.4.1.47.2.2.1.11.9,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.11.9 = 10.4]]'
21:51:33.314 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:51:33.315 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID - itemName'SNMP_KiZi_Temperatur'
21:51:33.315 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:51:33.315 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:51:33.00,enterprise=1.3.6.1.4.1.47.2.2.1.10.9,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.10.9 = 80]]'
21:51:33.315 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:51:33.315 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID - itemName'SNMP_KiZi_Temperatur'
21:51:33.315 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:51:33.320 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:51:33.00,enterprise=1.3.6.1.4.1.47.2.2.1.11.0,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.11.0 = 20.6]]'
21:51:33.320 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:51:33.320 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID - itemName'SNMP_KiZi_Temperatur'
21:51:33.320 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:51:33.330 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:51:33.00,enterprise=1.3.6.1.4.1.47.2.2.1.10.0,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.10.0 = 59]]'
21:51:33.331 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:51:33.331 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID - itemName'SNMP_KiZi_Temperatur'
21:51:33.331 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:51:33.340 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:51:33.00,enterprise=1.3.6.1.4.1.47.2.2.1.11.2,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.11.2 = 23.0]]'
21:51:33.341 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:51:33.341 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID - itemName'SNMP_KiZi_Temperatur'
21:51:33.341 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:51:33.355 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:51:33.00,enterprise=1.3.6.1.4.1.47.2.2.1.10.2,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.10.2 = 44]]'
21:51:33.355 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:51:33.355 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID - itemName'SNMP_KiZi_Temperatur'
21:51:33.355 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:51:33.368 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:51:33.00,enterprise=1.3.6.1.4.1.47.2.2.1.11.5,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.11.5 = 21.6]]'
21:51:33.369 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:51:33.369 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID - itemName'SNMP_KiZi_Temperatur'
21:51:33.369 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:51:33.369 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID -
itemName'SNMP_Outdoor_Temperatur'
21:51:33.369 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.9'
21:51:33.369 [EventAdmin Async Event Dispatcher Thread] INFO
runtime.busevents - SNMP_KiZi_Temperatur state updated to 21.6
21:51:33.389 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Received PDU
'V1TRAP[reqestID=0,timestamp=21:51:33.00,enterprise=1.3.6.1.4.1.47.2.2.1.10.5,genericTrap=1,specificTrap=1,
VBS[1.3.6.1.4.1.47.2.2.1.10.5 = 50]]'
21:51:33.389 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - Provider ItemsNames
'[SNMP_KiZi_Temperatur, SNMP_Outdoor_Temperatur, SNMP_WoZi_Feuchte,
SNMP_WoZi_Temperatur, SNMP_KiZi_Feuchte, SNMP_Outdoor_Feuchte]'
21:51:33.389 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID - itemName'SNMP_KiZi_Temperatur'
21:51:33.389 [DefaultUDPTransportMapping_0.0.0.0/162] DEBUG
o.o.b.snmp.internal.SnmpBinding - OID '1.3.6.1.4.1.47.2.2.1.11.5'
21:51:36.494 [Scanner-0] DEBUG org.eclipse.jetty.util.Scanner -
scanned [/var/spool/asterisk/monitor/Projekte/openHAB/openhab-
runtime-0.9.0/contexts]: {}
21:51:36.987 [Scanner-1] DEBUG org.eclipse.jetty.util.Scanner -
scanned [/var/spool/asterisk/monitor/Projekte/openHAB/openhab-
runtime-0.9.0/webapps]: {}
21:51:36.993 [Scanner-2] DEBUG org.eclipse.jetty.util.Scanner -
scanned [/var/spool/asterisk/monitor/Projekte/openHAB/openhab-
runtime-0.9.0/contexts]: {}
21:51:38.515 [FolderObserver] DEBUG o.o.m.c.i.folder.FolderObserver -
Refreshing folder 'rules'


the for does not loop over all item names .... does eventPublihser
returns ????

Thomas Eichstädt-Engelen

unread,
Feb 29, 2012, 4:27:55 PM2/29/12
to ope...@googlegroups.com

> you tried it ? i think it will not work either ... i just
> recompile …

no, i didn't since my dev-environment doesn't work for other reasons. It would be nice if you could test the fix!

> is there a possibility to just compile the snmp binding ? i´m working

> on a linux console prompt …

no, the target-platform won't be working correctly …

ope...@lb-automation.de

unread,
Feb 29, 2012, 4:29:38 PM2/29/12
to openhab
i have now it seems to work

<------>public void processPdu(CommandResponderEvent event) {
<------><------>PDU pdu = event.getPDU();
<------><------>if (pdu != null) {
<------><------><------>logger.debug("Received PDU '{}'",
event.getPDU());
<------><------><------>for (SnmpBindingProvider provider : providers)
{
<------><------><------><------>logger.debug("Provider ItemsNames
'{}'", provider.getItemNames());
<------><------><------><------>for (String itemName :
provider.getItemNames()) {
<------><------><------><------><------>logger.debug("OID -
itemName'{}'", itemName);
<------><------><------><------><------>logger.debug("OID '{}'",
provider.getOID(itemName));
<------><------><------><------><------>OID oid =
provider.getOID(itemName);

<------><------><------><------><------>Variable variable = null;

<------><------><------><------><------>try {
<------><------><------><------><------><------>variable =
pdu.getVariable(oid);
<------><------><------><------><------>} catch (Exception e) {
<------><------><------><------><------><------>logger.error("no
variable to oid",e.getMessage());
<------><------><------><------><------>}

<------><------><------><------><------>if (variable != null) {
<------><------><------><------><------><------
>eventPublisher.postUpdate(itemName, new
StringType(variable.toString()));
<------><------><------><------><------>}
<------><------><------><------>}
<------><------><------>}
<------><------><------>
<------><------>}
<------>}

i have to check if its working also for two itemNames with the same
oid ...

Thomas Eichstädt-Engelen

unread,
Feb 29, 2012, 4:32:56 PM2/29/12
to ope...@googlegroups.com
ok, so the point is, that "variable" gets null (your cited text is really hard to read)?

> --
> You received this message because you are subscribed to the Google Groups "openhab" group.
> To post to this group, send email to ope...@googlegroups.com.
> To unsubscribe from this group, send email to openhab+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/openhab?hl=en.
>

ope...@lb-automation.de

unread,
Feb 29, 2012, 4:53:57 PM2/29/12
to openhab
public void processPdu(CommandResponderEvent event) {
PDU pdu = event.getPDU();
if (pdu != null) {
logger.debug("Received PDU '{}'", event.getPDU());
for (SnmpBindingProvider provider : providers) {
for (String itemName :
provider.getItemNames()) {
OID oid = provider.getOID(itemName);

Variable variable = null;

try {
variable =
pdu.getVariable(oid);
} catch (Exception e) {
logger.error("no variable to
oid",e.getMessage());
}

if (variable != null) {

eventPublisher.postUpdate(itemName, new
StringType(variable.toString()));
}
}
}

}
}

now its working.... the code look more or less like this, please check
and clean up the code i´m note a java specialist (how to handle the
variable.....) but ist working
you may get an empty variable if the trap has no oid for the
itemName ...

Thomas Eichstädt-Engelen

unread,
Feb 29, 2012, 5:02:49 PM2/29/12
to ope...@googlegroups.com
did you receive an exception? The snmp-lib-code doesn't throw an exception (as far as i can see) but returns "null" if no variable is found …

ope...@lb-automation.de

unread,
Mar 1, 2012, 1:17:05 AM3/1/12
to openhab
as i can see there is no exception thrown ...

Thomas Eichstädt-Engelen

unread,
Mar 1, 2012, 1:18:04 AM3/1/12
to ope...@googlegroups.com
ok, so i will provide the enhanced fix in a minute :-)


On Mar 1, 2012, at 7:17 AM, ope...@lb-automation.de wrote:

> as i can see there is no exception thrown ...
>

Reply all
Reply to author
Forward
0 new messages