Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial contribution of the KNX Basic binding #2323

Merged
merged 52 commits into from
Mar 15, 2018
Merged

Conversation

sjsf
Copy link

@sjsf sjsf commented Jun 1, 2017

As discussed in #2294, this is a PR which contains the factored-out part regarding "basic" KNX features.

It uses strongly typed channels, i.e. neither contains the generic magic, nor does any bus scanning or KNX project imports. These parts will be taken care of in separate PRs as their own dedicated bundles, extending this basic part.

There are some details which are still open (see below), but I hope we can address them quickly with your feedback.

Also-by: Kai Kreuzer kai@openhab.org
Also-by: Karel Goderis karel.goderis@me.com
Signed-off-by: Simon Kaufmann simon.kfm@googlemail.com

@sjsf
Copy link
Author

sjsf commented Jun 1, 2017

Some things to notice:

  • There are now "basic" thing types with a "KNXBasicThingHandler" in the core binding, which only supports the "feature" oriented channel types (i.e. not the "generic" one). Of course, I simply kept those that you defined for now.
  • Regarding the "circular update problem", I solved it in the "basic" handler in the following way:
    • The "READ" GAs (as reported by the channel configuration, not the KNX bus of course) only update the channels's states, but nothing is done for them in handleCommand()
    • The "WRITE" GAs (as reported by the channel configuration, not the KNX bus of course) will be used in handleCommand() only.
    • The handleUpdate() method pretty much does nothing for these types, as it is assumed that the main source is within the KNX bus.
  • As an example case for a scenario where the main source is openHAB (i.e. another device external to the KNX bus maintains the real state), I added a "wallbutton" channel type.
    • It works inverse to the statusswitch type: it "WRITES" to the statusGA but "READS" the switchGA
    • For these kind of devices I coined the term "slave". Like it or change it, I don't mind.
    • Consequently, for such "slave" devices, the KNXBasicThingHandler writes to the bus in handleUpdate(), but does nothing in handleCommand
    • If anything is received on the "READ" GAs, it will post a corresponding command to the channel
    • Therefore, this is how it works when having an item liked to the knx:wallbutton and otherbinding:lamp:
      • I switch on the lamp within openHAB (e.g. basic UI):
        1. knx and the otherbinding recieve the command
        • knx binding ignores it
        • otherbinding uses it to send a new value to its lamp
        1. otherbinding gets the new value from the device and updates the channel's state
        2. the value of the linked item gets updated by the framework
        3. the knx binding gets a handleUpdate() call with the new value
        4. the knx binding writes the new value to the knx bus
        5. the wallbutton lights up
      • I tap the knx wall button
        1. knx binding receives the message on the switchGA
        2. it posts a Command to the channel on the event bus
        3. the ThingManager forwards this command to otherbinding
        4. otherbinding uses it to send a new value to its lamp
        5. otherbinding gets the new value from the device and updates the channel's state
        6. knx binding writes to the statusGA the new value
      • Switch on the lamp via another app which communicates with the lamp directly
        1. I switch on the lamp, openHAB and KNX is completely unaware of this yet
        2. otherbinding gets the new value from the device and updates the channel's state
        3. the value of the linked item gets updated by the framework
        4. the knx binding gets a handleUpdate() call with the new value
        5. the knx binding writes the new value to the knx bus
        6. the wallbutton lights up
  • Having the "auto-update" feature enabled (as it is now) massively improves the reaction speed of all "UIs" (including the KNX wall button, of course. It also doesn't produce cycles, but can lead to duplicate messages to the bus (first the "auto" update, second the "real" update coming from the other binding). But that's expected and is actually the case with every binding. So it does not hurt to leave it enabled (and helps in cases where the actor does not respond with a status GA).
  • Same applies for "non-slave" types, of course. But as the bus is quick, it is less noticeable.
  • As so far it looks like the "slave" use-cases are the complete inverse of the ordinary ones, maybe it rather makes sense to give the existing channel-types a boolean "slave" configuration option, which simply inverses READ & WRITE GAs. But I haven't thought this through completely. Maybe only for more "generic" ones like "string", "number", "boolean" - if we want to keep them at all. They actually break with the usual paradigm of fine-grained channel-types which we have in bindings. Actually the guidance would be to create many more channel types than what we currently have.
  • Once the channel types are final, I will update the README.md (which currently is outdated a little!)

@kaikreuzer kaikreuzer added the new binding If someone has started to work on a binding. For a new binding PR. label Jun 1, 2017
@kgoderis
Copy link
Contributor

kgoderis commented Jun 1, 2017

@SJKA The only main feedback I have so far is that I think we should generalise the Read/Write concept and make that configurable per Group Address by using flags, and to make the DPT also configurable. If these two elements are not configured then we can revert to standard values. Also, I would copy the R/W meaning from the KNX bus and thus step away from the connotation we have given to it, which is in fact copied from the KNX 1.0 binding. In doing so we can simplify even more the Basic handler, and have "richer" extensions afterwards, for example such as virtual KNX devices residing in the runtime that are participating on the bus as if they were real actors. This generalisation will also allow for a better re-use of the knxproj parsing code (which I would really like to re-use as I have spent a lot of hours on that)

I will give this a go and propose a commit to your repo

@kgoderis
Copy link
Contributor

kgoderis commented Jun 4, 2017

@SJKA Simon, I have created sjsf#1

As it was, your initial PR did not resolve the issue of "circular" updates that are "inter"-binding, e.g. when no other binding like Hue is involved, but only KNX channels. In the above PR to your repo this is solved by generalising the configuration of the Group Addresses that make up a Channel Configuration (see the src code for doc), and by doing away with handleUpdate() altogether (which is perfectly possible, since all relevant Types are both implementing the Command and State interfaces)

@sjsf
Copy link
Author

sjsf commented Jun 4, 2017

your initial PR did not resolve the issue of "circular" updates that are "inter"-binding, e.g. when no other binding like Hue is involved, but only KNX channels

Could you please sketch up a concrete example here? I would really like to understand what use-cases you have in mind.

@kgoderis
Copy link
Contributor

kgoderis commented Jun 5, 2017

Could you please sketch up a concrete example here? I would really like to understand what use-cases you have in mind.

Sure. Just consider the simple example of a Channel defined like

Type statusswitch : someSwitch [ switchGA="2/2/155", statusGA="2/2/156"]

  1. Send the ON command to the linked Item
  2. handleCommand() is called, and a Telegram is sent to 2/2/155
  3. the Item is updated to ON
  4. handleUpdate() is called, and a second Telegram is sent to 2/2/155
  5. The actor responds with a status on 2/2/156
  6. handleUpdate() is called, and the Item is updated to ON

The second major use case is when a user couples together generic/"primitive" channels through an Item, for example, because there is no advanced channel like rollershutter available. Imagine that you couple together 2 separate "switch" channels, one using GA 2/2/155 and the other 2/2/156, then in the flow here above you end up with an endless loop. This use case can not be solved with the current architecture, and requires one of the solutions sketched before (auto-bridge binding,....)

Some comments ago you mentioned that the KNX binding was the only binding implementing handleUpdate(), so I sought after a solution that could do away with handleUpdate(), so that the binding would behave like any other binding on the runtime. That was very easy in fact, since almost all Types are both Command and State, so, everything can be handled with just handleCommand(). I presume that this is the same reason why no-one else ever bothered implementing handleUpdate() in bindings.

In the example above, you then get :

  1. Send the ON command to the linked Item
  2. handleCommand() is called, and a Telegram is sent to 2/2/155
  3. the Item is updated to ON
  4. The actor responds with a status on 2/2/156
  5. handleUpdate() is called, and the Item is updated to ON

@kgoderis
Copy link
Contributor

kgoderis commented Jun 5, 2017

@SJKA Below is a bit of logging of how thing flow for a simple statusswitch (See example above)

2017-06-05 13:04:34.986 [DEBUG] [.c.thing.internal.ThingManager:360  ] - Delegating command 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch'
2017-06-05 13:04:34.986 [TRACE] [k.handler.KNXBasicThingHandler:308  ] - Handling a Command 'ON' for channel knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch
2017-06-05 13:04:34.986 [TRACE] [k.handler.KNXBasicThingHandler:335  ] - Sending to channel DiningRoomOutlet5Switch Switch : ON -> ON
2017-06-05 13:04:34.987 [INFO ] [tuwien.auto.calimero          :51   ] - calimero.link.192.168.0.10:3671: send message to 2/2/155, wait for confirmation
2017-06-05 13:04:35.009 [DEBUG] [.k.h.KNXBridgeBaseThingHandler:489  ] - Wrote value 'on' (mapped from 'ON') to datapoint 'command DP 2/2/155 'knx:ip:ip1', DPT main 0 id 1.001, low priority' (0. attempt).
2017-06-05 13:04:35.009 [INFO ] [arthome.event.ItemCommandEvent:43   ] - Item 'DiningRoomOutlet5Switch' received command ON
2017-06-05 13:04:35.010 [DEBUG] [.c.thing.internal.ThingManager:410  ] - Delegating update 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch'
2017-06-05 13:04:35.010 [INFO ] [smarthome.event.ItemStateEvent:43   ] - DiningRoomOutlet5Switch updated to ON
2017-06-05 13:04:35.011 [INFO ] [s.event.ItemStateChangedEvent :43   ] - DiningRoomOutlet5Switch changed from OFF to ON
2017-06-05 13:04:35.153 [TRACE] [.k.h.KNXBridgeBaseThingHandler:448  ] - Received a Group Write Request telegram from '1.1.101' for destination '2/2/156'
2017-06-05 13:04:35.154 [TRACE] [k.handler.KNXBasicThingHandler:401  ] - Thing knx:basic:ip1:SomeActor received a Group Write Request telegram from '1.1.101' for destination '2/2/156'
2017-06-05 13:04:35.154 [TRACE] [k.handler.KNXBasicThingHandler:408  ] - Thing knx:basic:ip1:SomeActor processes a Group Write Request telegram for destination '2/2/156' for channel 'knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch'
2017-06-05 13:04:35.156 [INFO ] [arthome.event.ItemCommandEvent:43   ] - Item 'DiningRoomOutlet5Switch' received command ON
2017-06-05 13:04:35.157 [DEBUG] [.c.thing.internal.ThingManager:410  ] - Delegating update 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch'
2017-06-05 13:04:35.157 [INFO ] [smarthome.event.ItemStateEvent:43   ] - DiningRoomOutlet5Switch updated to ON

@kgoderis
Copy link
Contributor

kgoderis commented Jun 5, 2017

@SJKA To illustrate the "looping problem", consider the following example:

Thing basic SomeActor {
	Channels:
		Type statusswitch : DiningRoomOutlet5Switch [ switchGA="2/2/155", statusGA="2/2/156"]
		Type wallbutton : someWallButton [switchGA="9/5/100", statusGA="9/5/101"] 
}

9/5/100 and /101 are non-existing on my KNX bus, it is just for illustration purposes

Switch DiningRoomOutlet5Switch "Dining Room - Outlet 5 - Switch" <switch> { channel="knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch",channel="knx:basic:ip1:SomeActor:someWallButton" } 

Here 2 KNX channels are bound to the same item. This is what can be observed when toggling the Item to ON:

2017-06-05 13:14:08.372 [INFO ] [arthome.event.ItemCommandEvent:43   ] - Item 'DiningRoomOutlet5Switch' received command ON
2017-06-05 13:14:08.373 [DEBUG] [.c.thing.internal.ThingManager:360  ] - Delegating command 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch'
2017-06-05 13:14:08.373 [TRACE] [k.handler.KNXBasicThingHandler:308  ] - Handling a Command 'ON' for channel knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch
2017-06-05 13:14:08.373 [TRACE] [k.handler.KNXBasicThingHandler:335  ] - Sending to channel DiningRoomOutlet5Switch Switch : ON -> ON
2017-06-05 13:14:08.374 [INFO ] [tuwien.auto.calimero          :51   ] - calimero.link.192.168.0.10:3671: send message to 2/2/155, wait for confirmation
2017-06-05 13:14:08.396 [DEBUG] [.k.h.KNXBridgeBaseThingHandler:489  ] - Wrote value 'on' (mapped from 'ON') to datapoint 'command DP 2/2/155 'knx:ip:ip1', DPT main 0 id 1.001, low priority' (0. attempt).
2017-06-05 13:14:08.397 [DEBUG] [.c.thing.internal.ThingManager:360  ] - Delegating command 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:someWallButton'
2017-06-05 13:14:08.397 [TRACE] [k.handler.KNXBasicThingHandler:308  ] - Handling a Command 'ON' for channel knx:basic:ip1:SomeActor:someWallButton
2017-06-05 13:14:08.398 [TRACE] [k.handler.KNXBasicThingHandler:335  ] - Sending to channel someWallButton Switch : ON -> ON
2017-06-05 13:14:08.398 [INFO ] [tuwien.auto.calimero          :51   ] - calimero.link.192.168.0.10:3671: send message to 9/5/101, wait for confirmation
2017-06-05 13:14:08.420 [DEBUG] [.k.h.KNXBridgeBaseThingHandler:489  ] - Wrote value 'on' (mapped from 'ON') to datapoint 'command DP 9/5/101 'knx:ip:ip1', DPT main 0 id 1.001, low priority' (0. attempt).
2017-06-05 13:14:08.421 [INFO ] [smarthome.event.ItemStateEvent:43   ] - DiningRoomOutlet5Switch updated to ON
2017-06-05 13:14:08.422 [DEBUG] [.c.thing.internal.ThingManager:410  ] - Delegating update 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch'
2017-06-05 13:14:08.422 [DEBUG] [.c.thing.internal.ThingManager:410  ] - Delegating update 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:someWallButton'
2017-06-05 13:14:08.423 [INFO ] [s.event.ItemStateChangedEvent :43   ] - DiningRoomOutlet5Switch changed from OFF to ON
2017-06-05 13:14:08.562 [TRACE] [.k.h.KNXBridgeBaseThingHandler:448  ] - Received a Group Write Request telegram from '1.1.101' for destination '2/2/156'
2017-06-05 13:14:08.563 [TRACE] [k.handler.KNXBasicThingHandler:401  ] - Thing knx:basic:ip1:SomeActor received a Group Write Request telegram from '1.1.101' for destination '2/2/156'
2017-06-05 13:14:08.564 [TRACE] [k.handler.KNXBasicThingHandler:408  ] - Thing knx:basic:ip1:SomeActor processes a Group Write Request telegram for destination '2/2/156' for channel 'knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch'
2017-06-05 13:14:08.564 [TRACE] [k.handler.KNXBasicThingHandler:408  ] - Thing knx:basic:ip1:SomeActor processes a Group Write Request telegram for destination '2/2/156' for channel 'knx:basic:ip1:SomeActor:someWallButton'
2017-06-05 13:14:08.565 [INFO ] [arthome.event.ItemCommandEvent:43   ] - Item 'DiningRoomOutlet5Switch' received command ON
2017-06-05 13:14:08.565 [DEBUG] [.c.thing.internal.ThingManager:360  ] - Delegating command 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:someWallButton'
2017-06-05 13:14:08.565 [TRACE] [k.handler.KNXBasicThingHandler:308  ] - Handling a Command 'ON' for channel knx:basic:ip1:SomeActor:someWallButton
2017-06-05 13:14:08.565 [TRACE] [k.handler.KNXBasicThingHandler:335  ] - Sending to channel someWallButton Switch : ON -> ON
2017-06-05 13:14:08.566 [INFO ] [tuwien.auto.calimero          :51   ] - calimero.link.192.168.0.10:3671: send message to 9/5/101, wait for confirmation
2017-06-05 13:14:08.602 [DEBUG] [.k.h.KNXBridgeBaseThingHandler:489  ] - Wrote value 'on' (mapped from 'ON') to datapoint 'command DP 9/5/101 'knx:ip:ip1', DPT main 0 id 1.001, low priority' (0. attempt).
2017-06-05 13:14:08.603 [INFO ] [arthome.event.ItemCommandEvent:43   ] - Item 'DiningRoomOutlet5Switch' received command ON
2017-06-05 13:14:08.604 [DEBUG] [.c.thing.internal.ThingManager:360  ] - Delegating command 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch'
2017-06-05 13:14:08.604 [TRACE] [k.handler.KNXBasicThingHandler:308  ] - Handling a Command 'ON' for channel knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch
2017-06-05 13:14:08.605 [TRACE] [k.handler.KNXBasicThingHandler:335  ] - Sending to channel DiningRoomOutlet5Switch Switch : ON -> ON
2017-06-05 13:14:08.606 [INFO ] [tuwien.auto.calimero          :51   ] - calimero.link.192.168.0.10:3671: send message to 2/2/155, wait for confirmation
2017-06-05 13:14:08.627 [DEBUG] [.k.h.KNXBridgeBaseThingHandler:489  ] - Wrote value 'on' (mapped from 'ON') to datapoint 'command DP 2/2/155 'knx:ip:ip1', DPT main 0 id 1.001, low priority' (0. attempt).
2017-06-05 13:14:08.629 [INFO ] [smarthome.event.ItemStateEvent:43   ] - DiningRoomOutlet5Switch updated to ON
2017-06-05 13:14:08.630 [DEBUG] [.c.thing.internal.ThingManager:410  ] - Delegating update 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch'
2017-06-05 13:14:08.630 [DEBUG] [.c.thing.internal.ThingManager:410  ] - Delegating update 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:someWallButton'
2017-06-05 13:14:08.631 [INFO ] [smarthome.event.ItemStateEvent:43   ] - DiningRoomOutlet5Switch updated to ON
2017-06-05 13:14:08.631 [DEBUG] [.c.thing.internal.ThingManager:410  ] - Delegating update 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:DiningRoomOutlet5Switch'
2017-06-05 13:14:08.631 [DEBUG] [.c.thing.internal.ThingManager:410  ] - Delegating update 'ON' for item 'DiningRoomOutlet5Switch' to handler for channel 'knx:basic:ip1:SomeActor:someWallButton'

Because handleUpdate() is gone, the loop is not endless anymore, but it still loops 1 time (which needs to be fixed)

@kgoderis
Copy link
Contributor

kgoderis commented Jun 5, 2017

@SJKA I updated the commit to your repo with a possible solution for the "loop problem". It brings back handleUpdate() with a twist so that your use case (HUE lamp, wall button) is supported

knxScheduler.schedule(new ReadRunnable(groupAddress, dpt), 0, TimeUnit.SECONDS);
}

