After this i added an KNX Device as a thing. I have here a list of KNX bus-adresses. This one should most defninateley work. The thing is “online”, too:
Hello Sebastian,
multiple errors I see, young Padawan , e.g. 1.001 is not a group address but a datapoint type.
You are mixing things up.
The IP interface definition seems to be fine though.
Please take a look into this little post containing a step by step description on how knx configuration links to OH config. and how to set up a basic knx switch.
I just saw in ETS, that all channels of the actuator (its an AMS-0816.02 8-fach Schaltaktor mit Strommessung) have a “status-adress”, is that right?
Could you point me in the right direction on how to get these into OH correctly?
Enter a/b/c+<d/e/f as channel group address.
The first GA ist the switching object, the second one the status GA.
You find examples in the binding documentation.
This will allow you to switch the actor and the channel will reflect it’s status.
One last thing, as you please
The garage gate is controlled by this device here. Its a bit more complicated, i cannot get it to run properly, even after reading the documentations. KNX A3-B2 - Elsner Elektronik
I can get the gate going up and down using the GAs in the list. However, i need to setup two individual channels, one for up, one for down.
I have tried it with the rollershutter-channel and added “5/1/0+5/1/2” But this way it doesn´t work at all.
You have to use different channels For controlling these two switches, there are some options, but I would prefer to use another Item and a rule. What about stopping the gate? Is this done by a second impulse for the same input?
I created a rule with simple switches, which works for now. A little complicated and not very elegant. And no status–updates. The problem is, that both switches need to get to their “Off-position” before it can send another impulse.
You are right, second impulse in the same direction the gate is moving stops it.
The thing i don´t get is, that there is no “Datentyp” for “hoch, runter and lüften” in ETS. Only for “Tor geöffnet” und “Tor geschlossen.” Maybe this is needed to get the Motor running? (Hörmann)
Simple version:
Contact Item for “gate open”
Contact Item for “gate closed”
Switch Item for “open gate”
Switch Item for “close gate”
Number Item to control the gate
Unfortunately there is no Channel for “gate is moving”, so maybe we have to create something for that.
rule "garage door"
when
Item ConGDoorOpen changed to CLOSED or
Item ConGDoorClosed changed to CLOSED or
Item NumGDoorControl received command
then
var Integer iNew = -1
if(receivedCommand !== null) { // rule triggered by NumGDoorControl
switch((receivedCommand as Number).intValue) { // which command was sent?
case 2: SwGDoorOpen.sendCommand(ON) // for 2, send open
case 3: SwGDoorVent.sendCommand(ON) // for 3, send vent
case 4: SwGDoorClose.sendCommand(ON) // for 4, send close
case 5: { // for 5, send a stop
if(SwGDoorOpen.state == ON)
SwGDoorOpen.sendCommand(ON)
else if(SwGDoorClose.state == ON)
SwGDoorClose.sendCommand(ON)
else if(SwGDoorVent.state == ON)
SwGDoorVent.sendCommand(ON)
}
}
} else { // end position
if(triggeringItemName.contains("Closed")) { // rule triggered by ConGDoorClosed
iNew = 6 // show closed
SwGDoorClose.postUpdate(OFF) // switch off the item
} else { // rule triggered by ConGDoorOpen
iNew = 1 // show open
SwGDoorOpen.postUpdate(OFF) // switcch off the item
}
}
if(iNew > 0)
NumGDoorControl.postUpdate(iNew)
end
Now, in the UI, create different buttons for open, close, vent and stop. (these buttons have to send the corresponding number) Configure to display different messages for the Numbers (maybe use MAP transformation service):
You could even use a Rollershutter Item or a Dimmer Item (maybe more work…) to use the garage door icon. You would have to change the numbers for display and commands.
Hi Udo, i tried to digest this, but honestly, i am a bit lost
For the simple Version:
Do i add one channel for each item you wrote? I.e. for Contact Item for “gate open” i would add a channel “Contact” → Group-Adress : 5/1/3 → and then?
Also i am not sure about what to do with the number item you suggest for controlling the gate.
Can you helm me any further? Sorry, me noob
Also: This code you send me, is it a rule or a script? Pasting it into a rule gives me plenty of errors.
Yes. You need one channel per attribute, one channel for sending “open the door”, one channel for “close the door”, one channel for “go to venting position”, one channel for detecting closed door and one channel for opened door. All command channels are of type switch, the two channels to get the end positions are of type contact. Each of these channels are setup with only one GA. Each of the channels are linked to one specific Item.
That is another Item, which is not linked at all, so simply create it.
It’s a rule (to be more specific: it’s a DSL rule written in a text file). You could input this rule via UI, but be aware that within the UI, the when part of the rule is built through the UI. The same rule as UI Rule in code:
configuration: {}
triggers:
- id: "1"
configuration:
itemName: ConGDoorOpen
state: CLOSED
type: core.ItemStateChangeTrigger
- id: "2"
configuration:
itemName: ConGDoorClosed
state: CLOSED
type: core.ItemStateChangeTrigger
- id: "3"
configuration:
itemName: NumGDoorControl
type: core.ItemCommandTrigger
conditions: []
actions:
- inputs: {}
id: "4"
configuration:
type: application/vnd.openhab.dsl.rule
script: >2
var Integer iNew = -1
if(receivedCommand !== null) { // rule triggered by NumGDoorControl
switch((receivedCommand as Number).intValue) { // which command was sent?
case 2: SwGDoorOpen.sendCommand(ON) // for 2, send open
case 3: SwGDoorVent.sendCommand(ON) // for 3, send vent
case 4: SwGDoorClose.sendCommand(ON) // for 4, send close
case 5: { // for 5, send a stop
if(SwGDoorOpen.state == ON)
SwGDoorOpen.sendCommand(ON)
else if(SwGDoorClose.state == ON)
SwGDoorClose.sendCommand(ON)
else if(SwGDoorVent.state == ON)
SwGDoorVent.sendCommand(ON)
}
}
} else { // end position
if(triggeringItemName.contains("Closed")) { // rule triggered by ConGDoorClosed
iNew = 6 // show closed
SwGDoorClose.postUpdate(OFF) // switch off the item
} else { // rule triggered by ConGDoorOpen
iNew = 1 // show open
SwGDoorOpen.postUpdate(OFF) // switcch off the item
}
}
if(iNew > 0)
NumGDoorControl.postUpdate(iNew)
type: script.ScriptAction
Ofc I put in the rule you gave me in the rules-ui → no more errors.
Now, i don´t know, what else i need to do. Ofc all the switches and contacts are shown in the model and overview and i can click on them, but i dont know what to do with this number-item. Maybe i am wrong about the final result of this whole odyssey In the end i want (mainly) two “buttons” for up and down, which also show the state of the garagedoor. Am i right?
Looks promising. Now create a Number Item without any links (i.e. Main UI->Administration->Settings->Items->Add Item (white + on blue circle)
Give it the correct name and set type to Number. This Item will be the only one you’ll need in the UI.
Save the Item. Go to the Item and add Metadata state Description. Paste the List to Options:
So, i got this now. Not pretty, but i am not complaining The status is not shown here, i am completly lost, where i have to search for the mistake, haha!
Anyway, the gate opens and closes ONE time, after this it won´t work again. After checking for the switches i can see, that both switches for up and down are turned on. After switching them back to off manually, it works again. Once
Is there any way to create simple push-buttons that return to their default position?
Did you create the rule? You don’t need to use an expiration timer, this is all done by the rule. Maybe the logic is wrong. The rule is now triggering if one of the contacts is closing. So, if the Item ConGDoorOpen changed to CLOSED, the Status of NumGDoorControl is changed to 1 (which is mapped to “OPEN”). If the Item ConGDoorClosed changed to CLOSED, the Status of NumGDoorControl is changed to 6 (which is mapped to “CLOSED”). But maybe the trigger has to be changed to OPEN.
Hi guys,
just right now i managed to click together several UI-Rules which work really well.
Scince i was not able to get your rule running, @Udo_Hartmann , i tried to recreate the same in different UI rules. So THANK YOU for your inspiration
I got a 99% solution now:
Klicking on “up” on a rollershutter item moves the gate. Another item “Gate-Status” shows “moving”.
After full open the status tells me “open”. Vice versa when closing. I dont need “venting” … I used the expire-meta to reset the switches 1s after i klicked them. Works wonderfully.
The only -1% is, that the little icon of the “Status-Item” does not change its state. Its a Number-Item with Metadata state description. Any ideas?!
Given, that all Items are named like in my rule, the only thing to do is to paste the code…
And as said above… If you want to use the garage door Icon to reflect position of the door, you would have to change then numbering (so that a closed Garage door is a 100, an opened door is 0, closing and opening between those two levels and even venting would be a position. Stop maybe at 50?
You will have to select the icon to show item state, change the sent commands and the mapped text and the rule should work.
If you want it neat and shiny, you are free to create a custom widget for your garage door.
Alright! Got it! At least in the MainUI (?) Icon is changing correctly between OPEN, CLOSED and MOVING. I dont need STOP or VENTING, scince i never plan to do these commands
Thank you, i learned so much this way!
BUT! … argh…
In the BasicUI, which i am usin in the app (Sitemap) it looks a little different.
Item is not moving and i have a switch instead of the text from the number item.
EDIT: Funny… In my Android-App the Sitemap works just as intended. But not in the browser-view of the sitemap (basic-ui)