KNX does not work anymore with my items

knx
Tags: #<Tag:0x00007fe058b34b98>

(Bernd Langner) #7

Continuing the discussion from KNX does not work anymore with my items:

Thank you very much for your quick answer.
It is Tunneling with a Siemens interface N148
(in my old formerly working knx.cfg Type=TUNNEL)
Do I have to reboot the openhabian Raspberry after making all the changes?
Do I have to delete the old knx.cfg?

This is the PA of one of your KNX Actuators (I have a lot of actuators which one?)
Up to now I have:

Bridge knx:ip:bridge [
ipAddress=“192.168.178.20”,
portNumber=3671,
localIp=“192.168.178.58”,
type=“TUNNEL”,
readingPause=50,
responseTimeout=10,
readRetriesLimit=3,
autoReconnectPeriod=1,
localSourceAddr=“0,0,0”
// “1.1.4” physikalisch 15.15.254
] {
Thing device generic [
address="?",
fetch=true,
pingInterval=300,
readInterval=3600
] {

   Type switch          : Licht_Arbeitszimmer       "Lampe Arbeitszimmer"           [ ga="<2/0/2" ]
   Type switch          : Steckdose_Arbeitszimmer   "Steckdose Arbeitszimmer"       [ ga="3/0/2" ] 

and in items:
Switch Licht_Arbeitszimmer “Lampe Arbeitszimmer” (gF_Licht,gR_AZ) { channel=“knx:device:bridge:generic:Licht_Arbeitszimmer” }

Switch Steckdose_Arbeitszimmer “Steckdose Arbeitszimmer” (gF_Steckdose,gR_AZ) { channel="knx:device:bridge:generic:Steckdose_Arbeitszim


(Angelos) #8

Ok, it supports up to 4 KNXnet/IP Tunneling connections so you will be fine. What did you use in knx.cfg for the busaddr parameter? (this is the same as the new localSourceAddr and it defaults to 0.0.0 in both KNXv1 as well as KNXv2)

No, you are on the Linux world where uptime is important :slight_smile: No need for reboots. Just service restarts if needed.

Yes. Keep a backup and make sure that you have uninstalled the old KNXv1 binding.

Try this:

Bridge	knx:ip:bridge [
   		ipAddress="192.168.178.20",
   		portNumber=3671,
   		localIp="192.168.178.58",
   		type="TUNNEL",
   		readingPause=50,
   		responseTimeout=10,
   		readRetriesLimit=3,
   		autoReconnectPeriod=1,
   		localSourceAddr="0.0.0" ]
   		{
   			Thing device generic [ address="1.2.3", fetch=true, pingInterval=300, readInterval=0]
   			{
   				Type switch : Channel_1_2_3_1 "Lampe Arbeitszimmer" [ ga="2/0/2" ]
   				Type switch : Channel_1_2_3_2 "Steckdose Arbeitszimmer" [ ga="3/0/2" ] 
   			}
   		}

and items:

Switch Licht_Arbeitszimmer "Lampe Arbeitszimmer" (gF_Licht,gR_AZ) { channel="knx:device:bridge:generic:Channel_1_2_3_1" }
Switch Steckdose_Arbeitszimmer "Steckdose Arbeitszimmer" (gF_Steckdose,gR_AZ) { channel="knx:device:bridge:generic:Channel_1_2_3_2" }

don’t use the same name for the Items and for the Channels. It is better to use different names.


(Angelos) #9

You have to define a Thing (with it’s channels) for each Actuator. Set their PA in the address="1.2.3" of each Thing.

Note: Do you have status GAs also?
In your switch type of Channels you used only 1 (command) GA (2/0/2 and 3/0/2)
If you have status GAs then use them like this:

...
   				Type switch : Channel_1_2_3_1 "Lampe Arbeitszimmer" [ ga="2/0/2+<Status_GA" ]
   				Type switch : Channel_1_2_3_2 "Steckdose Arbeitszimmer" [ ga="3/0/2+<Status_GA" ] 
...

(Bernd Langner) #10

So I have for each actuator e.g. PA 1.1.5 to define all the group addresses which belong to this actuator?
So I have to repeat:
Thing device generic [
address=“1.1.4”, (the physical address in the ETS
fetch=true,
pingInterval=300,
readInterval=3600
] { … switches

Thing device generic [
address=“1.1.7”,
fetch=true,
pingInterval=300,
readInterval=3600
] { …switches
for each actuator?

What if to one PA has more than one actuators? becuase it is a binary exit with four relais.
Kind Regards
bernd


(Angelos) #11

yes, for each Physical device having it’s own PA, you need to define a separate Thing with its channels and put the GAs in the Channels (like in your example)

Question: Why do you need the readInterval ? Your actuators don’t have Status GAs configured?

Explain please. Which relay actuator model do you have?
I don’t think that you can have 2 physical devices (KNX Actuators) sharing the same PA in the KNX Bus.


(Bernd Langner) #12

a) I have some (newer) actuators which have a status GA, some old ones not
I also have other devices like motion detectors (but they are no actuators). Do I have to define the corresponding GA too although they are integrated in group addreses of the actuators?
Some group addresses switch more than one PAs. So I have to define these GAs in all PAs
b) I have e.g. one PA 1.1.5 which has 4 exits - but it is one device

I would not like to have cryptical names for the things (Channel _1_1_3) - so i would prefer to add a “T” to the things compared to the group address like Licht_ArbeitszimmerT (Thing) and Licht_Arbeitszimmer (item). Is that OK?

Then I have a question:
How can I delete the old KNX Binding (which was not installed by PaperUI)

Thank you so much for your help


(Angelos) #13

You can define a “generic” Thing without specifying a PA and list there the Channels and their corresponding GAs.

This means that you will define 1 Thing with 4 Channels

Of course. You can use any naming convention that you want. You can also use the same name for the Channel (not Thing) as for the Item… but you may get confused if you use exactly the same.

See how <Bridge_Name>, <Thing_Name> & <Channel_Name> work below

Bridge	knx:ip:<Bridge_Name> "<Bridge_Label>" [
...
   			Thing device <Thing_Name> "<Thing_Label>" [ address="1.2.3", fetch=true, pingInterval=300, readInterval=0]
   			{
   				Type switch : <Channel_Name> "<Channel_Label>" [ ga="2/0/2" ]
   				Type switch : <Channel_Name> "<Channel_Label>" [ ga="3/0/2" ] 
   			}

In your items, it will look like this:

channel="knx:device:<Bridge_Name>:<Thing_Name>:<Channel_Name>"

This stuff within the double quotes is called the Channel UID (Unique Identifier) and it shows up in PaperUI also

If you installed it manually, remove the *.jar file from /usr/share/openhab2/addons/ and clean Cache & tmp folders
If you installed it using the /etc/openhab2/services/addons.cfg, remove the knx1 entry from the bindings = line
Remove also (after you keep a backup) the /etc/openhab2/services/knx.cfg file


(Bernd Langner) #14

Hello Dim,
I am a little confused now.
But I will first write the Things-File and then send to you.
Can I send the file (not so Big about 10 actuators) to you by mail?
Kind Regards
Bernd


(Angelos) #15

I know… it’s a lot of new stuff to learn with the new KNXv2 binding… but it works fine (better than KNXv1)

You can post your configs here if you would like. Make sure that you enclose the configs in code fences (```) to make them easier to read.

There are many other KNXv2 users here who can also help

What is confusing? Better to clarify in the beginning instead of correcting your KNX.things and KNX.items files later :slight_smile:


(Bernd Langner) #16

Hello Dim,
Everything is always very easy afterwards (after you have understood the principles)

So here is my KNX.things content:
‘’'Bridge knx:ip:bridge [
ipAddress=“192.168.178.20”,
portNumber=3671,
localIp=“192.168.178.58”,
type=“TUNNEL”,
readingPause=50,
responseTimeout=10,
readRetriesLimit=3,
autoReconnectPeriod=1,
localSourceAddr=“0,0,0”

] {
Thing device generic [
address=“1.1.5”,
fetch=true,
pingInterval=300,
readInterval=3600
] {
Type switch : Licht_WohnzimmerT “Licht Wohnzimmer” [ ga=“2/0/0” ]
Type switch : Licht_ArbeitszimmerT “Lampe Arbeitszimmer” [ ga="<2/0/2" ]
Type switch : Steckdose_WohnzimmerT “Steckdose TV Wohnzimmer” [ ga=“3/0/0” ]

}

Thing device generic [
    address="1.1.19",
    fetch=true,
    pingInterval=300,
    readInterval=3600
] {
   Type switch         : Steckdose_EcktischLampeT "Steckdose Lampe Ecktisch"            [ ga="3/0/11+<3/1/11" ]
   Type switch         : Steckdose_EcktischT "Steckdose Ecktisch"                       [ ga="3/0/10+<3/1/11" ]

}

Thing device generic [
    address="1.1.20",
    fetch=true,
    pingInterval=300,
    readInterval=3600
] {
   Type switch          : Steckdose_OkiT             "Oki Drucker"                   [ ga="3/0/4+<3/1/4" ]
   Type switch          : Steckdose_GalerieT         "Licht Bildergalerie"           [ ga="3/0/5+<3/1/5" ]

}
    Thing device generic [
            address="1.1.18",
            fetch=true,
            pingInterval=300,
            readInterval=3600
    ] {
    Type switch         : Steckdose_obenTelefonLinksT "Steckdose am Telefon links"   [ ga="3/0/8" ] 
    Type switch         : Switch Steckdose_obenTelefonRechtsT "SteckdoseTelefonrechts"   [ ga="3/0/9" ]

    }

    Thing device generic [
            address="1.1.14",
            fetch=true,
            pingInterval=300,
            readInterval=3600
    ] {
     Type switch         : Lampe_TerrasseT "Licht an der Terrasse"                        [ ga="1/0/0" ] 
    Type switch         : Lampe_GarageT "Licht an der Garage"                            [ ga="1/0/1" ] 
    Type switch         : Lampe_EingangT "Licht an der Haustür"                          [ ga="1/0/2" ] 
    Type switch         : Lampen_AussenT "Alle Außenlampen"                              [ ga="1/0/4" ] 
    Type switch         : BW_AlarmT      "Bewegungsmelder angeprungen"                    [ ga="1/0/41 ]  

    }

    Thing device generic [
            address="1.1.6",
            fetch=true,
            pingInterval=300,
            readInterval=3600
    ] {
     Type switch         : Steckdose_SchlafzimmerT "Lampe auf Sideboard"                  [ ga="3/0/1" ]
     Type switch          : Steckdose_ArbeitszimmerT   "Steckdose Arbeitszimmer"         [ ga="3/0/2" ]

    }

    Thing device generic [
            address="1.1.3",
            fetch=true,
            pingInterval=300,
            readInterval=3600
    ] {
      Type switch         : Switch Rolladen_SchlafzimmerT "Rolladen im Schlafzimmer"       [ ga="4/0/2" ]
      Type switch         : Rolladen_WohnzimmerT "Rolladen Wohnzimmer"                     [ ga="4/0/0" ]
       Type switch         : Rolladen_KuecheT "Rolladen in der Küche"                       [ ga="4/0/4" ]

    }

    Thing device generic [
            address="1.1.17",
            fetch=true,
            pingInterval=300,
            readInterval=3600
    ] {
      Type switch         : Lampe_SchlafzimmerT "Lampe am Kleiderschrank"                  [ ga="2/0/1" ]

    }

    Thing device generic [
            address="1.1.15",
            fetch=true,
            pingInterval=300,
            readInterval=3600
    ] {
      Type switch         : Steckdose_KellerT "Steckdose Keller (rote Lampe)"               [ ga="0/0/7" ] 

    }

    Thing device generic [
            address="1.1.13",
            fetch=true,
            pingInterval=300,
            readInterval=3600
    ] {
      Type switch         : FlurObenSofaLinksT "FlurObenLinks"               [ ga="3/0/6" ] 
      Type switch         : FlurObenSofaRechtsT "FlurObenRechts"               [ ga="3/0/7" ] 

    }

}
‘’’

and here is an example from the Item-File:
‘’’
Switch Licht_Arbeitszimmer “Lampe Arbeitszimmer” (gF_Licht,gR_AZ) { channel=“knx:device:bridge:generic:Licht_ArbeitszimmerT” }
‘’’
Kind Regards
bernd


(Angelos) #17

I took a quick look and it looks ok. I would use different names for my Things (now you have used the name generic for all of them… I think that it’s going to work but I am not sure)

I will double check it later.

when adding code fences, start (first line) with (```) and end (last line) with (```) (without parenthesis) to enclose properly all the lines.

I see that you added the T to your Channel names. That’s fine and it will work… remember that you are naming a Channel (not a Thing), so you may want to use C instead :slight_smile:


(Bernd Langner) #18

[quote=“BLg, post:16, topic:56714”]

Dear Dim,
I have changed the names to C at the end
Partly Success:
Only one Item ist Working:
This one
Type switch : Licht_ArbeitszimmerC “Lampe Arbeitszimmer” [ ga="<2/0/2" ]

belongs to
‘’’{
Thing device generic [
address=“1.1.5”,
fetch=true,
pingInterval=300,
readInterval=3600
] {
Type switch : Licht_WohnzimmerC “Licht Wohnzimmer” [ ga=“2/0/0” ]
(THIS ONE IS NOT WORKING)
Type switch : Licht_ArbeitszimmerC “Lampe Arbeitszimmer” [ ga="<2/0/2" ]
(THIS ONE IS WORKING)
Type switch : Steckdose_WohnzimmerC “Steckdose TV Wohnzimmer” [ ga=“3/0/0” ]
(THIS ONE IS NOT WORKING)

}''''

But Licht_WohnzimmerC and Steckdose_ArbeitszimmerC do not work.
Very Curious - is there something wrong - may be some special brackets or so.
I have also tried to change the name generic to e.g.PA11105 etc.
But the same result only the light in my home office works.
But nevertheless the first step is made… thank you

By the way I do not find the jar File to delete the KNX 1.
Kind regards
Bernd

REMARK: Now nothing works - there has been suddenly an additional KNX 1.12. in the Bindings (Paper UI) - I have deinstalled it and knx.cfg deleted. If I go to the HABadmin page I do not see knx.things in the configuration . I think the file knx.things is not loaded.


(Bernd Langner) #19

Now I have made the most simple installation with only 1 actor and Group address, but it does not work:
knx.things
‘’'Bridge knx:ip:bridge [
ipAddress=“192.168.178.20”,
portNumber=3671,
localIp=“192.168.178.58”,
type=“TUNNEL”,
readingPause=50,
responseTimeout=10,
readRetriesLimit=3,
autoReconnectPeriod=0,
localSourceAddr=“0.0.0”

] {
Thing device generic [
address=“1.1.1”,
fetch=true,
pingInterval=300,
readInterval=3600
] {
Type switch: Licht_ArbeitszimmerC “Lampe Arbeitszimmer” [ ga="<2/0/2" ]
} ‘’’
My Problem: what to write into address="…
Next
rUebung.items
Switch Licht_Arbeitszimmer “Lampe Arbeitszimmer” <light> (gF_Licht,gR_AZ) { channel=“knx:device:bridge:generic:Licht_ArbeitszimmerC” }

and sitemap
sitemap rUebung label=“Uebung KNX” {
Frame label=“Items” {
Switch item=Licht_Arbeitszimmer
}
}

It does not work.
When I start openhab and take BasicUI there is on the left side of the rUebung-Sitemap (to choose) a grey exclamation mark. Maybe that is a hint that there is something not OK


(Udo Hartmann) #20

As you used knx1: what’s your last working knx.cfg?

Please be aware, that each thing must be named unique, you named every thing beneath the bridge as “generic”.
Every channel name has to be unique, but only within the thing. This configuration is correct:

Bridge knx:ip:bridge "My knx/IP Bridge" [  // 'bridge' is the actual name of the bridge
    type="TUNNEL",                         // set mode of IP connection
    ipAddress="192.168.178.20",            // IP of knx/IP Gateway
    localIp="192.168.178.58",              // IP address of openHAB
    autoReconnectPeriod=30                 // please don't set this to 1!
  ] {
    Thing device generic1_1_5 [
        address="1.1.5"
     ] {
        Type switch : ch1 "Licht Wohnzimmer"        [ ga="2/0/0" ]
        Type switch : ch2 "Lampe Arbeitszimmer"     [ ga="<2/0/2" ]
        Type switch : ch3 "Steckdose TV Wohnzimmer" [ ga="3/0/0" ]
     }

    Thing device generic1_1_19 [
        address="1.1.19"
     ] {
        Type switch : ch1 "Steckdose Lampe Ecktisch" [ ga="3/0/11+<3/1/11" ]
        Type switch : ch2 "Steckdose Ecktisch"       [ ga="3/0/10+<3/1/11" ]
     }
}

while this is not:

Bridge knx:ip:bridge "My knx/IP Bridge" [  // 'bridge' is the actual name of the bridge
    type="TUNNEL",                         // set mode of IP connection
    ipAddress="192.168.178.20",            // IP of knx/IP Gateway
    localIp="192.168.178.58",              // IP address of openHAB
    autoReconnectPeriod=30                 // please don't set this to 1
  ] {
    Thing device generic [
        address="1.1.5"
     ] {
        Type switch : Licht_WohnzimmerT     "Licht Wohnzimmer"        [ ga="2/0/0" ]
        Type switch : Licht_ArbeitszimmerT  "Lampe Arbeitszimmer"     [ ga="<2/0/2" ]
        Type switch : Steckdose_WohnzimmerT "Steckdose TV Wohnzimmer" [ ga="3/0/0" ]
     }

    Thing device generic [
        address="1.1.19"
     ] {
        Type switch : Steckdose_EcktischLampeT "Steckdose Lampe Ecktisch" [ ga="3/0/11+<3/1/11" ]
        Type switch : Steckdose_EcktischT      "Steckdose Ecktisch"       [ ga="3/0/10+<3/1/11" ]
     }
}

You have many typos and issues in your configuration, such as Keyword Switch in front of the channel name. Rollershutters have more than one GA! Rollershutters are of type rollershutter and not switch

Please do not set fetch=true or readInterval=3600 without knowing of the consequences.
Please use as few as possible parameters for the first try, so only type, ipAddress and localIp

Please, always use code fences. It’s possible to edit your postings, and there is a preview to see the posting before saving it.

If not using code fences (the correct way), your postings may be forged by discourse (the platform used for this forum), like doubled and single quotes:
‘test’

'test' vs. ‘test’ and
"test" vs. “test”

Every single char in configuration has to be correct, every single or double quote, upper and lower case, order of parameters.
Please use VSCode with openHAB plugin to get code correction. But to be honest, setting up VSCode correct to work with openHAB server and provide error highlightning, is not that easy…


(Bernd Langner) #21

Thank you very much Udo,
I have had in knx.cfg only:
type=“TUNNEL”, // set mode of IP connection
ipAddress=“192.168.178.20”, // IP of knx/IP Gateway
localIp=“192.168.178.58”

That is all.
For the rollershutters I have used only switches, because I do not need Stop.
I have used it only in a rule, where the rollersutters go up in the morning, and down in the evening.
This has always worked with a switch.
My Questions are: what is “address” in Thing device. Is it the physical address in the line like 1.1.6?

Second question in another discussion I find that I can use only one thing for the whole installation and define the switches within this one thing. Is that correct and can it recommended? And what would be the address in Thing device …?

I will change my configuration according to your good example tomorrow.
Thank you again.

Bernd


(Udo Hartmann) #22

Then the bridge given above should suffice.

There are two options in knx2: Either use the whole knx bus as one “virtual” device, so only define a generic thing, or use every single device as “real” devices and define one thing per device. It’s possible to mix these two options.

address is the individual address (or in german terms physikalische Adresse). You don’t need to set this parameter, and if defining one generic thing for the whole knx bus, in fact, there is no individual address at all.
On the other hand, if defining each device with its individual address, openHAB will show if each device is ONLINE, if pingDevice is set to a reasonable value.
Some additional information may be downloaded and displayed in Paper UI (serial number, ROM mask, manufacturer…) when setting fetch=true (it’s dependent on the device if this option is working correct).
If there is any GA set to be read ( < before GA), openHAB will request a read at startup. As soon as a device answers to the read request, the status is set. Some devices can’t be configured to send their status frequently or even when changing the status, these devices will only answer to read requests. So how to get these channels updated?
readInterval will force openHAB to send read requests to all GA set to be read at startup each <readInterval> seconds, not only at startup. But this option is to be used carefully, as it results in very increased data traffic at the knx bus.
As the absence of correct “automatic send option” is very rare and clearly dependent to the device, this parameter is a thing parameter. Even if using the “generic thing” model, the affected GA should be defined in a “special” generic thing which has the readInterval set. All other GA are set to another generic thing which has not set readInterval.

Even if using per-device-things, there may be some GA which don’t “belong” to a device (i.e. the device holds the status of the GA, think of a knx scene, think of date/time). These GA can be configured to a channel using a generic thing.

In question of the shutters: As knx does not mark the sub DPT within the bus data, a switch will also work, because UP/DOWN is a 1 bit message. But it’s a ugly hack, and there is no good reason to do it this way.

Type switch        : ch1 "Rollershutter UP/DOWN" [ ga="1/2/3" ]
Type rollershutter : ch2 "Rollershutter UP/DOWN" [ upDown="1/2/4" ]

These two channels will be used the same way, with a slight difference. ch1 will need ON/OFF as command while ch2 will need UP/DOWN as command. So you will have to use different item types:

Switch rollershutter1 <rollershutter> { channel="knx:device:bridge:generic:ch1" }
Rollershutter rollershutter2          { channel="knx:device:bridge:generic:ch2" }

While you have to set the switch item to use a non-default icon, the rollershutter item will use the correct icon automatically.

In a sitemap you would use a mapping to avoid getting a STOP button or a slided switch:

Switch item=rollershutter1 mappings=[ ON="DOWN" OFF="UP" ]
Switch item=rollershutter2 mappings=[ DOWN="DOWN" UP="UP" ]

in a rule you would use different commands:

rollershutter1.sendCommand(ON)  // rollershutter1 DOWN
rollershutter2.sendCommand(DOWN) 

At least in a rule you can see the advantage, as there is absolutely no need to write down a comment for the latter item, while the former item is not self explanatory.


(Bernd Langner) #23

Hello Udo,
that was very helpful, but it does not work. It seems that there is a problem with the communication with the bus or between things and items.
I have it simplified to one groupaddress
knx.things

    type="TUNNEL",                         // set mode of IP connection
    ipAddress="192.168.178.20",            // IP of knx/IP Gateway
    localIp="192.168.178.58",              // IP address of openHAB
    autoReconnectPeriod=30                 // please don't set this to 1!
  ] {
    Thing device generic1_1_5 [
        
     ] {
        Type switch : ch2 "Lampe Arbeitszimmer"     [ ga="<2/0/2" ]
     }
}```

rUebung.items
``
Switch Licht_Arbeitszimmer "Lampe Arbeitszimmer" <light>  { channel="knx:device:bridge:generic1_1_5:ch2" } ```

rUebung.sitemap
```sitemap rUebung label="Uebung KNX" {  
Frame label="Items" {
   Switch item=Licht_Arbeitszimmer 
 }  
      } '''

What is curious: If I go to openhab/Basic in Licht_Arbeitszimmer is shown a switch instead of a light as an icon, although I have defined in the items <light>. So maybe there is something wrong with the communication between the files things and items.
Calling Licht_Arbeitszimmer does not  work.

Kind Regards
Bernd

(Bernd Langner) #24

Thanks to Udo, thanks to DIM
I was so frustrated that I have make a total new installation of openhab.
And with your help now it (it seems) works!!!
(At least with the first 4 Items which I have installed)
I do not know why it did not work before - because I made the same according to your comments.

Happy Weekend
bernd


(Udo Hartmann) #25

Sometimes openHAB2 does not update its internal data the correct way.

In most cases, a restart of openHAB2 should suffice.

If you take a look at your posting, you may notice that the code ist not as nice as it should be.
Code fences are ``` (three backticks in a row, at german keyboard it’s <shift>+<`>, the key right to <ß>) before and after code, but code fences must (!!!) stay alone in its own line.
```
// Code goes here
```
will result in

// Code goes here

Of course above I did escape the code fences to force discourse to ignore them :wink:

Another hint: As a single backtick needs another key to be typed, but we need 6 backticks, just type the backtick 6 times, scroll back three times and insert two <return> to get code fences and space between them to paste the code.


(Bernd Langner) #26

Thank you Udo,
Now I have understood the backticks.(in a single Line)
Another thing which one learnt again from my frustration:
It is in many cases better to start a totally new system and do most of the work by paste and copy.
So you can see the project growing and you find errors quicker
So I think I have now a clean system.
… until the next KNX Binding …
Kind Regards
Bernd