if (recurring && readInterval != null) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the truthiness of recurring implies readInterval != null.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well spotted! I just put it there in order to shut up the IDE, as Eclipse seems to be not a believer of boolean logic.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, eclipse is ignorant to the concept of truthiness ;-)

@sjsf
Copy link
Author

sjsf commented Jun 6, 2017

I think we should generalise the Read/Write concept and make that configurable per Group Address by using flags,

No! Not on in basic handler. Let's do this in the generic one - this is what we have it for.

and to make the DPT also configurable.

I agree here, dpt configuration is yet missing. However, I wouldn't want to squeeze this into specially formatted strings, but would spend separated config parameters for it.

Also, I would copy the R/W meaning from the KNX bus and thus step away from the connotation we have given to it, which is in fact copied from the KNX 1.0 binding.

In doing so we can simplify even more the Basic handler, and have "richer" extensions afterwards for example such as virtual KNX devices residing in the runtime that are participating on the bus as if they were real actors. This generalisation will also allow for a better re-use of the knxproj parsing code (which I would really like to re-use as I have spent a lot of hours on that)

No, again - the knxproj parsing (as well as the automatic discovery) should be based on the generic thing handler, not on the basic one.

@kgoderis
Copy link
Contributor

kgoderis commented Jun 6, 2017

