Giter Site home page Giter Site logo

knx-telegraf-config-generator's Introduction

KNX Telegraf Config Generator

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.

Why

It's not uncommon for KNX projects to have hundreds or thousands of devices and manually managing the configuration can be an arduous task.

Getting started

Pre-requirements

  • python 3
  • pip

Installation

# install dependencies
pip install -r requirements.txt

Preparation

  1. Copy your knx_project_ets6.knxproj to ./resources/project.knxproj
  2. 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

Run Config Generator

# 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

Example

The ./resources/project.knxproj file contains a sample project that can serve as a demonstration.

Group Addresses

Extract Group Addresses Output

// ./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": ""
   }
]

Telegraf Config

Generate Telegraf Config Output

# ./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"

knx-telegraf-config-generator's People

Contributors

svsool avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.