Rollershutter Proxy - how to trigger on value change

Hi together.

I use the Homematic Rollershutters. As posted from many users they behave trange so a proxy is a solution.

My only remaining problem: “How do I change my rule that specific setpoints are also written to target”

My intergration is as follows:

.Items

Rollershutter   EG_WO_Rolladen_Links_Proxy         "Rolladen Wohnzimmer links [%d %%]" ["Rollershutter"]
Rollershutter   EG_WO_Rolladen_Links_Set           {channel="homematic:HmIP-BBL:xxy:4#LEVEL" }
Switch          EG_WO_Rolladen_Links_Stop          {channel="homematic:HmIP-BBL:xxy:4#STOP" }
Rollershutter   EG_WO_Rolladen_Links_Level         {channel="homematic:HmIP-BBL:xxy:3#LEVEL" }

.rules

rule "Item EG_WO_Rolladen_Links"
when Item EG_WO_Rolladen_Links_Proxy received command
then    if (receivedCommand == UP) {
        EG_WO_Rolladen_Links_Set.sendCommand(99)
        }
        if (receivedCommand == STOP) {
        EG_WO_Rolladen_Links_Stop.sendCommand(ON)
        }
        if (receivedCommand == DOWN) {
        EG_WO_Rolladen_Links_Set.sendCommand(0)
        }
end

//rule "Item EG_WO_Rolladen_Links"
when Item EG_WO_Rolladen_Links_Level changed
then EG_WO_Rolladen_Links_Proxy.postUpdate(EG_WO_Rolladen_Links_Level.state)
end

.sitemap

Switch item=EG_WO_Rolladen_Links_Proxy label="Wohnzimmer Rolladen links [%s]" icon="blinds" mappings=[UP="Up",STOP="Stop", DOWN="Down", 35="Maxi"]

Now I want als react to any value (changable) defined on the switch like 35=“Maxi”?

Can someone give me a hint?

You mean you want to test if receivedCommand is numeric?
I think
if (receivedCommand instanceof DecimalType)
would do. Although if you’ve picked out the other possible commands already, you only need an ‘else’.

Thanks, this is working.

How do I read the actual value in the rollershutter type?
EG_WO_Rolladen_Links_Proxy.???

when Item EG_WO_Rolladen_Links_Proxy received command
then    if (receivedCommand == UP) {
        EG_WO_Rolladen_Links_Set.sendCommand(99)
        }
        if (receivedCommand == STOP) {
        EG_WO_Rolladen_Links_Stop.sendCommand(ON)
        }
        if (receivedCommand == DOWN) {
        EG_WO_Rolladen_Links_Set.sendCommand(0)
        }
        if (receivedCommand instanceof DecimalType) {
        EG_WO_Rolladen_Links_Set.sendCommand(EG_WO_Rolladen_Links_Proxy.???)

Uhh, don’t you want to send the real device the numeric command that the proxy just received … you know, receivedCommand ?

Y

rule "Item EG_WO_Rolladen_Links"
when Item EG_WO_Rolladen_Links_Proxy received command
then    
        if (receivedCommand == UP || receivedCommand == STOP || receivedCommand == DOWN) {
            if (receivedCommand == UP) {
            EG_WO_Rolladen_Links_Set.sendCommand(99)
            }
            if (receivedCommand == STOP) {
            EG_WO_Rolladen_Links_Stop.sendCommand(ON)
            }
            if (receivedCommand == DOWN) {
            EG_WO_Rolladen_Links_Set.sendCommand(0)
            }
        }    
            else { //bei allen anderen Werten Wert direkt in Actuator schreiben
            EG_WO_Rolladen_Links_Set.sendCommand(35) //?How do I write here the value of my proxy??
        
        //EG_WO_Rolladen_Links_Set.sendCommand(EG_WO_Rolladen_Links_Proxy.value)
            }

end

es I just want to write the new setpoint /received from the sitemap-button) to the real rollershutter.

Objective check ; here you don’t care about the state of your proxy at all. Not interested.

You want the numeric value of the command that was just sent by your UI. It’s right there in a variable, ready to go, even tested to be numeric already. It’s called receivedCommand.

THX, now I got it working!!!

my solution
.rules

when Item EG_WO_Rolladen_Links_Proxy received command
then    
        if (receivedCommand == UP || receivedCommand == STOP || receivedCommand == DOWN) {
            if (receivedCommand == UP) {
            EG_WO_Rolladen_Links_Set.sendCommand(99)
            }
            if (receivedCommand == STOP) {
            EG_WO_Rolladen_Links_Stop.sendCommand(ON)
            }
            if (receivedCommand == DOWN) {
            EG_WO_Rolladen_Links_Set.sendCommand(0)
            }
        }    
            else { //bei allen anderen Werten Wert direkt in Actuator schreiben
            EG_WO_Rolladen_Links_Set.sendCommand(receivedCommand)
             
            }

end

Your if structure is a bit weird, have you come across the use of if-else yet?

        if (receivedCommand == UP) {
            EG_WO_Rolladen_Links_Set.sendCommand(99)
        } else if (receivedCommand == STOP) {
            EG_WO_Rolladen_Links_Stop.sendCommand(ON)
        } else if (receivedCommand == DOWN) {
            EG_WO_Rolladen_Links_Set.sendCommand(0)
        } else {
            EG_WO_Rolladen_Links_Set.sendCommand(receivedCommand)
        }
1 Like

@knaxman just some extra info for statements in future rules, if needed:

The if statement specifies a block of code to be executed if a condition is true:

if ( condition ) {
// block of code to be executed if the condition is true }

The else statement specifies a block of code to be executed if the condition is false:

if ( condition ) {
// block of code to be executed if the condition is true } else {
// block of code to be executed if the condition is false }

The else if statement specifies a new condition if the first condition is false:

if ( condition1 ) {
// block of code to be executed if condition1 is true } else if ( condition2 ) {
// block of code to be executed if the condition1 is false and condition2 is true
} else {
// block of code to be executed if the condition1 is false and condition2 is false }

Info from this link:
https://www.w3schools.com/jsref/jsref_if.asp

Its a good site that I keep bookmarked just for reference when trying to write rules. :wink: