RPI3: KNX-USB Interface with knxd it does not work sending bindings

RPI3: KNX-USB Interface with knxd it does not work sending bindings

Hi,
Reflow the thread "Clover4x4"

I have installed knxd on my Raspian in RP3 using KNX-USB Interface it does not work sending bindings. Good sending telegrams with “knxtool groupswrite ip:localhost 4/0/1 1”

Installed knxd via http://michlstechblog.info/blog/raspberry-pi-eibknx-ip-gateway-and-router-with-knxd

When it starts.

>    pi@raspberrypi:~ $ findknxusb
    Possible addresses for KNX USB devices:
    device: 1:6:1:0:0 (ABB STOTZ-KONTAKT GmbH:KNX-USB Interface (MDRC))
    pi@raspberrypi:~ $ ps ax|grep knxd
     1241 pts/0    S+     0:00 grep --color=auto knxd
    pi@raspberrypi:~ $ sudo systemctl status networking.service
    ● networking.service - Raise network interfaces
       Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: e
       Active: active (exited) since Mon 2017-11-27 00:17:05 CET; 12h ago
         Docs: man:interfaces(5)
      Process: 295 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=0/SUC
      Process: 285 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "
     Main PID: 295 (code=exited, status=0/SUCCESS)
       CGroup: /system.slice/networking.service

    nov 27 00:17:02 raspberrypi systemd[1]: Starting Raise network interfaces...
    nov 27 00:17:02 raspberrypi sh[285]: ifquery: couldn't open interfaces file "/etc/ne
    nov 27 00:17:02 raspberrypi ifup[295]: ifup: couldn't open interfaces file "/etc/net
    nov 27 00:17:05 raspberrypi systemd[1]: Started Raise network interfaces.
    pi@raspberrypi:~ $ knxtool vbusmonitor1 ip:localhost
    Open failed: Connection refused

Not work, then restart “knxd.service”

pi@raspberrypi:~ $ sudo systemctl restart knxd.service

I work knxd well sending telegrams with “knxtool groupswrite ip:localhost 4/0/1 1”

> pi@raspberrypi:~ $ ps ax|grep knxd
 1319 ?        Ssl    0:00 /usr/local/bin/knxd -p /run/knxd/knxd.pid --eibaddr=1.1.128 --client-addrs=1.1.129:16 -d -D -T -R -S -i --listen-local=/tmp/knx -b usb:
 1341 pts/0    S+     0:00 grep --color=auto knxd
pi@raspberrypi:~ $ knxtool vbusmonitor1 ip:localhost
LPDU: BC 11 82 20 01 E1 00 81 91 :L_Data low from 1.1.130 to 4/0/1 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write (small) 01

In OpenHAB2 The config is the same of user “Clover4x4”. Connect a BUS KNX OK but not work he telegrams sent from openhab2.
They are sent correctly but not received by the USB gateway.

> `
> 2017-11-27 12:37:05.488 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
> 2017-11-27 12:37:06.294 [INFO ] [nx.internal.connection.KNXConnection] - Established connection to KNX bus on 224.0.23.12:3671 in mod            e TUNNEL.
> 2017-11-27 12:37:16.477 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Stopped HABmin servlet
> 2017-11-27 12:37:16.566 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI
> 2017-11-27 12:37:19.166 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
> 2017-11-27 12:37:19.758 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
> 
> ==> /var/log/openhab2/events.log <==
> 2017-11-27 12:40:19.426 [ItemCommandEvent          ] - Item 'knx_Vent1' received command ON
> 2017-11-27 12:40:19.548 [ItemStateChangedEvent     ] - knx_Vent1 changed from NULL to ON
> 2017-11-27 12:40:21.170 [ItemCommandEvent          ] - Item 'knx_Vent1' received command OFF
> 2017-11-27 12:40:21.184 [ItemStateChangedEvent     ] - knx_Vent1 changed from ON to OFF
> 2017-11-27 12:40:21.847 [ItemCommandEvent          ] - Item 'knx_Vent2' received command ON
> 2017-11-27 12:40:21.875 [ItemStateChangedEvent     ] - knx_Vent2 changed from NULL to ON
> 2017-11-27 12:40:22.462 [ItemCommandEvent          ] - Item 'knx_Vent2' received command OFF
> 2017-11-27 12:40:22.477 [ItemStateChangedEvent     ] - knx_Vent2 changed from ON to OFF
> `

