GithubHelp home page GithubHelp logo

guw / knx-utils Goto Github PK

View Code? Open in Web Editor NEW
10.0 5.0 4.0 102 KB

KNX Utilities for OpenHAB, Home Assistant and others

License: Eclipse Public License 2.0

Java 100.00%
knx openhab knxproj knx-binding converter home-assistant

knx-utils's Introduction

knx-utils

A set of utilities for working with the KNX bindings/integrations in OpenHAB and Home Assistant. This project was created to easy the process of creating a configuration files for the OpenHAB KNX binding. It also allows to create configuration files for Home Assistant.

History / Project State

Note, the project is not complete. While working on it I lost interest in OpenHAB and switched to Home Assistant. I created the configuration files once based on the analyzer output and never really had a need to complete the original intended functionality.

Branch & PR Validation

How to Test and Contribute

  1. Install (if not already presen) Java 11, Maven 3.6 (or greater) and Git

  2. Clone and build

git clone [email protected]:guw/knx-utils.git
cd knx-utils
mvn clean verify
  1. Open in your favorite IDE (eg., in Eclipse via File > Import... > Existing Maven Projects, point Root Directory to knx-utils)

  2. Run knx-utils/cli/src/main/java/io/guw/knxutils/cli/KnxConvertCommand.java with its main method

java -jar cli/target/knx-utils-cli.jar

ETS Project Converter

The programming tool of choice for KNX is the ETS software. It contains all essential data of a KNX installation. The first available utility is a converter for creating OpenHAB configuration information from ETS data.

The process is easy:

  1. Export a single project from ETS into a .knxproj file.
  2. Run converter to create OpenHAB files.
  3. Place generated files into OpenHAB configuration directory.

The converter applies semantic processing on the exported KNX project. This semantic processing helps generating proper OpenHAB configuration files. It understands keywords (tags) used in names and descriptions of group addresses and device communication objects as well as patterns found in group addresses.

Status

  • This is a proof of concept. Lots of missing features.
  • Only German names/descriptions supported so far
  • No OpenHAB files generated yet. Still working on analyzing a KNX project.

Please help improve the semantic processing by submitting pull requests.

Setup German Decompounding

In order to use enhanced language features dictionaries need to be downloaded from uschindler/german-decompounder. They cannot be distributed due to licensing concerns.

cd <.../>knx-utils/semantic-analyzer
mvn -Pdownload-german-data generate-sources

Analysis of Group Addresses

During analysis phase all group addresses will be analyzed. The analysis will identify lights, switches, dimmers, rollershutters, thermostats, etc. There is a heuristic that tries to identify all of this based on GA names, descriptions, connections, location and GA parent groups. However, this is not always sufficient. If you encounter deficiencies please contribute solutions!

Languages

The tool is capable of supporting multiple languages. At this time only the German language support is implemented. Please contribute support for your language!

Patterns

The analysis is mostly based on best practices as defined by KNX.org (eg., "KNX Projektrichtlinien (KNX-Project-Design-Guidelines_de.pdf)"). These best practices define patterns ("charachteristics") of a KNX project. If you would like to see additional characteristics being supported, please contribute an implementation of KnxProjectCharacteristics.

Devices Categories

As part of the analysis, a GA will be annotated with a device category. In order to detect a category, GA names and description will be considered. The following table gives an introduction what is supported.

The logic is: GA name contains <term> or GA name starts with <prefix> or GA descriptions contains [tag]

Category Terms (DE, case-insensitive) Prefix (DE, exact case) Tags (DE, exact case)
Light Lampe, Leuchte, Licht, Beleuchtung, Spots, Strahler (und zusammengesetzte Varianten) L_, LD_, LDA_ [Licht]
Shutter Rollo, Rollladen (und weitere Varianten) R_ [Rollo]
Heating Heizung (und Varianten) H_ [Heizung]

Note: detection of additional functionality (eg., such as "a dimmable light") will be based on the availability of related GAs. If you have any suggestions for improvement, please don't hesitate and contribute.

Block of GAs

Once a device category is known, its primary GA and related GAs will be detected. This detection happens based on GA DPT and name analysis. As per recommendation of KNX.org, the following blocks will be searched once a primary GA is detected.

Lights

GA Function DPT Detected Suffixes (DE)
x/y/z Switch (on/off) 1.001 E/A, Ein/Aus
x/y/z+1 Dimming (brighter/darker) 3.007 DIM, Dimmen, Heller/Dunkler
x/y/z+2 Brightness (0..100%) 5.001 WERT, Helligkeitswert
x/y/z+3 State of switch (on/off) 1.011 RM, Status
x/y/z+4 State if brightness (0..100%) 5.001 RM WERT, Status Wert

Shutter

GA Function DPT Detected Suffixes (DE)
x/y/z Up/down 1.001
x/y/z+1 Stop
x/y/z+2 Position shutter (0..100%)
x/y/z+3 Position blade (0..100%)
x/y/z+4 Shadow
x/y/z+5 Disable
x/y/z+6 State position shutter
x/y/z+7 State position blade

Heating

GA Function DPT Detected Suffixes (DE)
x/y/z Value
x/y/z+1 Actual temperature
x/y/z+2 Base wanted temperature
x/y/z+3 State
x/y/z+4 State wanted temperature
x/y/z+5 ...
x/y/z+6 ...
x/y/z+7 ...
x/y/z+8 ...
x/y/z+9 State mode

knx-utils's People

Contributors

dependabot[bot] avatar guw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

knx-utils's Issues

Test error

Hi there. I tried out this project, but during running tests with mvn, I get:

13:50:10:255 DEBUG Found matching status for GA 1/0/1 [dpt 1.001]: 1/0/4 [dpt 1.011]
13:50:10:262 DEBUG No candidate indentified with DPT State based on block pattern for GA 1/0/1 [dpt 1.001]
[ERROR] Tests run: 7, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 0.363 s <<< FAILURE! - in io.guw.knxutils.semanticanalyzer.GenericGermanyKnxProjectCharacteristicsTest
[ERROR] io.guw.knxutils.semanticanalyzer.GenericGermanyKnxProjectCharacteristicsTest.findMatchingStatusGroupAddress_pattern_group Time elapsed: 0.006 s <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <10/0/1 [dpt 1.011]> but was:
at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1124)
at io.guw.knxutils.semanticanalyzer.GenericGermanyKnxProjectCharacteristicsTest.findMatchingStatusGroupAddress_pattern_group(GenericGermanyKnxProjectCharacteristicsTest.java:66)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:210)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

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.