@SJKA Do I read you well that we then will have (at least) 3 different bundles:

  • Basic
  • Generic (which then will be more or less the Basic + the commit I just created)
  • Extended

@sjsf
Copy link
Author

sjsf commented Jun 6, 2017

@kgoderis regarding your examples:

In the first one, the following assumption is wrong:

  1. handleUpdate() is called, and a second Telegram is sent to 2/2/155

A statusswitch does nothing in handleUpdate() -> no cycle

Imagine that you couple together 2 separate "switch" channels, one using GA 2/2/155 and the other 2/2/156, then in the flow here above you end up with an endless loop. This use case can not be solved with the current architecture, and requires one of the solutions sketched before (auto-bridge binding,....)

Correct - this would require a new ChannelType in the basic ThingHandler. I would leave it to the generic ThingHandler to cover such scenarios.

Some comments ago you mentioned that the KNX binding was the only binding implementing handleUpdate(), so I sought after a solution that could do away with handleUpdate(), so that the binding would behave like any other binding on the runtime. That was very easy in fact, since almost all Types are both Command and State, so, everything can be handled with just handleCommand(). I presume that this is the same reason why no-one else ever bothered implementing handleUpdate() in bindings.

Not quite. You have to keep in mind the different meanings of commands and state update events. The commands are an intention to change something in reality (e.g. make the light brighter). The state update events only notify that an item (which reflects the reality) changed its value (e.g. the light was dimmed, therefore the item now got an update to a lower value). It usually is not meant for a binding to again change the real world because of that.

