I have/had the same problem.
I wrote two ‘generic’ proxy rules which can handle all my seven shutters. The read/write problem could be solved as well, since you can only read out the status at one channel and control the shutter at another.
Therefore you need three items (proxy item, controll item, status item) for each rollershutter.
homematic.items:
//groups are needed for triggering the rules
Group rollProxy "Rolläden Proxy"
Group rollControl "Rolläden Bindings"
Group rollStatus "Rolläden Status"
//proxy
Rollershutter rollEssecke "Essecke [%d %%]" (rollProxy)
//control
Rollershutter rollEsseckeControl "Essecke Binding [%d %%]" (rollControl) ["Switchable"] {channel="homematic:HmIP-BROLL:[fancy:id]:4#LEVEL"} // channel 4
// status
Rollershutter rollEsseckeStatus "Essecke Status [%d %%]" (rollStatus) {channel="homematic:HmIP-BROLL:[fancy:id]:3#LEVEL"} // channel 3
In this code there is an naming convention for the items. All the names of the items for one rollershutter have to start with the name. The ‘status’ item musst end with an ‘Status’, the ‘control’ item musst end with ‘Control’. Keep in mind, that the string ‘Status’ must not appear more often in the name of the ‘status’ item, otherwise the assignment with this code base does not work.
Example:
Proxy: freakingCoolRollershutter
Control: freakingCoolRollershutterControl
Status: freakingCoolRollershutterStatus
homematicproxy.rules:
import org.eclipse.smarthome.model.script.ScriptServiceUtil
rule "Rolladen Status Update" // status update
when
Member of rollStatus received update
then
var name = triggeringItem.name
name = name.replace('Status','')
var correspondingProxy = ScriptServiceUtil.getItemRegistry.getItem(name)
// I will later add some mappings here, where it will compansate the offset
// of the roller shutter when it allready touches the ground, but is not fully
// closed. Then the Basic UI shows a half open roller shutter, if it is really
// half open
if(triggeringItem.state != correspondingProxy.state.toString){
correspondingProxy.postUpdate(triggeringItem.state.toString)
}
end
rule "Rolladen steuern" // control rollershutter
when
Member of rollProxy received command
then
var correspondingControll = ScriptServiceUtil.getItemRegistry.getItem(triggeringItem.name + "Control")
// here the actual mapping happens
switch(receivedCommand){
case DOWN: {
if(correspondingControll.state != "100"){
correspondingControll.sendCommand("100")
}
}
case UP:{
if(correspondingControll.state != "1"){
correspondingControll.sendCommand("1")
}
}
//here I will add the same mapping logic for the offset
default: {
if(correspondingControll.state != receivedCommand){
correspondingControll.sendCommand(receivedCommand)
}
}
}
end
default.sitemap:
Default item=rollEssecke label="Essecke"
I think that’s an easy and short way to solve that problem, without having to add two new rules for each roller shutter.
Kind reagards,
Phil