[SOLVED] OH2.3 with Knx-Binding: Can using 2 Knx Bridges in two .things-files cause Problems?

bridge
openhab2
knx
Tags: #<Tag:0x00007f51dea72880> #<Tag:0x00007f51dea72628> #<Tag:0x00007f51dea724e8>

(Matthias) #1

Hello,

I am using OpenHAB 2.3 running on Debian GNU/Linux 9.5 (stretch) with the KNX Binding.

I made the mistake and created 2 KNX bridges in two different thing files (named differently). Both Bridges were equal except the Things/devices.

Now, the knx binding (i guess) stopped working, because i cant control any knx light via openhab. I restarted the PC multiple times, deinstalled and reinstalled the knx binding, i couldnt get it to work again. Can anyone help me?

Matthias


(CM6.5 H102) #2

Try cleaning the cache.

sudo systemctl stop openhab2

sudo openhab-cli clean-cache

sudo systemctl start openhab2
or
sudo reboot


(Matthias) #3

Thank you for the anser, but it did not solved the problem.


(CM6.5 H102) #4

If using DHCP and no reserved/static IP set in your router have you checked to see if there has been an IP address change?


(Matthias) #5

didn’t change.

I consulted the karaf console with Start_debug.sh and saw alot of errors. Maybe OH will work after i fixed this errors…
The console can be started with: cd /usr/share/openhab2 and ./start_debug.sh and after this “log:tail”

Edit now I have an Error: ".items has errors, therefore ignoring it: [1,1]: missing EOF at ’ ’

I am worried about the ’ ’ and the line and position number… There is a comment in the first line. And at the first character is a /. This comment is there since the beginning and it worked fine until today.

Thanks.
Mat


(Udo Hartmann) #6

Comment should be //, not /


(Matthias) #7

Udo, thanks, for the answer

yes there was a “//”. When i said “the first character is a” i meant it literaly^^ Like in [1,1] Line one, char one.

Problem is solved. I copied the whole itemsfile into a new file and everything worked. Despite a few other errors.
But thanks.

Conclusion: i dont know where the problem was. It seams that copying the content of the item file to a new one solved the major problem. Maybe the 2 knx bridges to the same KNX ip-interface where to much for OH2.3


(Udo Hartmann) #8

I guess this was a try to split the things file? :wink:


(Matthias) #9

yes, i tried to keep my OH Code as isolated from the code from my colleagues…
But having a second thingsfile is one more connection the the KNX IP interface which can handle only a certain numbers of action…

is there another reason why it is a bad idea to split a things file?


(Udo Hartmann) #10

Well, it’s the wrong way, I guess.

afaik it should be possible to use another notation:

Bridge knx:ip:bridge [ 
    ipAddress="192.168.0.10", 
    // portNumber=3671, 
    localIp="192.168.0.11", 
    type="TUNNEL", 
    // readingPause=50, 
    // responseTimeout=10, 
    // readRetriesLimit=3, 
    // autoReconnectPeriod=1,
    localSourceAddr="0.0.0"
]

Thing knx:device:generic [ 
        bridge="bridge",
        // address="1.2.3",
        // fetch=true,
        // pingInterval=300,
        // readInterval=3600
    ] {
        Type switch        : demoSwitch        "Light"       [ ga="3/0/4+<3/0/5" ]
        Type rollershutter : demoRollershutter "Shade"       [ upDown="4/3/50+4/3/51", stopMove="4/3/52+4/3/53", position="4/3/54+<4/3/55" ]
        Type contact       : demoContact       "Door"        [ ga="1.019:<5/1/2" ]
        Type number        : demoTemperature   "Temperature" [ ga="9.001:<5/0/0" ]
        Type dimmer        : demoDimmer        "Dimmer"      [ switch="5/0/0+<5/0/1", position="5/0/2+<5/0/3", increaseDecrease="5/0/4" ]
        Type string        : demoString        "Message"     [ ga="5/3/1" ]
        Type datetime      : demoDatetime      "Alarm"       [ ga="5/5/42" ]
    }

Please notice the different Thing head.
This is not tested, but I got the notation by accident when configuring MQTT2 and it worked, so maybe this will also work for KNX2.
This way the things could be configured in a separate (or even more) things file.


(Matthias) #11

My thing file looks like that.
I just copied everything from the top until before the “Thing knx:device:generic” and wrote another “device” in it. Same Bridge , same ip and so on. And suddenly the 1st thing file stopped working


(Udo Hartmann) #12

You don’t have to define the bridge two times. That part was only to show the difference between normal definition (would have curly brackets around all things, right after the bridge definition) and this one (doesn’t have curly brackets after the bridge definition at all, instead the bridge is set for each thing in the thing definition.


(Udo Hartmann) #13

Finally, I found the “other” notation. So, it’s possible to configure knx bridge and knx things in separate files:

Bridge knx:ip:myBridge "My Bridge" @ "knx" [
    type="TUNNEL",
    ipAddress="192.168.178.55"
]

Thing knx:device:myDevice (knx:ip:myBridge) "My Device" @ "knx" [
    address="1.1.1",
    fetch=false,
    pingInterval=600,
    readInterval=0
 ] {
    Type switch : ...
}
 

So, the bridge is set explicitly through the round brackets. I did a short test and this notation seems to work.

See MQTT 2.4 documentation for reference. Thanks to @crxporter for giving the hint :slight_smile: