calimero-project / calimero-server

KNXnet/IP server for KNX IP, KNX (RF) USB, FT1.2, and TP-UART
Other
52 stars 18 forks source link

Problem running ft12-cemi KNX BAOS MODULE 838 KBERRY #24

Open georgegougoudis opened 3 weeks ago

georgegougoudis commented 3 weeks ago

I am trying to get Calimero Server to work with this module on a raspberry pi 5 running home assistant and I am facing some issues.

For one, I can get a different interface with TPUART to work properly and even program through ETS without any problems. I can also run KNXD on the same setup with ft12cemi and it works properly for communication (I could never get KNXD to program with ETS though).

I am building a docker image based on dockerhub image. The logs are

WARNING: Unknown module: io.calimero.serial.provider.rxtx specified to --add-reads
15:07:01.065 [INFO   ] io.calimero.server.knx-server: Calimero KNX IP server v3.0-SNAPSHOT
15:07:01.088 [INFO   ] io.calimero.server.knx-server: use configuration 'KNX IP Server' with 1 service container, discovery: listen on [all] send on [all] interfaces
service container /dev/ttyAMA0:
    server: listen on end0 (port 3671), KNX IP routing multicast group 224.0.23.12
    Ft12 /dev/ttyAMA0 cemi connection: TP1 medium, device 1.1.0
15:07:01.106 [INFO   ] io.calimero.server.gateway.knx-server: activate '/dev/ttyAMA0' disruption buffer on ports [5,555-5,559], disruption timeout 30 s
15:07:01.171 [INFO   ] io.calimero.server.knx-server: discovery endpoint [docker0, hassio, end0, lo] is up and running
15:07:01.173 [INFO   ] io.calimero.knxnetip.KNXnet/IP Routing 224.0.23.12:3671: multicast loopback mode enabled
15:07:01.178 [INFO   ] io.calimero.server.knx-server: /dev/ttyAMA0 secure mgmt/tunneling connections: optional/optional
15:07:01.179 [INFO   ] io.calimero.server.knx-server: /dev/ttyAMA0 KNX IP routing service (end0 224.0.23.12) is up and running
15:07:01.185 [INFO   ] io.calimero.server.knx-server: /dev/ttyAMA0 tcp service (end0 192.168.1.75:3671) is up and running
15:07:01.186 [INFO   ] io.calimero.server.knx-server: /dev/ttyAMA0 control endpoint (end0 192.168.1.75:3671) is up and running
15:07:01.819 [INFO   ] io.calimero.serial.FT12:/dev/ttyAMA0: close serial port /dev/ttyAMA0 - acknowledgment timeout on sending reset
15:07:01.871 [ERROR  ] io.calimero.link.connector: initial connection attempt
io.calimero.KNXAckTimeoutException: resetting BCU failed (no acknowledge reply received)
    at io.calimero.core/io.calimero.serial.FT12Connection.sendReset(FT12Connection.java:476)
    at io.calimero.core/io.calimero.serial.FT12Connection.reset(FT12Connection.java:451)
    at io.calimero.core/io.calimero.serial.FT12Connection.<init>(FT12Connection.java:244)
    at io.calimero.core/io.calimero.serial.FT12Connection.<init>(FT12Connection.java:221)
    at io.calimero.core/io.calimero.link.KNXNetworkLinkFT12.newCemiLink(KNXNetworkLinkFT12.java:68)
    at io.calimero.server@3.0-SNAPSHOT/io.calimero.server.gateway.SubnetConnector.lambda$openNetworkLink$10(SubnetConnector.java:340)
    at io.calimero.core/io.calimero.link.Connector$Link.connect(Connector.java:424)
    at io.calimero.core/io.calimero.link.Connector$Link.<init>(Connector.java:195)
    at io.calimero.core/io.calimero.link.Connector.newLink(Connector.java:151)
    at io.calimero.server@3.0-SNAPSHOT/io.calimero.server.gateway.SubnetConnector.openNetworkLink(SubnetConnector.java:381)
    at io.calimero.server@3.0-SNAPSHOT/io.calimero.server.gateway.KnxServerGateway.run(KnxServerGateway.java:731)
    at io.calimero.server@3.0-SNAPSHOT/io.calimero.server.Launcher.run(Launcher.java:655)
    at io.calimero.server@3.0-SNAPSHOT/io.calimero.server.Launcher.main(Launcher.java:620)

My config (which works perfectly for tpuart subnet) is:

<?xml version="1.0" encoding="UTF-8"?>

<!-- Calimero server settings (required for startup) -->
<knxServer name="knx-server" friendlyName="KNX IP Server">
    <!-- KNXnet/IP search & discovery -->
    <discovery listenNetIf="all" outgoingNetIf="all" activate="true" />

    <!-- Provides the KNXnet/IP-side configuration for access to one KNX subnet -->
    <serviceContainer activate="true" routing="true" networkMonitoring="true"
        udpPort="3671" listenNetIf="end0">
        <knxAddress type="individual">1.1.0</knxAddress>
        <routing/>
        <disruptionBuffer expirationTimeout="30" udpPort="5555-5559" />
        <knxSubnet type="ft12" medium="tp1" format="cemi" knxAddress="0">/dev/ttyAMA0</knxSubnet>
        <groupAddressFilter>
            <!-- <knxAddress type="group">2/1/1</knxAddress> -->
            <!-- <knxAddress type="group">2/1/0</knxAddress> -->
            <!-- <knxAddress type="group">2/1/20</knxAddress> -->
        </groupAddressFilter>

        <!-- Additional KNX individual addresses assigned to client KNXnet/IP connections (optional) -->
        <additionalAddresses>
            <knxAddress type="individual">1.1.240</knxAddress>
            <knxAddress type="individual">1.1.241</knxAddress>
            <knxAddress type="individual">1.1.242</knxAddress>
            <knxAddress type="individual">1.1.243</knxAddress>
            <knxAddress type="individual">1.1.244</knxAddress>
        </additionalAddresses>
    </serviceContainer>

</knxServer>

By searching through the issues here I've found #9 which is almost identical to my setup and I'm trying to use it.

Also I cant figure out how to enable DEBUG/TRACE logging, I tried something like:

-Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG

but it doesn't work. I am not very familiar with the JAVA environment so that may be completely wrong.

UPDATE: I got it to work (programming + communication) by resetting both the pi and the bus power supply, still can't figure out why my own installation doesn't work though.

bmalinowsky commented 3 weeks ago

For trace logging, you can try to set -vvv, like so: calimeroproject/knxserver -vvv /path/to/server-config.xml.

Calimero uses the System.Logger façade, the docker image just uses the internal stdout logger. You should also be able to set the level with the jdk.system.logger.level system property (INFO, DEBUG, TRACE). In the image, there are no slf4j libraries inlcuded; if you want to use slf4j, you have to add those libraries into the lib folder.

The discarding of frames due to hop count 0 is usually because there is a loop somewhere.

georgegougoudis commented 3 weeks ago

The discarding thing makes sense. Any idea as to why it fails to reset BCU with the docker hub image? I tried -vvv and -Djdk.system.logger.level=TRACE but i still get no debug output.

bmalinowsky commented 3 weeks ago

Why the reset fails I cannot say from the info you posted, sometimes people mix up ACM and AMA which would lead to the same error.

-D... options are for the JVM, so you need to pass it, e.g., via the export CALIMERO_SERVER_OPTS= you have in run.sh.

Also, put the -vvv before --no-stdin.