I think something must have in the routing.

I have tried all the options of the messages above and it does not work.

My IP data: /etc/systemd/network/eth0.network

[Match]
# You can also use wildcards. Maybe you want enable dhcp
# an all eth* NICs
Name=eth0
[Network]
#DHCP=v4
# static IP
# 192.168.1.250 netmask 255.255.255.0
Address=192.168.1.250/24
Gateway=192.168.1.10
DNS=80.58.61.254 8.8.8.8
# Route for Multicast Address EIB/KNX
[Route]
Destination=224.0.23.12/32

 >pi@raspberrypi:~ $ ifconfig
> eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>         inet 192.168.1.250  netmask 255.255.255.0  broadcast 192.168.1.255
>         inet6 fe80::ba27:ebff:feb5:bfd7  prefixlen 64  scopeid 0x20<link>
>         ether b8:27:eb:b5:bf:d7  txqueuelen 1000  (Ethernet)
>         RX packets 18635  bytes 2159944 (2.0 MiB)
>         RX errors 0  dropped 2  overruns 0  frame 0
>         TX packets 1263  bytes 183220 (178.9 KiB)
>         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
pi@raspberrypi:~ $ dmesg|grep eth
[    1.954250] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:b5:bf:d7
[    4.913742] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[    4.914258] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    6.501103] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    6.504633] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
> pi@raspberrypi:~ $ route
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
> default         192.168.1.10    0.0.0.0         UG    0      0        0 eth0
> 192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
> 224.0.23.12     0.0.0.0         255.255.255.255 UH    0      0        0 eth0

More configuration information:

> lsusb -v
> 
> Bus 001 Device 006: ID 147b:5120
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               1.01
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0         8
>   idVendor           0x147b
>   idProduct          0x5120
>   bcdDevice            1.03
>   iManufacturer           1 ABB STOTZ-KONTAKT GmbH
>   iProduct                2 KNX-USB Interface (MDRC)
>   iSerial                 0
>   bNumConfigurations      1
> 
> pi@raspberrypi:~ $ sudo systemctl status knxd.service
> ● knxd.service - KNX Daemon
>    Loaded: loaded (/lib/systemd/system/knxd.service; enabled; vendor preset: enabled
>    Active: active (running) since Mon 2017-11-27 12:35:07 CET; 13min ago
>  Main PID: 1432 (knxd)
>    CGroup: /system.slice/knxd.service
>            └─1432 /usr/local/bin/knxd -p /run/knxd/knxd.pid --eibaddr=1.1.128 --clie
> 
> nov 27 12:35:07 raspberrypi systemd[1]: Started KNX Daemon.
> pi@raspberrypi:~ $ journalctl -xu knxd.service
> -- Logs begin at Thu 2016-11-03 18:16:42 CET, end at Mon 2017-11-27 12:48:51 CET. --
> nov 27 00:17:05 raspberrypi systemd[1]: Started KNX Daemon.
> -- Subject: Unit knxd.service has finished start-up
> -- Defined-By: systemd
> -- Support: https://www.debian.org/support
> --
> -- Unit knxd.service has finished starting up.
> --
> -- The start-up result is done.
> nov 27 00:17:05 raspberrypi systemd[1]: knxd.service: Main process exited, code=kill
> nov 27 00:17:05 raspberrypi systemd[1]: knxd.service: Unit entered failed state.
> nov 27 00:17:05 raspberrypi systemd[1]: knxd.service: Failed with result 'signal'.
> nov 27 12:26:11 raspberrypi systemd[1]: Started KNX Daemon.
> -- Subject: Unit knxd.service has finished start-up

knx.cfg y knxd

> openhab> config:list "(service.pid=org.openhab.knx)"
> ----------------------------------------------------------------
> Pid:            org.openhab.knx
 > Properties:
>    busaddr = 1.1.128
>    ignorelocalevents = true
>    ip = 224.0.23.12
>    localIp = 192.168.1.250
>    port = 3671
>    service.pid = org.openhab.knx
>    timeout = 100000
>    type = ROUTER

KNXD_OPTIONS="–eibaddr=1.1.128 --client-addrs=1.1.129:16 -d -D -T -R -S -i --listen-local=/tmp/knx -b usb:"

I have also tried

ip = 224.0.23.12
type = TUNNEL
port: 6720

Thank you very much in advance and I feel the text so long.
What is the problem?
I think something must have in the routing.

Pd. to start a new thread thank to “Dim”

Maybe this is an older log entry (before you changed knx.cfg to type = ROUTER)?
This won’t work since you need the KNX binding to be set at ROUTER type (not TUNNEL) when using the multicast IP)

