This project automates the generation of configuration for Telegraf's KNX Input Plugin, utilizing your KNX project directly, in order to easily ingest metrics from KNX event bus and build real-time dashboards on top of Grafana or InfluxDB UI.
It's not uncommon for KNX projects to have hundreds or thousands of devices and manually managing the configuration can be an arduous task.
- python 3
- pip
# install dependencies
pip install -r requirements.txt
- Copy your
knx_project_ets6.knxproj
to./resources/project.knxproj
- Adjust settings in config.py if necessary
- Possibility to change KNX interface type and address
- Possibility to ignore group address by address, address prefix, dpt type, dpt type prefix
- Possibility to ignore missing dpt subtypes or replace missing subtype with a default value
# parses KNX project and writes group addresses to ./output/group_addresses.json
python extract_group_addresses.py
# ingests group addresses and writes KNX Input Plugin config to ./output/telegraf_config.toml
python generate_telegraf_config.py
The ./resources/project.knxproj
file contains a sample project that can serve as a demonstration.
// ./output/group_addresses.json
[
{
"name": "Fenster Sicherheit",
"identifier": "GA-18",
"raw_address": 520,
"address": "0/2/8",
"dpt_type": {
"main": 1,
"sub": 1
},
"communication_object_ids": [],
"description": ""
},
{
"name": "Fenster Automatik Sperre",
"identifier": "GA-19",
"raw_address": 521,
"address": "0/2/9",
"dpt_type": {
"main": 1,
"sub": 1
},
"communication_object_ids": [],
"description": ""
},
{
"name": "Innentemperatur °C",
"identifier": "GA-20",
"raw_address": 768,
"address": "0/3/0",
"dpt_type": {
"main": 9,
"sub": 1
},
"communication_object_ids": [],
"description": ""
}
]
# ./output/telegraf_config.toml
[[inputs.knx_listener]]
service_type = "router"
service_address = "224.0.23.12:3671"
[[inputs.knx_listener.measurement]]
name = "Fenster Sicherheit"
addresses = [ "0/2/8" ]
dpt = "1.001"
[[inputs.knx_listener.measurement]]
name = "Fenster Automatik Sperre"
addresses = [ "0/2/9" ]
dpt = "1.001"
[[inputs.knx_listener.measurement]]
name = "Innentemperatur °C"
addresses = [ "0/3/0" ]
dpt = "9.001"