So I did not want to imply that it is generally wrong to implement handleUpdate(). I just wanted to point out that it is not common practice to enable a binding to "follow" another Thing, just because both their channels are bound to the very same item. Usually, if there are two things which both carry their own state, rules are used to "connect" them to each other.

There are some exceptions to this, which are not due to the KNX protocol, but rather because some types of devices are pretty common in the KNX world which are not in other environments, like e.g. a wall-button which has a LED reflecting the current state (very bad idea on battery powered devices, easy on KNX).

However, I could imagine some other scenarios where it would make sense to "follow" another device, e.g. a thermostat following another "smart" thermostat like NEST. There it would also be feasible to take the shortcut and make one be the "slave" of another, without the need to write a rule for it. Therefore I could imagine that a more generic solution like the profiles as anticipated in #2226 could be used in order to make item-channel-links as slaves and handle some of the magic in
framework and not make every binding do that.

@sjsf
Copy link
Author

sjsf commented Jun 6, 2017

Do I read you well that we then will have (at least) 3 different bundles:

  • Basic
  • Generic (which then will be more or less the Basic + the commit I just created)
  • Extended

Maybe...

For sure we need another ThingHandler, which can handle "generic" channels and does all the guessing magic.

And then there is the project parsing and bus scanning stuff, which would create instances of such a generic thing and therefore relies on them.

I don't mind if these parts end up in one bundle or in two. That actually depends on how entangled they are and if one makes sense without the other.

@kgoderis
Copy link
Contributor

kgoderis commented Jun 6, 2017

For sure we need another ThingHandler, which can handle "generic" channels and does all the guessing magic.

And then there is the project parsing and bus scanning stuff, which would create instances of such a generic thing and therefore relies on them.

I don't mind if these parts end up in one bundle or in two. That actually depends on how entangled they are and if one makes sense without the other.

I think that anything more than 2 bundles is overkill and will confuse people. Via the commit proposed the basic Thing can still be basic without a lot of configuration information present, falling back to logical default values. I would not put the DPT in separate channel configuration elements because the number of configuration elements is variable with each Channel Type. Maybe you can go through the commit to better structure our discussion here?

@sjsf
Copy link
Author

sjsf commented Jun 6, 2017

I think that anything more than 2 bundles is overkill and will confuse people.

Of course it has to make sense somehow - architecturally and from the user's point of view. Still, if in the end we think it makes sense, we can do so. As you might have seen I currently only factored out one additional bundle, which contains both the generic handler and the project parsing.

I would not put the DPT in separate channel configuration elements because the number of configuration elements is variable with each Channel Type.

Yes, they actually have to be even more variable than what they are currently, as we will also have to support multiple GAs for one configuration parameter (e.g. for actors not announcing a dedicated status GA but reacting on several GAs). Still, I would assume that the multiples will all be of the same type, as it also was in the OH1 binding because KNX requires it. So with statusGA and switchGA we would also have optional statusDPT and switchDPT config parameters, each only allowing a single value.

