What follows is my implementation of the Homematic IP (HmIP) HmIPW-DRBL4 rollershutter actuator. I would not entitle this as an guide or HowTo. I consider myself an openHAB beginner and I am sure in my solution is a lot of room for improvement. I think even stick to the common openHAB Design Pattern would make it better. I am not familar with them.
I am not sure how many non-german speaking people using Homematic so I will use the English Homematic UI terms.
I created all Items via PaperUI.
Goal
Control Homematic HmIPW-DRBL4 rollershutter via openHAB rollershutter items.
Setup
openHAB 2.4 running as docker on Synology 218+
Raspberrymatic 3.47.22.20191026 running on Raspberry Pi 2B+
Homematic device HmIPW-DRBL4 1.2.10
Problems
The openHAB rollershutter Item can be set to a value from 0-100. Via the sitemap it receives the following commands UP/STOP/DOWN
After the UP
command it sets itself to 0 and after a DOWN
command it sets itself to 100. So for the Item 0 represents the rollershutter is up/open and 100 represents it is down/closed. The vaule is like the vaule of shadow given.
Homematic treats this the other way around. The Homematic vaule is the light getting through. So if Homematic tells rollershutter is at 100 the rollershutter is up/open and if it is a 0 the rollershutter is closed. I used Rules to invert the vaule while updating my Item via the same Rule.
Sidenote
The HmIPW-DRBL4 has a setting calledShutter level moved up
(Default 100%) andShutter level moved down
(Default 0%). It’s possible choose a vaule from 0-100% for each one. By switching the vaules i was not able to change the way Homematic represents the status of the rollershutter. So I left them default.
Via the Homematic Binding we see many Channels in openHAB for the HmIPW-DRBL4. Three Channels are important in my solution. So we cant Link them to a single openHAB rollershutter Item.
Solution
The Homematic HmIPW-DRBL4 has Homematic channels from 0 to 17 but not all are shown in the Homematic UI. Only the channels 0, 1+2, 5+6, 9+10, 13+14, 17
Channel 0 are general settings looking like this:
The HmIPW-DRBL4 supports four rollershutter/blinds. For each the Homematic UI is showing two channels (1+2, 5+6, 9+10, 13+14). One is called “Status report blind actuator” the other “Blind actuator”. Those look like this:
As stated above the next channels are 5+6 and so on. The channels 3+4 are not displayed!
Channel 17 is the “Weekly program” channel.
The Thing in openHAB has many configuration parameters in the thing configuration itself. There you can found the settings from the Homematic channel 0 but more setting for channels 1 to 17. I did not change any of those.
In the Channelview of the Thing you see 17 Channelgroups called “Blind Transmitter” and “Blind Virtual Receiver”. The 17th Channelgroup is the “Blind Week Profile”.
The Channels in “Blind Transmitter” are all read-only mapping to the “Status report blind actuator” in Homematic. The “Blind Virtual Receiver” Channels are mostly read-only too. You can send commands to the “Level( 2)”-Channels and there is an additional “Stop”-Channel you can send commands to. Those groups map to the “Blind actuator” channels in Homematic.
Exampel of the “Blind Virtual Receiver” Channels:
What Channels to Link/create Items for
I used 3 Channels per rollershutter. For the first rollershutter i used the following:
From “Blind Transmitter” I use homematic:HmIPW-DRBL4:XXXX:YYYY:1#LEVEL
. This gives me the current state of the rollershutter as a Dimmer-Type Item.
From “Blind Virtual Receiver” I use homematic:HmIPW-DRBL4:XXXX:YYYY:2#LEVEL
. This lets me control the rollershutter. I can set a vaule from 0-100 via a Dimmer-Type Item. Remember 0 is down/closed and 100 is up/open!
From “Blind Virtual Receiver” I also use homematic:HmIPW-DRBL4:XXXX:YYYY:2#STOP
. This lets me stop the rollershutter when moving. This is a Switch-Type Item.
Be carefull! The number in the channel name before the # maps to the channels in the Homematic UI. Make sure to use the right channels 1+2, 5+6, 9+10, 13+14.
The control via for example Channel 3# works too for the rollershutter on channel 2# but it sets some value you cant see in the Homematic UI and the rollershutter can’t controlled correctly any more directly via Homematic UI.
I created the Items in PaperUI via the “Link->Create New Item” dialogue. So my items look like this (export from RestAPI):
The Dimmer-Type Item I get the current status from (Channel: homematic:HmIPW-DRBL4:XXXX:YYYY:1#LEVEL
):
"link": "http://<openhab>:8080/rest/items/HMRollladenaktorHauptverteilungLinks_1_Level",
"state": "0",
"stateDescription": {
"minimum": 0,
"maximum": 1.01,
"step": 0.1,
"pattern": "%.2f %unit%",
"readOnly": true,
"options": []
},
"editable": true,
"type": "Dimmer",
"name": "HMRollladenaktorHauptverteilungLinks_1_Level",
"label": "Rollladen Küche Tür Status",
"category": "rollershutter",
"tags": [],
"groupNames": []
See it is "readOnly": true,
.
The Dimmer-Type Item I set the state to control the rollershutter (Channel: homematic:HmIPW-DRBL4:XXXX:YYYY:2#LEVEL
):
"link": "http://<openhab>:8080/rest/items/HMRollladenaktorHauptverteilungLinks_2_Level",
"state": "0",
"stateDescription": {
"minimum": 0,
"maximum": 1.01,
"step": 0.1,
"pattern": "%.2f %unit%",
"readOnly": false,
"options": []
},
"editable": true,
"type": "Dimmer",
"name": "HMRollladenaktorHauptverteilungLinks_2_Level",
"label": "Rollladen Küche Tür Steuerung",
"category": "rollershutter",
"tags": [],
"groupNames": []
See it is "readOnly": false,
.
The Switch-Type Item I stop the rollershutter if it is moving (Channel: homematic:HmIPW-DRBL4:XXXX:YYYY:2#STOP
):
"link": "http://<openhab>:8080/rest/items/HMRollladenaktorHauptverteilungLinks_2_Stop",
"state": "OFF",
"stateDescription": {
"readOnly": false,
"options": []
},
"editable": true,
"type": "Switch",
"name": "HMRollladenaktorHauptverteilungLinks_2_Stop",
"label": "Rollladen Küche Tür Stop",
"category": "Switch",
"tags": [],
"groupNames": []
As you can see the Dimmer-Type Items come with some
stateDescription
. I did not set this. It was set by default by creating it via PaperUI while Linking the Channel.
At this point you already can control your rollershutter via the Dimmer and Switch Item. At this point I noticed that when i set the control Dimmer to 100 (open) it end up setting itself to 0 (closed). So to open the rollershutter I used the value 99.
Proxy-Items
The goal was to control these items via one single openHAB rollershutter item. These Items I called Proxy-Items. I created them via PaperUI as well but didnt linked them to any Channel.
"link": "http://<openhab>:8080/rest/items/Proxy_Rollladen_Kueche_Tuer",
"state": "100",
"editable": true,
"type": "Rollershutter",
"name": "Proxy_Rollladen_Kueche_Tuer",
"label": "Rollladen Küche Tür [%s]",
"category": "rollershutter",
"tags": [],
"groupNames": [
"gRollladen"
]
For all Proxy-Items I set Veto an auto Update
to the option “autoupdate - Auto Update”. I think this is like {autoupdate=false}
in .items file definition. I did this so the Proxy-Items doesnt changes automaticly by the received commands.
Rules
To connect this Proxy-Items with the real Items I use Rules.
One Rule triggers on the received command
an checks the command given to the proxy Item. Based on the received command it sets the Control-Dimmer to 99 if command UP
was received or to 0 if command DOWN
was received. If command STOP
was received it sets the Stop-Switch TRUE
. The Rule looks like this:
rule "Control Proxy_Rollladen_Kueche_Tuer"
when
Item Proxy_Rollladen_Kueche_Tuer received command
then
logInfo( "rollershutter.rules", "Rule 'Control Proxy_Rollladen_Kueche_Tuer' triggered" )
switch(receivedCommand.toString) {
case "UP": {
HMRollladenaktorHauptverteilungLinks_2_Level.sendCommand(99)
}
case "DOWN": {
HMRollladenaktorHauptverteilungLinks_2_Level.sendCommand(0)
}
case "STOP": {
HMRollladenaktorHauptverteilungLinks_2_Stop.sendCommand(ON)
}
}
end
The second Rule triggers on the changed
of the Status-Dimmer. The state of the Status-Dimmer is subtracted from 100 to invert it and then the Proxy-Item is updated with this value. I had to use as Number
at the Status-Dimmer state to not get an error. The Rule looks like this:
rule "Update Proxy_Rollladen_Kueche_Tuer"
when
Item HMRollladenaktorHauptverteilungLinks_1_Level changed
then
logInfo( "rollershutter.rules", "Rule 'Update Proxy_Rollladen_Kueche_Tuer' triggered" )
Proxy_Rollladen_Kueche_Tuer.postUpdate(100-(HMRollladenaktorHauptverteilungLinks_1_Level.state as Number))
end
Group
At the end i created a Group for all Proxy Items. I wanted the Group icon to only be shown closed if all member Items closed.
Group:Rollershutter:AND("100","0") gRollladen "Rollladen" <rollershutter>
Log
A command to a Proxy-Item looks like this in the log:
2019-11-06 21:31:04.303 [ome.event.ItemCommandEvent] - Item 'Proxy_Rollladen_Kueche_Tuer' received command UP
==> /openhab/userdata/logs/openhab.log <==
2019-11-06 21:31:04.305 [INFO ] [ome.model.script.rollershutter.rules] - Rule 'Control Proxy_Rollladen_Kueche_Tuer' triggered
==> /openhab/userdata/logs/events.log <==
2019-11-06 21:31:04.312 [ome.event.ItemCommandEvent] - Item 'HMRollladenaktorHauptverteilungLinks_2_Level' received command 99
2019-11-06 21:31:04.314 [vent.ItemStateChangedEvent] - HMRollladenaktorHauptverteilungLinks_2_Level changed from 0 to 99
2019-11-06 21:31:04.578 [vent.ItemStateChangedEvent] - HMRollladenaktorHauptverteilungLinks_2_Level changed from 99 to 0
2019-11-06 21:31:05.158 [vent.ItemStateChangedEvent] - HMRollladenaktorHauptverteilungLinks_1_Level changed from 0 to 1
==> /openhab/userdata/logs/openhab.log <==
2019-11-06 21:31:05.158 [INFO ] [ome.model.script.rollershutter.rules] - Rule 'Update Proxy_Rollladen_Kueche_Tuer' triggered
==> /openhab/userdata/logs/events.log <==
2019-11-06 21:31:05.162 [vent.ItemStateChangedEvent] - Proxy_Rollladen_Kueche_Tuer changed from 100 to 99
2019-11-06 21:31:05.165 [GroupItemStateChangedEvent] - gRollladen changed from 100 to 0 through Proxy_Rollladen_Kueche_Tuer
==> /openhab/userdata/logs/openhab.log <==
2019-11-06 21:31:09.122 [INFO ] [ome.model.script.rollershutter.rules] - Rule 'Update Proxy_Rollladen_Kueche_Tuer' triggered
==> /openhab/userdata/logs/events.log <==
2019-11-06 21:31:09.122 [vent.ItemStateChangedEvent] - HMRollladenaktorHauptverteilungLinks_1_Level changed from 1 to 15
2019-11-06 21:31:09.127 [vent.ItemStateChangedEvent] - Proxy_Rollladen_Kueche_Tuer changed from 99 to 85
==> /openhab/userdata/logs/openhab.log <==
2019-11-06 21:31:35.917 [INFO ] [ome.model.script.rollershutter.rules] - Rule 'Update Proxy_Rollladen_Kueche_Tuer' triggered
==> /openhab/userdata/logs/events.log <==
2019-11-06 21:31:35.919 [vent.ItemStateChangedEvent] - HMRollladenaktorHauptverteilungLinks_1_Level changed from 15 to 99
2019-11-06 21:31:35.921 [vent.ItemStateChangedEvent] - Proxy_Rollladen_Kueche_Tuer changed from 85 to 1
2019-11-06 21:31:35.927 [vent.ItemStateChangedEvent] - HMRollladenaktorHauptverteilungLinks_2_Level changed from 0 to 99
I am not sure why the Control-Dimmer changes the state back an forth. If u set it to 100 it will end up at 0 and doing the opposite. Thats why i use 99.
The Update-Rule triggers multiple times because the Item is updated while the rollershutter is still moving.