Perform the following troubleshooting step and let’s see if things improve:

  1. Switch from user pi to root, to avoid typing “sudo” every time :slight_smile: (sudo su)
  2. Shut down openHAB2 service (systemctl stop openhab2)
  3. Delete file /var/lib/openhab2/config/org/openhab/knx.config (rm /var/lib/openhab2/config/org/openhab/knx.config)
  4. Fix your /etc/openhab2/services/knx.cfg:
ip=224.0.23.12
port=3671
busaddr=1.1.128
ignorelocalevents=true
type=ROUTER
localIp=192.168.1.250
autoReconnectPeriod=30
  1. Start openHAB2 service (systemctl start openhab2)
  2. Enable TRACE log level on the following 2 entries from the OH2 console:
log:set TRACE org.openhab.binding.knx
log:set TRACE tuwien.auto.calimero
  1. Monitor the log file (tail -f /var/log/openhab2/openhab.log)
1 Like

Also: Post the contents of your /etc/defaults/knxd file
and the output of the following command:

netstat -pln|grep knxd
1 Like

First of all, thanks for the quick reply

# Command line parameters for knxd. TPUART Backend
# Serial device Raspberry
# KNXD_OPTIONS="--eibaddr=1.1.128 --client-addrs=1.1.129:8 -d -D -T -R -S -i --listen-local=/tmp/knx -b tpuarts:/dev/ttyAMA0"
# Serial device PC
# KNXD_OPTIONS="--eibaddr=1.1.128 --client-addrs=1.1.129:8 -d -D -T -R -S -i --listen-local=/tmp/knx -b tpuarts:/dev/ttyS0"
# Tunnel Backend
# KNXD_OPTIONS="--eibaddr=1.1.128 --client-addrs=1.1.129:8 -d -D -T -R -S -i --listen-local=/tmp/knx -b ipt:192.168.56.1"
# USB Backend
KNXD_OPTIONS="--eibaddr=1.1.128 --client-addrs=1.1.129:16 -d -D -T -R -S -i --listen-local=/tmp/knx -b usb:"
root@raspberrypi:/home/pi# netstat -pln|grep knxd
tcp        0      0 0.0.0.0:6720            0.0.0.0:*               LISTEN      1928/knxd
udp        0      0 0.0.0.0:3671            0.0.0.0:*                           1928/knxd
unix  2      [ ACC ]     STREAM     LISTENING     35950    1928/knxd            /tmp/knx

Monitor sending telegrams with “knxtool groupswrite ip:localhost 4/0/1 1”

“On the bus knx listen”

root@raspberrypi:/home/pi# knxtool groupsocketlisten ip:localhost
Write from 1.1.134 to 4/0/15: 01
Write from 1.1.121 to 4/0/15: 01

*.log

==> /var/log/openhab2/events.log <==
2017-11-28 11:19:12.973 [ItemCommandEvent          ] - Item 'knx_Vent2' received command ON

==> /var/log/openhab2/openhab.log <==
2017-11-28 11:19:12.975 [TRACE] [.binding.knx.internal.bus.KNXBinding] - Received command (item='knx_Vent2', command='ON')
2017-11-28 11:19:12.976 [TRACE] [.binding.knx.internal.bus.KNXBinding] - We received this event (item='knx_Vent2', state='ON') from KNX, so we don't send it back again -> ignore!
2017-11-28 11:19:12.978 [TRACE] [.binding.knx.internal.bus.KNXBinding] - Received update (item='knx_Vent2', state='ON')
2017-11-28 11:19:12.979 [TRACE] [g.knx.internal.dpt.KNXCoreTypeMapper] - toTypeClass looking for dptId = 1.001
2017-11-28 11:19:12.981 [TRACE] [.binding.knx.internal.bus.KNXBinding] - found 1 compatible datapoints for item knx_Vent2 (org.openhab.core.library.types.OnOffType)
2017-11-28 11:19:12.983 [INFO ] [tuwien.auto.calimero                ] - calimero.link.224.0.23.12:3671: send message to 4/0/15, wait for confirmation
2017-11-28 11:19:12.983 [DEBUG] [.binding.knx.internal.bus.KNXBinding] - Wrote value 'ON' to datapoint 'command DP 4/0/15 knx_Vent2, DPT main 0 id 1.001, low priority'
2017-11-28 11:19:12.986 [DEBUG] [tuwien.auto.calimero                ] - calimero.link.224.0.23.12:3671: cEMI L-Data.ind from 1.1.128 to 4/0/15, low priority hop count 6 tpdu 00 81
2017-11-28 11:19:12.987 [DEBUG] [tuwien.auto.calimero                ] - KNXnet/IP Routing 224.0.23.12:3671: add to multicast loopback frame buffer: L-Data.ind from 1.1.128 to 4/0/15, low priority hop count 6 tpdu 00 81
2017-11-28 11:19:12.989 [DEBUG] [tuwien.auto.calimero                ] - KNXnet/IP Routing 224.0.23.12:3671: sending cEMI frame seq 0, non-blocking, attempt 1 (channel 0) 06 10 05 30 00 11 29 00 bc e0 11 80 20 0f 01 00 81
2017-11-28 11:19:12.991 [DEBUG] [tuwien.auto.calimero                ] - calimero.link.224.0.23.12:3671: send to 4/0/15 succeeded
2017-11-28 11:19:12.993 [DEBUG] [tuwien.auto.calimero                ] - process 224.0.23.12:3671: group write to 4/0/15 succeeded
2017-11-28 11:19:12.994 [DEBUG] [tuwien.auto.calimero                ] - KNXnet/IP Routing 224.0.23.12:3671: discard multicast loopback cEMI frame: L-Data.ind from 1.1.128 to 4/0/15, low priority hop count 6 tpdu 00 81

Monitor sent from openhab2.

“On the bus knx it don’t hear any message”

root@raspberrypi:/home/pi# knxtool groupsocketlisten ip:localhost`
-
-

*.log

==> /var/log/openhab2/events.log <==
2017-11-28 11:23:25.442 [ItemStateChangedEvent     ] - knx_Vent1 changed from OFF to ON

==> /var/log/openhab2/openhab.log <==
2017-11-28 11:23:25.445 [DEBUG] [.binding.knx.internal.bus.KNXBinding] - Wrote value 'ON' to datapoint 'command DP 4/0/1 knx_Vent1, DPT main 0 id 1.001, low priority'
2017-11-28 11:23:25.446 [INFO ] [tuwien.auto.calimero                ] - calimero.link.224.0.23.12:3671: send message to 4/0/1, wait for confirmation
2017-11-28 11:23:25.452 [DEBUG] [tuwien.auto.calimero                ] - calimero.link.224.0.23.12:3671: cEMI L-Data.ind from 1.1.128 to 4/0/1, low priority hop count 6 tpdu 00 81
2017-11-28 11:23:25.455 [DEBUG] [tuwien.auto.calimero                ] - KNXnet/IP Routing 224.0.23.12:3671: add to multicast loopback frame buffer: L-Data.ind from 1.1.128 to 4/0/1, low priority hop count 6 tpdu 00 81
2017-11-28 11:23:25.458 [DEBUG] [tuwien.auto.calimero                ] - KNXnet/IP Routing 224.0.23.12:3671: sending cEMI frame seq 0, non-blocking, attempt 1 (channel 0) 06 10 05 30 00 11 29 00 bc e0 11 80 20 01 01 00 81
2017-11-28 11:23:25.460 [DEBUG] [tuwien.auto.calimero                ] - KNXnet/IP Routing 224.0.23.12:3671: discard multicast loopback cEMI frame: L-Data.ind from 1.1.128 to 4/0/1, low priority hop count 6 tpdu 00 81
2017-11-28 11:23:25.462 [DEBUG] [tuwien.auto.calimero                ] - calimero.link.224.0.23.12:3671: send to 4/0/1 succeeded
2017-11-28 11:23:25.465 [DEBUG] [tuwien.auto.calimero                ] - process 224.0.23.12:3671: group write to 4/0/1 succeeded

Thanks

The binding is reporting that it’s sending the messages to the GAs…
The knxd service seems to be working alone (with the knxtool you can send and receive info to it)…
The knxd service seems to be listening to the proper address and port (0.0.0.0:3671 udp)
Your knx.cfg seems to be setup correctly (ROUTER type with the proper settings)

All looks good… I can’t see why OH2 with the KNX Binding does not communicate properly with the knxd service…

Can you post also your Item config please for knx_Vent1 & knx_Vent2 ?

I can’t identify a potential root-cause :frowning:

Yes

My iItems:

Group knx

Group LIGHT (knx)
Group OTROS_USOS (knx)


Switch knx_Vent1 "Vent 1" <light> (LIGHT) { knx="1.001:4/0/1" }
Switch knx_Vent2 "Vent 2" <poweroutlet> (OTROS_USOS) { knx="4/0/15" }

My sitemaps,

sitemap tablero_prueba label="KNX Sitemap" {
	Frame label="Fecha" 	{
	Text label="item calendar" icon="calendar"
	}
	
	Frame label="Tablero" {
		Text label="Grupo Ejemplo Tablero" icon="1stfloor" {
      		
      		Switch item=knx_Vent1 label="Vent_1" mappings=[ON="ON", OFF="OFF"]
    		Group item=LIGHT
			
			Switch item=knx_Vent2 label="Vent_2" mappings=[ON="ENCENDER", OFF="APAGAR"]
			Group item=OTROS_USOS
	}
}	

}

They look good. no errors there either…

Ok, let’s try something else:

use the following 2 alternative knx.cfg configs and try again…

option 1: Use another busaddr for OH2/KNX (1.1.128 is used by the knxd itself and clients range is: 1.1.129-1.1.145)

ip=224.0.23.12
port=3671
busaddr=1.1.140
ignorelocalevents=true
type=ROUTER
localIp=192.168.1.250
autoReconnectPeriod=30

option 2: switch to TUNNEL mode

ip=127.0.0.1
port=3671
busaddr=1.1.140
ignorelocalevents=true
type=TUNNEL
localIp=192.168.1.250
autoReconnectPeriod=30
1 Like

Not Work Dim

I am out of ideas :no_entry:
I also don’t use knxd, so I don’t know it very well (although your setup seems to be operational)
Maybe someone else can identify a culprit and assist…

1 Like

Dear Guys,

after meddling around for a few weeks with nearly the same issue, I think I can offer you a solution.

The problem lies within the OpenHAB knx binding, which requires to have a unique Bus-address, as stated in the config. knxd however issues adresses, based on its configured address space (-E x.y.z:n option), to its clients.

So, if you configure knxd with

 -E 1.1.244:2

and you advise OpenHAB to use 1.1.255 from this address space, it is a matter of chance to get a working link between knxd and OpenHAB. It will only connect, if knxd has assigned 1.1.244 to another client already. Otherwise you will get no connection.

I would recommend to use only one bus-address that knxd can issue, meaning that it can handle only one Tunneling connection! This is not great if you would like to program seomthing via ETS.
This works reliably, also in case of connections losses and forced reconnection

AutoReconnectPeriod=value

in OpenHABs knx.cfg,

Long talk short:

knxd.ini

[main]
addr = 1.1.0
cache = A.cache
client-addrs = x.y.z:1
connections = server,B.tpuarts
name = knxd
systemd = systemd

knx.cfg

ip=127.0.0.1
port=3671
busaddr=x.y.z
ignorelocalevents=true
type=TUNNEL
localIp=192.168.1.250
autoReconnectPeriod=30

1 Like