Maybe you can go through the commit to better structure our discussion here?

Sure, I will. However, general discussions are better suited here.

@kgoderis
Copy link
Contributor

kgoderis commented Jun 6, 2017

In the first one, the following assumption is wrong:

handleUpdate() is called, and a second Telegram is sent to 2/2/155
A statusswitch does nothing in handleUpdate() -> no cycle

Ok, it does nothing indeed in what you provided in the PR, but on a general note, handleCommand() are followed by the handleUpdate() afterwards, and if we need to solve this bit for basic, and/or generic and/or extended handlers, we better fix it once.

[Btw, after that post I made changes to the commit, so some comments are not 100% in line anymore]

Imagine that you couple together 2 separate "switch" channels, one using GA 2/2/155 and the other 2/2/156, then in the flow here above you end up with an endless loop. This use case can not be solved with the current architecture, and requires one of the solutions sketched before (auto-bridge binding,....)
Correct - this would require a new ChannelType in the basic ThingHandler. I would leave it to the generic ThingHandler to cover such scenarios.

Ah... I do not agree here unfortunately. I have had different variations of the KNX binding running over the last 2 year, with and without all the ad hoc solutions likes the auto-bridging and all that. The basic version as you propose it will be fine until the first person comes across a use case where it doesn't work anymore. IMHO we need to have firm plumbing that works for basic and extended scenarios

Some comments ago you mentioned that the KNX binding was the only binding implementing handleUpdate(), so I sought after a solution that could do away with handleUpdate(), so that the binding would behave like any other binding on the runtime. That was very easy in fact, since almost all Types are both Command and State, so, everything can be handled with just handleCommand(). I presume that this is the same reason why no-one else ever bothered implementing handleUpdate() in bindings.
Not quite. You have to keep in mind the different meanings of commands and state update events. The commands are an intention to change something in reality (e.g. make the light brighter). The state update events only notify that an item (which reflects the reality) changed its value (e.g. the light was dimmed, therefore the item now got an update to a lower value). It usually is not meant for a binding to again change the real world because of that.

That part of the post is superseded by the altered commit, so I take that back. (I agree on what you say however, but it feels to me that this different meaning of command and states have been used/abused in the very same way in the past for other bindings)

However, I could imagine some other scenarios where it would make sense to "follow" another device, e.g. a thermostat following another "smart" thermostat like NEST. There it would also be feasible to take the shortcut and make one be the "slave" of another, without the need to write a rule for it. Therefore I could imagine that a more generic solution like the profiles as anticipated in #2226 could be used in order to make item-channel-links as slaves and handle some of the magic in
framework and not make every binding do that.

I think we have no time to wait for that, frankly. The KNX binding has been in limbo for 2 years without a clear direction. It is time to come conclusions, at least that is my personal opinion.

On the slave concept: with the commit proposed there is no need for such a new concept anymore. just my 2 cents.

@kgoderis
Copy link
Contributor

kgoderis commented Jun 6, 2017

Yes, they actually have to be even more variable than what they are currently, as we will also have to support multiple GAs for one configuration parameter (e.g. for actors not announcing a dedicated status GA but reacting on several GAs). Still, I would assume that the multiples will all be of the same type, as it also was in the OH1 binding because KNX requires it. So with statusGA and switchGA we would also have optional statusDPT and switchDPT config parameters, each only allowing a single value.

That sounds very much as if you want to replicate KNX actors in software. I thought we left that route

@kgoderis
Copy link
Contributor

[Mental Note] We could imagine something similar to http://www.gira.com/en/gebaeudetechnik/systeme/knx-eib_system/knx-produkte/systemgeraete/logikmodul/logikbausteine.html into the "KNX Advanced" binding

@htreu
Copy link

htreu commented Jun 14, 2017

@kgoderis Isn´t this what rule templates are all about? To provide logic templates which can be "filled in" by items and conditions?

@kgoderis
Copy link
Contributor

@htreu yes Indeed, but for some of the Gira logic functions we would have to code some Actions in the KNX binding. E.g. some of these involve sending a "crafted" Telegram on the KNX bus. It is to be investigated once we get the basics right.

}

