Ok let´s start.
I´m using the original CCU3 and openHABian on a raspberry Pi4.
If you´re using a CCU3 aswell, please have a look at Cloudmatic.
It´s a service to make your CCU3 available for certain Apps (@Home App) and you can connect it to Amazon.
It´s very responsive compared to the openHAB integration and you can use the homematic states.
The values in openHAB are inverted, so homematic sees 100% as open and 0% as closed. openHAB sees 100% as closed and 0% as open.
You could use the invert feature of the Alexa integration but i think it´s another point of failure.
CCU3 → Cloudmatic → Alexa = Responsive and the same states
CCU3 → openHAB → myopenhab → Alexa = Sometimes slower and the states are inverted
The prices are pretty fair and you can access your CCU3 without dealing with a VPN connection or other tricks.
Back to openHAB.
My HmIP-BROLL devices are connected to openHAB and i created the Things in the UI.
As i´m using openHAB for quiet some time now, i prefer the text based configuration with *.items files.
homematic.items
// Groups to control the roller shutters
Group gRolladenProxy
Group gRolladenControl
Group gRolladenStatus
// Rollade Arbeitszimmer
Rollershutter hmRolladeArbeit "Arbeitszimmer" <rollershutter> (Arbeitszimmer, gRolladenProxy)
Rollershutter hmRolladeArbeitControl (gRolladenControl) {channel="homematic:HmIP-BROLL:ccu3:<SERIAL>:4#LEVEL"}
Rollershutter hmRolladeArbeitStatus (gRolladenStatus) {channel="homematic:HmIP-BROLL:ccu3:<SERIAL>:3#LEVEL"}
Switch hmRolladeArbeitStop (gRolladenControl) {channel="homematic:HmIP-BROLL:ccu3:<SERIAL>:4#STOP"}
// Optional channels for the weekly schedules
Number hmRolladeArbeitTCLs {channel="homematic:HmIP-BROLL:ccu3:<SERIAL>:7#WEEK_PROGRAM_TARGET_CHANNEL_LOCKS"}
String hmRolladeArbeitCombined {channel="homematic:HmIP-BROLL:ccu3:<SERIAL>:7#COMBINED_PARAMETER"}
String hmRolladeArbeitTCL {channel="homematic:HmIP-BROLL:ccu3:<SERIAL>:7#WEEK_PROGRAM_TARGET_CHANNEL_LOCK"}
Number hmRolladeArbeitCL {channel="homematic:HmIP-BROLL:ccu3:<SERIAL>:7#WEEK_PROGRAM_CHANNEL_LOCKS"}
As you can see i´m using one proxy item hmRolladeArbeit
in the group gRolladenProxy
.
Followed by hmRolladeArbeitControl
that controls the BROLL and is in the group gRolladenControl
.
Next is the hmRolladeArbeitStatus
that represents the BROLL state and is in the group gRolladenStatus
.
The last item is hmRolladeArbeitStop
to stop the BROLL when moving and it´s in the gRolladenControl
group.
Now for the tricky part, the proxy rule.
Again, i´m using the text based rules with the Rules DSL.
RolladenProxy.rules
import org.openhab.core.model.script.ScriptServiceUtil
val String ruleId = "hmRolladenProxy"
rule "Rolladen Status Update"
when
Member of gRolladenStatus received update
then
var name = triggeringItem.name
name = name.replace('Status','')
var correspondingProxy = ScriptServiceUtil.getItemRegistry.getItem(name)
if(triggeringItem.state != correspondingProxy.state.toString){
correspondingProxy.postUpdate(triggeringItem.state.toString)
}
end
rule "Rolladen steuern"
when
Member of gRolladenProxy received command
then
var correspondingControl = ScriptServiceUtil.getItemRegistry.getItem(triggeringItem.name + "Control")
var correspondingStop = ScriptServiceUtil.getItemRegistry.getItem(triggeringItem.name + "Stop")
switch(receivedCommand){
case DOWN: {
if(correspondingControl.state != "100"){
correspondingControl.sendCommand("100")
}
}
case UP:{
if(correspondingControl.state != "0"){
correspondingControl.sendCommand("0")
}
}
case STOP:{
if(correspondingControl.state != "STOP"){
correspondingStop.sendCommand(ON)
}
}
default: {
if(correspondingControl.state != receivedCommand){
correspondingControl.sendCommand(receivedCommand)
}
}
}
end
The first part that will be triggered by Member of gRolladenStatus received update
will update our Proxy item with the current state of the roller shutters.
The seconds part that will be triggered by Member of gRolladenProxy received command
will control the roller shutters when using the Proxy item.
You need to create the items for all roller shutters and the groups + rule is for all of them.
Bonus, a rule to lift the roller shutters when the window is open while the roller shutter should be closed.
You need a BROLL and a window contact to achieve this.
RolladenLueften.rules
val String ruleId = "hmRolladenLueften"
rule "Rolladen Lueften"
when
Member of gWindows changed to OPEN
then
var name = triggeringItem.name
logDebug(ruleId, triggeringItem.name + " wurde geöffnet.")
logDebug(ruleId, name + " soll geprüft werden.")
switch name {
case 'hmRolladeArbeit': {
if(hmRolladeArbeitStatus.state >= 86)
{
logDebug(ruleId, "Rollade Arbeitszimmer wird zum Lüften angehoben.")
hmRolladeArbeit.sendCommand(87)
}
}
}
end
rule "Rolladen Lueften nach Schliessung"
when
Member of gRolladenStatus changed to 100
then
var name = triggeringItem.name
name = name.replace("Status","")
logDebug(ruleId, name + " wurde geschlossen und soll geprüft werden.")
switch name {
case 'hmRolladeArbeit': {
if(hmRolladeArbeitStatus.state >= 86 && hmFensterArbeit.state == OPEN)
{
logDebug(ruleId, "Rollade Arbeitszimmer wird zum Lüften angehoben.")
hmRolladeArbeit.sendCommand(87)
}
}
}
end
rule "Rolladen schliessen"
when
Member of gWindows changed to CLOSED
then
var name = triggeringItem.name
logDebug(ruleId, triggeringItem.name + " wurde geschlossen.")
logDebug(ruleId, name + " soll geschlossen werden.")
switch name {
case 'hmRolladeArbeit': {
if(hmRolladeArbeitStatus.state == 87)
{
logDebug(ruleId, "Rollade Arbeitszimmer wird wieder geschlossen.")
hmRolladeArbeit.sendCommand(100)
}
}
}
end
Thes rule is a little bit longer and i only used the example of my workspace.
You need to copy the case 'hmRolladeArbeit'
part for every BROLL you want to control.
The values are different because only two of my windows are identical and so the roller shutters all need a different value for the ventilation position.
I closed the roller shutters and then lifted them until the shades are still closed but the slots are open.
Then look at the status item and use this value for the lifting.
So for this example the CCU3 sees the roller shutters as 13% while openHAB sees it as 87%.
I hope that gets you in the right direction.
kind regards
Michael