Logging KNX bus traffic to InfluxDB

57 views
Skip to first unread message

Greig Sheridan

unread,
Aug 7, 2024, 7:48:14 PM8/7/24
to knxd

Hi All,


AlexH has a great post on using rsyslog & logrotate to capture KNX bus traffic, and I figure I can then use telegraf’s [[inputs.tail]] (after some massaging in a processor) to get this into Influx.


Unfortunately I can’t get the data into the decoded format like output by vbusmonitor1. A KNXD_OPTS="-t 1" is the closest I can get (and I’ve walked all 16 bits looking for better without any success!)


vbusmonitor:

pi@knxLogger4:~ $ knxtool vbusmonitor1 ip:localhost L_Busmon: BC 11 01 08 01 E1 00 81 3A :L_Data low from 1.1.1 to 1/0/1 hops: 06 T_Data_Group A_GroupValue_Write (small) 01 L_Busmon: BC 11 0C 08 02 E1 00 81 34 :L_Data low from 1.1.12 to 1/0/2 hops: 06 T_Data_Group A_GroupValue_Write (small) 01

Current best effort – with ‘noise’ I want to trim if possible:

2024-08-08T09:13:28.543862+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [26:B.tpuarts/log 106.225] Recv L_Data low from 1.1.1 to 1/0/3 hops: 06 T_Data_Group A_GroupValue_Write (small) 0D 2024-08-08T09:13:28.544080+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [12:server/Server 106.225] Send(017): 06 10 05 30 00 11 29 00 BC D0 11 01 08 03 01 00 8D 2024-08-08T09:13:28.544294+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [12:server/Server 106.225] Dropped(017): 06 10 05 30 00 11 29 00 BC D0 11 01 08 03 01 00 8D 2024-08-08T09:13:28.800763+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [28:B.tpuarts/log 106.484] Recv(009): BC 11 0C 08 02 E1 00 81 34 2024-08-08T09:13:28.801079+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [26:B.tpuarts/log 106.484] Known Addr 1/0/2: yes 2024-08-08T09:13:28.801383+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [25:B.tpuarts/LowF 106.484] SendAck 11 2024-08-08T09:13:28.801611+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [28:B.tpuarts/log 106.484] Send(001): 11 2024-08-08T09:13:28.801825+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [26:B.tpuarts/log 106.484] Recv L_Data low from 1.1.12 to 1/0/2 hops: 06 T_Data_Group A_GroupValue_Write (small) 01 2024-08-08T09:13:28.802104+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [12:server/Server 106.484] Send(017): 06 10 05 30 00 11 29 00 BC D0 11 0C 08 02 01 00 81 2024-08-08T09:13:28.802336+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [12:server/Server 106.485] Dropped(017): 06 10 05 30 00 11 29 00 BC D0 11 0C 08 02 01 00 81 2024-08-08T09:13:29.345515+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [28:B.tpuarts/log 107.029] Recv(009): BC 11 01 08 03 E1 00 8D 34 2024-08-08T09:13:29.345842+10:00 knxLogger4 knxd[2445]: knxLogger: Layer 0 [26:B.tpuarts/log 107.029] Known Addr 1/0/3: yes

I’ve not had any luck with filtering.

I tried to enable the ‘montoring’ filter set to suppress SEND messages, without success:

KNXD_OPTS="-t 1 -e 1.1.240 -E 1.1.241:5 -n knxLogger -D -T -R -S -i -B monitor --arg=send=0 -b tpuarts:/dev/ttyKNX1"

(Re-ordering -B and its arg gave the same result).

Aug 08 09:31:13 knxLogger4 knxd[2739]: knxLogger: E00000032: [23:B.tpuarts] filter 'monitor' not found.

Am I missing something?

Alternatively, can anyone suggest a better way to get some decoded bus output into a file – or is there a better way of getting this to Influx?

Thanks,


Greig.

Matthias Urlichs

unread,
Aug 8, 2024, 12:24:05 PM8/8/24
to knxd
You want to capture KNX messages? tell knxd to -DR, then capture the multicast messages, with socat or some Python or whatever; then mangle as required.

Please don't even think of parsing knxd's debug output. That's not what it's for.

trun...@bluewin.ch

unread,
Aug 8, 2024, 2:55:02 PM8/8/24
to knxd
What do you mean by decoded bus data? Human readable values for temperature, time, date etc?
Well then you have to map somehow to the DPT - by reading the hex values on the bus you don't see thes values IMHO.

I know a rather easy way to accomplish that. Set up linknx daemon and connect it to knxd. In the linknx.xml configuration file you set up all interesting objects with the log option and then you will get a logfile for each object. Here an example for a room temperature:
2024-8-8 11:43:04 > 24.9
2024-8-8 12:23:04 > 25
2024-8-8 12:53:04 > 25.1
2024-8-8 14:35:04 > 25.2
2024-8-8 15:13:58 > 25.3
2024-8-8 16:25:04 > 25.4
2024-8-8 17:19:04 > 25.5
2024-8-8 19:01:04 > 25.6
2024-8-8 19:21:04 > 25.7
2024-8-8 19:59:04 > 25.6

or values from my KNX power supply:
2024-8-8 19:16:54 > 0.22490531
2024-8-8 19:26:53 > 0.22342567
2024-8-8 19:36:54 > 0.22194603
2024-8-8 19:46:53 > 0.22490531
2024-8-8 19:56:54 > 0.23082386
2024-8-8 20:06:54 > 0.22342567
2024-8-8 20:16:54 > 0.22786458
2024-8-8 20:26:53 > 0.22342567
2024-8-8 20:36:53 > 0.22194603
2024-8-8 20:46:55 > 0.23082386

or from my C02 sensor:
2024-8-8 19:17:01 > 714
2024-8-8 19:27:01 > 733
2024-8-8 19:37:01 > 728
2024-8-8 19:47:01 > 738
2024-8-8 19:57:01 > 752
2024-8-8 20:07:01 > 759
2024-8-8 20:17:01 > 756
2024-8-8 20:27:01 > 788
2024-8-8 20:37:01 > 769
2024-8-8 20:47:01 > 783

Regards, Othmar

Greig Sheridan

unread,
Aug 8, 2024, 9:36:58 PM8/8/24
to knxd

Thanks Matthias.

 

Without some more detailed documentation or worked examples I fear your suggestion's too advanced for my skill level. (I had a look at the .py script in the examples, but I don't think it's been touched since the original repo. It dies with `No module named 'EIBConnection'` and I have no idea what to import or install to get beyond that.)

I'm using Tijl's Pi HAT to read the bus directly rather than over the network from my knx router, but I'm pretty sure I should be able to somehow hook into knxd to sink my teeth into the bus' communications, but I'm a bit lost for the right way to do that, hence using the only data I could find, the logs.


- Greig.

Greig Sheridan

unread,
Aug 8, 2024, 9:39:31 PM8/8/24
to knxd

Thanks Othmar, linknx sounds like it's going to give me what I'm after, which is essentially just a delimited breakdown of source/destination address, DPT and value – the same as what I see in the ETS Diagnostics panel.

 

Am I right inferring that even with linknx I'll still need to write to a log file and then tail the data to telegraf/influxDB?


 \- Greig,

trun...@bluewin.ch

unread,
Aug 9, 2024, 1:43:40 AM8/9/24
to knxd
Well, I guess so but I did not play with it. I just wanted to point to the fact that it's doing the conversion to human readable values. The docu states that default output is stdout so you may just pipe it.

Regards, Othmar

Greig Sheridan

unread,
Aug 9, 2024, 5:07:17 PM8/9/24
to knxd
And much appreciated. The knxd log file set to `-t 1` still generates a large file each day for my (relatively) tiny network.

\- G.

Greig Sheridan

unread,
Aug 9, 2024, 11:48:21 PM8/9/24
to knxd

I think I’ve found what I’ve been looking for: a python knxd client.

https://github.com/mhthies/knxdclient

(venv) pi@knxLogger4:~ $ python3 test.py Telegram from 1.1.1 to GAD 1/0/1: True Telegram from 1.1.1 to GAD 1/0/1: False

trun...@bluewin.ch

unread,
Aug 11, 2024, 4:07:07 AM8/11/24
to knxd
Just to make sure: I was only talking about logging options of linknx. knxd logging would not be needed to feed from linknx
Reply all
Reply to author
Forward
0 new messages