try {
if (!useNAT) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SJKA NPE if MODE_ROUTER is set. Either have to move line #70 or initialise at line #54

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a good reason to make it a boolean primitive?

Copy link
Member

@martinvw martinvw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a very quick and global review, please take a look at the things I mentioned.


<config-description>
<parameter name="address" type="text">
<label>Address</label>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout looks broken (most likely a combination of tabs and spaces), please format using eclipse

<required>true</required>
<default>0</default>
</parameter>
<parameter name="enableDiscovery" type="boolean">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misaligned please reformat

Service-Component: OSGI-INF/*.xml
Export-Package: org.openhab.binding.knx,
org.openhab.binding.knx.handler,
tuwien.auto.calimero,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these exports expected, is this both a binding and bundle to provide others things?


The IP Gateway is the most commonly used way to connect to the KNX bus. At its base, the *ip* bridge accepts the following configuration parameters:

|Name|Required|Description|Default value|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would make me happy by formatting the tables in the MD file as well :-D

http://www.tablesgenerator.com/markdown_tables

Select 'File' > 'Past table data ...' and past the unformatted mark down table, you can then copy paste the formatted table 👍

<p><em>
<strong>Calimero 2 - A library for KNX network access</strong> <br/><br/>
Calimero 2 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the clean way would be switching to EPL 2.0 and add GPL 2.0 as a secondary license to this binding. But I'm not that much into the details yet.

@kaikreuzer any advice from your side?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to put any code under GPL. Long time ago, I went through a tedious discussion to have the Calimero team to move the code from GPL to GPL w/ classpath exception, see https://github.com/openhab/openhab2-addons/pull/2323/files#diff-bff3d9a909c2a99471fde09efef41e45R54.
As long as we merely include the calimero binary as is, we can happily distribute the KNX binding under EPL.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh..., I never read that far in license texts 😉
Thanks for the clarification!

}

return null;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is almost 200 lines, there is no valid reason for such a big method


import org.slf4j.LoggerFactory;

public class KNXThreadPoolFactory {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing class level docblock

*/
public class DeviceConstants {

private DeviceConstants() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
return null;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline

@@ -41,6 +41,7 @@
<module>org.openhab.binding.globalcache</module>
<module>org.openhab.binding.ipp</module>
<module>org.openhab.binding.keba</module>
<module>org.openhab.binding.knx</module>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To have the binding being picked up by the distro, you furthermore need to add it to the feature.xml, again at the alphabetically correct position. If you have a dependency on some transport bundle (e.g. upnp, mdns or serial), make sure to add a line for this dependency as well (see the other bindings as an example).

@Adminius
Copy link

hey,
any news? i'm waiting for new binding because of troubles with double telegramms..

@dka23
Copy link

dka23 commented Aug 22, 2017

Do I understand correctly, that the next step would be to include the results of the review by @martinvw into the PR?

@SJKA Do you have any plans to do so?

@sjsf
Copy link
Author

sjsf commented Aug 22, 2017

Yes, it's on my stack! There are some changes required in the framework in order to prevent the infinite loops of state updates properly. I'm working on those right now. And then, of course, I will incorporate all the feedback immediately in order to push this PR forward. I'm desperately waiting for it myself 😄

@NovaXyl
Copy link

NovaXyl commented Sep 11, 2017

Any news? The double telegram problem is a total blocker for me as those telegrams interfere with my infrared switches causing to switch the light off immediately after them turning it on.

@nibblerrick
Copy link

Maybe it would help if this behaviour (one thing for all up to one thing for one channel/item) is more explicit described in the documentation, at least to me this was confusing and I was at the beginning really not shure what's the right way until I noticed both ways (or something in between) is possible.
I thought it has some technical impact which way it's done but it is only a structural thing in this case.
Just my thoughts...

@sjsf
Copy link
Author

sjsf commented Mar 19, 2018

Yes, of course! The current wording "They have no specific function" indeed is not very elaborate. Would you like giving it a shot here?

@ArdescoConsulting
Copy link

New day, updated instruction.
OpenHAB KNX 2 Binding IP Tutorial 0.3.docx

  • Corrected: id's need to be unique indeed
  • New: started with the configuration in Paper UI and then the config files. I think this makes it a little bit easier for beginners.
  • Improved: clearer recommendations if more there are more possiblities (e.g. router/tunnel, one/multiple things) @nibblerrick Could you tell me if it's better formulated for you now.

Please keep in mind that I have exactly 10 days of experience with OpenHAB so I'm learning along the way and I really appreciate the feed back.

@ArdescoConsulting
Copy link

When I define an item the same way (or so I think) in Paper UI and .items config, they are shown differently in paper UI Control: the [%s] is not replaced by the value.

.items config
Switch Item_Light_Switch "Light Switch [%s]"
{channel="knx:device:bridge:thing_knx_device:Channel_Light_Switch"}

Paper UI
image
Control config item
image

Control Paper UI item
image

@nibblerrick
Copy link

Hi,
@ArdescoConsulting in your document it is now more clear.
@SJKA as I am not very used to forking and pullrequests (really understanding git is sth. to do when I have time(tm)) and it's a minor change we can just discuss it here, right?
I would add something like @ArdescoConsulting has in his document now, so a sentence like "It is possible to use one thing for all channels, one thing per channel or anything in between(, technically it doesn't make any difference)." would be good. The "technically it doesn't make any difference"-part I have in brackets because I am not shure if that would be completely correct as the device-thing has the fetch, pingIntervall and readIntervall-options so if someone wants it would be possible to have channels which will be polled and channels which will not, if I take it right?

@ArdescoConsulting
Copy link

@nibblerrick @SJKA
Let me explain how I understand the knx device thing for the moment and why I and other people seem to struggle with the concept.
The thing has 4 parameters that impact
1. An optional KNX device
Address
Links 1 KNX device to the thing (required for pingInterval, fetch parameters) .
If not specified thing status is always online.
pingInterval
How often the knx device is pinged (i.e. is the knx device “alive”) to set the thing status to online/offline.
Ping is done every pingInterval seconds. 0 means only ping at start-up of the thing.
fetch
Read out the device parameters and address/communication object tables. I’m not sure what this could be used for. Maybe someone can point me in the right direction

The item can only be linked to 1 knx device while there are usually more than one knx devices participating in a channel. I.e. push button and actuator for a light switch. So which of these two devices needs to be polled to show the thing as online or offline. The best is to go for the actuator since it contains the state and does the actual switch of the light. If the pushbutton is down, ather device can still send the telegram switch on.
What if you have 2 push buttons for one light and one is down and the other not.
What if your device has more than one channel i.e. lights and shutter. Should the status of the item be determined by the switch actuator or the shutter actuator? In this case it’s better a representative knx device for all channels. If this this can be pinged, all can be pinged. E.g. the knx/ip interface of router.
Maybe this is not required since the IP Gateway device already shows the status. For current usage (no fetch), pinging would not be required so the ping issue becomes less important.

2. All the readable group addresses (i.e. <) in all channels it contains
readInterval
actively request reading readable group addresses (i.e. <) knx bus to synchronize the OpenHAB state to the KNX state
Only once at start-up of the thing with readInterval =0 to initialize the OpenHAB state and further synchronized incrementally by the received telegrams or every readInterval seconds to reinitialize if incremental updates should be lost.

Looking at the knx 1 binding, each GA had an individual autorefresh to reread the GA every seconds
knx="[<[(<autoRefresh>)]][<dptId>:]<mainGA>[[+[<[(<autoRefresh>)]]<listeningGA>]+[<[(<autoRefresh>)]]<listeningGA>..], [<[(<autoRefresh>)]][<dptId>:]<mainGA>[[+[<[(<autoRefresh>)]]<listeningGA>]+[<[(<autoRefresh>)]]<listeningGA>..]"
Maybe not all readable GA’s need the same refresh interval. Now you can only achieve this by grouping channels in separate things.
Maybe readInterval could be the default for all channels and individual address could be overrule with autoRefresh so the splitting is not required.
Maybe readInterval could be move down to the channels with new wrapper around all channels that have the same refresh interval.

Could it be that there are 2 separate use cases for the item

  1. Grouping channels with the same readInterval (with maybe the individual autorefresh overrule enhancement)
  2. Have individual knx devices that can be pinged and data fetched. Maybe for the future knx bus scan or knx file import knx individual device things a created and they can then fetch the device parameters and address/communication object tables?

If my assumptions are correct, "technically it doesn't make any difference" is correct if you just want to use the channels in the ui, rules,...
Hence I would recommend using 1 knx thing with just, if required, the readInterval to counteract missed incrental updates. If different readIntervals is are really required, then there could be more things.

Feel free to give feedback on this.

@udo1toni
Copy link
Contributor

udo1toni commented Mar 22, 2018

I do not recommend to use readInterval at all but only if this is the only way to get the state. There are some (old) devices which do not provide a regular send interval, so this might be a solution for these devices, but in a proper setup there should be no need for frequently read requests.

I have setup my 40 devices as individual devices, naming is like manufacturerTypeofdevice_a_b_c where a_b_c is the bus address a.b.c
This fits perfectly to my needs, as I see devices going offline and online.
I defined the channels in corresponding devices. Each real device channel has its own bunch of GA, and each channel can be controlled individual.
As of central GA I have set a virtual device without any hardware but only *-control channels. This ensures that I can't even accidentally request the state of a central GA (which could maybe result in an instant all ON or all OFF without meaning this - luckily I eliminated these missconfigurations long time ago)
Scene GA are virtual as well and so is datetime GA for HVAC.

So I have several Devices without any channel, but I don't bother as my tests worked great so far.

in question of fetch, take a look at one of the knx things in Paper UI. If fetch worked well, you should see a link Show properties right under the online sign. this will reveal additional informations about your hardware.

@lewie
Copy link

lewie commented Mar 23, 2018

@udo1toni, Your description I would classify as best practice!

In my Tests, the Show properties sometimes takes a while to be displayed.

@Astrakan27
Copy link

Just a quick question about the best approach to use the new KNX binding.
It's better to move the full Openhab to 2.3 snapshot or I can simply put the 2.3 KNX binging to /usr/share/openhab2/addons and keep the rest on stable 2.2?

Thanks for the clarification

@kaikreuzer
Copy link
Member

@Astrakan27 It only works on 2.3 snapshot.

@nibblerrick
Copy link

@ArdescoConsulting I think the main confusion is here with the (hardware)address you can specify and the GAs were normally more than one (hardware)address/devices. The configuration of @udo1toni seems to be a good way but my problem is one time I read the text and I think I'm getting it, next time I am confused. I don't think I understood it completely, maybe I have to play with the options in PaperUI a bit.
I think for documentation examples would be really good, so extactly what you (@ArdescoConsulting) are doing at the moment.

@oblaise
Copy link

oblaise commented Mar 28, 2018

Hello,

Maybe I'm missing a configuration something elsewhere in OH2 but I tried to follow the general guidelines for multi-channel configuration. My goal is to use OH2 to send current datetime to the KNX bus.
I created all KNX things as well as a NTP thing to get the time.
I created an item with the following:
DateTime CurrentDateTime { channel="ntp:ntp:local:dateTime",channel="knx:device:virtual:ch_CurrentDateTime" }.

I see the CurrentDateTime object changing every minute. But nothing is sent to the KNX bus.
I created other channels for other types of items and all are able to send correctly their value to the bus.

I'm running OH2 2.2 with the latest daily package from https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.knx/2.3.0-SNAPSHOT/org.openhab.binding.knx-2.3.0-SNAPSHOT.jar

Regards

@sjsf
Copy link
Author

sjsf commented Mar 28, 2018

@oblaise your item configuration looks okay.

What is the channel-type of ch_CurrentDateTime? It should be datetime-control in that case.

@udo1toni
Copy link
Contributor

And which DPT is ch_CurrentDateTime?

19.001 is default, but there are also 10.001 (Time and day of week) and 11.001 (Date)

@pdcemulator
Copy link

pdcemulator commented Mar 28, 2018

Hello,

how to use a ga with DPT 9.007 (humidity)?

In OH1 I used
Number Hum_rel "Luftfeuchte rel. [%.1f %%]" <humidity> (gHumidity) knx="5.001:<5/2/4"}

In OH2
Type number : Hum_rel [ ga="5.001:<5/2/4" ] Number Hum_rel "Luftfeuchte rel. [%.2f %%]" <humidity> (gHumidity,) {channel="knx:device:bridge:wg:Hum_rel"}

This also works with OH2 binding, but instead of 51% I get 0.51%.
Withour DPT or even 9.007 in channel config I get en error.

Edit: same issue, but reversed order for DPT 14.017
OH1 gives 9 g/m³
Number Hum_abs "Luftfeuchte abs. [%.1f g/m³]"<humidity> (gHumidity) {knx="14.001:5/2/104"}

OH2 gives 701 g/m³
Type number : Hum_abs "Humidity" [ ga="14.001<5/2/104" ] Number Hum_abs "Luftfeuchte abs. [%.1f g/m³]"<humidity> (gHumidity) {channel="knx:device:bridge:wg:Hum_abs}

With or without DPT give same values.

@sjsf
Copy link
Author

sjsf commented Mar 28, 2018

@pdcemulator valid point!
May I ask you to open a separate issue for this in this project? This PR is closed already and it's gonna get chaotic in here otherwise.

@MichaelFink
Copy link

Separate issue sounds like a good idea. :-)
@pdcemulator I had the same issue. Workaround is to user item type Dimmer. See here

@pdcemulator
Copy link

OK, I created #3408 and #3409. These are my first issues on github, so I hope I filled anything right :-)

@oblaise
Copy link

oblaise commented Mar 28, 2018

@SJKA In my test I used datetime. Just tried with datetime-control but without more success:
Type datetime-control : ch_CurrentDateTime [ ga="19.001:2/2/2"]
There is no datetime telegrams sent to the bus.

@udo1toni this was explictly defined as 19.001 but I tested also the two other DPT type without more success.

@FredericMa
Copy link

Hi all,
Short question and I think it fits here the best instead of creating a separate topic or issue.
I'm using the RGB DPT (232.600) with KNX1 for my LED controllers.
I see that this DPT still exists in the KNXCoreTypeMapper but I don't find it in the documentation.
This is the only point I want to check before going to KNX2.
Thanks!

@sjsf
Copy link
Author

sjsf commented Mar 29, 2018

@FredericMa Indeed, the binding currently does not have a "color" channel type. Therefore, please create a separate issue for it 😄

@FredericMa
Copy link

@SJKA Thanks for your reply. In that case a new issue is indeed the best option 😄
I've create issue #3411 for this.

@oblaise
Copy link

oblaise commented Mar 29, 2018

@SJKA So I continued my tests and observed (Sorry for not doing that before) that after OH2 restart it worked with datetime-control. If I'm putting datetime it doesn't work it doesn't work after restart. If I change to datetime-control during running it doesn't work (bug?).

So my question: why do I need to use datetime-control? From my understanding the difference between XXX and XXX-control is that XXX-control doesn't directly match to an existing device on the KNX bus (GA not associated to a KNX communication object that can be read) but instead the state remains owned by OH2 and thus OH2 never issue read request to XXX-control GA. But from my understanding this shouldn't prevent OH2 to send telegram to GA when using the standard XXX control type.

@sjsf
Copy link
Author

sjsf commented Mar 29, 2018

But from my understanding this shouldn't prevent OH2 to send telegram to GA when using the standard XXX control type.

Looking at from a technical perspective: Not commands, but state updates. And this is effectively what happens here: The NTP binding doesn't send commands but only issues state updates for the item. Standard channels don't react on those because otherwise we would end up in loops.

Your assumption to use the -control-channel whenever

GA not associated to a KNX communication object that can be read

is for sure correct but a little too restrictive. Rather think of it like who "owns" the truth, and this clearly is the NTP binding on openHAB side in your case.

@ArdescoConsulting
Copy link

@udo1toni

I'm not sure if I understand this parts of your best practice

I defined the channels in corresponding devices. Each real device channel has its own bunch of GA, and each channel can be controlled individual.
As of central GA I have set a virtual device without any hardware but only *-control channels. This ensures that I can't even accidentally request the state of a central GA (which could maybe result in an instant all ON or all OFF without meaning this - luckily I eliminated these missconfigurations long time ago)
Scene GA are virtual as well and so is datetime GA for HVAC.

So I have several Devices without any channel, but I don't bother as my tests worked great so far.

With my understanding of it I would do the sample like below. Is that correct?

Bridge knx:ip:bridge [ 
   type="TUNNEL", 
   ipAddress="192.168.1.10",    //TCP/IP address of KNX/IP interface 
   localSourceAddr="1.1.5"      //free device address in KNX
]{
   //Things to monitor KNX devices

   Thing device Jung_LineCoupler_1_1_0           "Jung Line Coupler 1.1.0"            @ "Electric Board" [
      address="1.1.0"   //KNX device address of Line Coupler
   ] {}
   Thing device Weinzierl_KNXIPInterface_1_1_1   "Weinzierl KNX/IP Interface 1.1.1"   @ "Electric Board" [
      address="1.1.1"   //KNX device address of the KNX/IP Interface
   ] {}
   Thing device Jung_PushButtonSensor_1_1_2      "Jung Push button sensor 1.1.2"      @ "Living Room"    [
      address="1.1.2"   //KNX device address of Push Button sensor
   ] {}
   Thing device Jung_DimmerActutor_1_1_3         "Jung Dimmer actuator 1.1.3"         @ "Electric Board" [
      address="1.1.3"   //KNX device address of dimmer actuator
   ] {}
   Thing device Jung_ShutterActuator_1_1_4       "Jung Shutter Actuator 1.1.4"        @ "Electric Board" [
      address="1.1.4"   //KNX device address of shutter actuator
   ] {}

   //Things for KNX Channels
   
   Thing device Switch_Light_LivingRoom      "Light Switch Living Room"       @ "Living Room" [
   ] {
      Type switch          : Switch_Light_LivingRoom       "Light Switch Living Room"
         [ ga="0/0/1+<0/0/2" ]
   }
   Thing device Dimmer_Light_LivingRoom      "Light Dimmer Living Room"       @ "Living Room" [
   ] {
      Type dimmer          : Dimmer_Light_LivingRoom       "Light Dimmer Living Room"
         [ ga="0/0/1+<0/0/2", position="0/0/3+<0/0/4", increaseDecrease="0/0/5" ]
   }
   Thing device Shutter_Window_LivingRoom    "Window Shutter Living Room"     @ "Living Room" [
   ] {
      Type rollershutter   : Shutter_Window_LivingRoom     "Windows Shutter"
         [ upDown="1/0/1", stopMove="1/0/0", position="1/0/3+<1/0/4" ]
   }
   Thing device Temperature_Room_LivingRoom   "Room Temperature Living Room"   @ "Living Room" [
   ] {
      Type number          : Temperature_Room_LivingRoom   "Room Temperature Living Room"
         [ ga="3/0/22" ] 
   }
 }

BTW sorry for the late reply. A bad bios update resulted in a complete reinstall :(

@nibblerrick I'll update the tutorial document once I understand the best practice myself

@udo1toni
Copy link
Contributor

No, I used the Things for monitoring and channel definition.
The channels are defined only if the device is an actuator (dimmer, relay, solid state relay, led controller) or if the real state is stored in the device (wall switch is used as an indicator, master presence detector gets information from slave presence detector, temperature sensor in wall switch).
All other GA (time, scenes, outdoor temperature [no knx sensor]) are setup as *-control in an additional Thing, as there is not only one device, which could be called the master for that GA - e.g. time is sent to every HVAC (Raumtemperaturregler) in my house, scenes are sent to more than one channel and so on.

@martinvw martinvw added this to the 2.3 milestone May 6, 2018
@wborn wborn added the knx label Dec 16, 2018
Flole998 pushed a commit to Flole998/openhab-addons that referenced this pull request Dec 30, 2021
* New translations DefaultSystemChannels.properties (Hungarian)
* New translations SystemProfiles.properties (Dutch)
* New translations SystemProfiles.properties (Hungarian)
* New translations tags.properties (French)
* New translations tags.properties (French)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new binding If someone has started to work on a binding. For a new binding PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet