Rollershutter for shading and 1:n relation

What does you logs show when you trigger the rule?

The log shows:

20:46:19.711 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule ‘Sommerhitze draussen lassen Test’: 3

Which means, that the items triggered by val windowName = nameParts.get(0) + “_” + nameParts.get(1) + “ht” + nameParts.get(3) + “_act_temp” does not match with the filter

Are you running snapshot?
In which case you will need to add a space after the [:
gH_Rolladen.members.forEach[ rs|

No, it is 2.2.0-1 (Release Build)

It has something to do, that I create a new value out of my rollershutter and try to match this with the name of the radiator controller.

I.e the item OG1_sz_rs_tuer creates in my rule the name OG1_sz_ht_tuer, but this name does not exist as an item. Therefore the rule fails. If I use only rollershutter, which have a 1:1 relation to radio controller, the rule works perfectly.

Therefore I look for something, as a wildcard, where I could say, create from item OG1_sz_rs_tuer a value like OG1_sz_ht_* (*=wildcard) Then for all the rollershutter in the sleeping room the temperature would be looked up at the radiator controller OG1_sz_ht_fenster_act_temp.

Try declaring windowName as a global variable

var windowName = ""

rule "Sommerhitze draussen lassen Test"

when 
    Item EG_wz_switch_3_long_test received update OFF
    //Item Temperature changed
then
    if (Temperature.state > 10){
        if (Season.state == ON){
        logInfo("DEBUG", "Hitzeprüfung startet")
        gH_Rolladen.members.forEach[rs|
        var nameParts = rs.name.split("_")
        windowName = nameParts.get(0) + "_" + nameParts.get(1) + "_ht_" + nameParts.get(3) + "_act_temp"
        logInfo("DEBUG", "windowname = " + windowName)
          if (gH_Temperature.members.filter [fk | fk.name == windowName].head.state > 23){
            logInfo("DEBUG", "Zimmer " + windowName + " is too hot!")
               postUpdate(rs,DOWN)
               logInfo("DEBUG", "Fahre runter")
           //sendCommand(rs,80)
             }
           else {
                 logInfo("DEBUG", "Zimmer " + windowName + " ist noch angenehm warm!")
              }]
        }
    }
    else {
                 logInfo("DEBUG", "Noch nicht warm genug für Zimmertemp.-Check")
              }
end

FWIW, check out this post.

Changing the windowName into a Global variable, does not help - as said, I need something like a wildcard, which I could use in general.

@Markus: Thanks for the post you mentioned, but this is exactly, what I don’t want. If I follow your post I need to specify an action for each window separately - we have +20 windows, where I think it isn’t practicable.

We need to find out exactly where the rule fails
Add some logInfo after every line.

There is already a logInfo in for each single line.
It fails at the moment, when it compares the name of the rollershutter with the radiator controller:

10:45:07.435 [INFO ] [smarthome.event.ItemStateChangedEvent] - EG_wz_switch_3_long_test changed from OFF to ON
10:45:14.991 [INFO ] [.eclipse.smarthome.model.script.DEBUG] - Hitzeprüfung startet
10:45:15.521 [INFO ] [.eclipse.smarthome.model.script.DEBUG] - windowname = OG1_sz_ht_tuer_act_temp
10:45:15.671 [INFO ] [smarthome.event.ItemStateChangedEvent] - EG_wz_switch_3_long_test changed from ON to OFF
10:45:16.150 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'Sommerhitze draussen lassen Test': cannot invoke method public abstract org.eclipse.smarthome.core.types.State org.eclipse.smarthome.core.items.Item.getState() on null
```

What is the item definition of:
OG1_sz_ht_tuer_act_temp

That’s the point,it does not exist - in a perfect world, it would take the next radiator controller in the room: OG1_sz_ht_fenster_act_temp

I understand what you are trying to do
You want 1 temperature controller for 2 rollershutters in this case above

Rename OG1_sz_ht_fenster_act_temp to OG1_sz_act_temp
Change windowName to:
windowName = namePart.get(0) + "_" + nameParts.get(1) + "_act_temp"

For each rs the result will be compared against the same temperature
What threw me is the name windowName, it’s not a window, it’s a temperature sensor

A little bit of change in your naming convention and maybe change windowName to tempSensor for clarity

Exactly, one temp sensor controls min. 2 rollershutters.

But the thing is, that I have several room, where I have two or more temp sensors (ie. living room). Therefore renaming the radiator controller is not the perfect way to fix it.

Agree with you about the windowName. Will change it.

I have two different rules for those kind of topics. One which runs every minute and determines some states like temp differences and sets a status in a global item (e.g.LivingWindow1 (1 shall go down, 2 shall go up)).

Then second more room individual where I compare and then based on global status.

Makes it easier to read and maintain when coming back in 1 year and wondering what I wanted to achieve

Yes, but each windows are driven by one off them, If you work on your Item naming carefully by matching the temp controller to the windows it is driving then you’ll achieve your goal

I played a bit around and lucky me, I was able to archive the requested function w/o altering all the item names.
If someone is interested in the same solution, please find my final code underneath:

rule "Sommerhitze draussen lassen Test"

when 
    Item EG_wz_switch_3_long_test received update OFF
    //Item Temperature changed
then
    if (Temperature.state > 10){
        if (Season.state == ON){
        logInfo("DEBUG", "Hitzeprüfung startet")
        gH_Rolladen.allMembers.forEach[rs|
        var nameParts = rs.name.split("_")
        val tempName = nameParts.get(0) + "_" + nameParts.get(1) + "_ht_"
        logInfo("DEBUG", "tempName = " + tempName)   
            if (gH_Temperature?.allMembers.filter [fk | fk.name.startsWith(tempName)].head.state > 23){
                    logInfo("DEBUG", "Zimmer " + tempName + " is too hot!")
                    if (rs.state != 100)
                        {
                        postUpdate(rs,DOWN)
                        logInfo("DEBUG", "Fahre runter")
                         //sendCommand(rs,80)
                        }
                    }
                else {
                        logInfo("DEBUG", "Zimmer " + tempName + " ist noch angenehm warm!")
                    }]
        }
    }
    else {
                 logInfo("DEBUG", "Noch nicht warm genug für Zimmertemp.-Check")
              }
end

Thanks for help

startsWith
Of course didn’t think of that
Good

Hi,

I just restart this threat, as it perfectly describes my setup.

The code, which I showed in April works perfectly for me, except, that the WAF is not fulfilled:
My wife would like to have a code, which checks, if the rollershutter was moved up, after closed for shading.
In this case, it should not move again at the next event -> should prevent, that she i.e. moves the rollershutter up to enjoy the sun and it closes after some minutes again.

Put some brain in and came to the conclusion, that a variable (i.e. windowindex) which is set to1 within the first if-clause could solve the issue. Every night I would set it to 0 with a cron job.

     if (gH_Temperature?.allMembers.filter [ht | ht.name.startsWith(tempName)].head.state > 23 && windowindex != 1){
                        logInfo("DEBUG", "Zimmer " + tempName + " is too hot!")
                        if (rs.state != 100 && gH_Contact_global.members.filter [fk | fk.name == windowName].head.state != OPEN)
                            {
                            windowindex = 1 
                            postUpdate(rs,DOWN)
                            logInfo("DEBUG", "Fahre runter")
                             //sendCommand(rs,80)
                            }
                        }

But as easy, as I drafted in example above with windowindex it isn’t. The variable windowindex need to apply per window, means somehow I need to get the windowName in into the variable name.

Any ideas how I could realize it? I think then the WAF would be met and I could relax within the summer.

Thanks in advance.

Did you find a solution?

This is the part I haven‘t implemented yet. In principle I think what I need to do. My shading positions are never 100% closed. So I could check before I move via rule if a) the last movement was during sunrise (timestamp) and b) it is at 0% to go into sun position or in case the automatic will move up if it is at 78% or whatever the shading position is.
So if a user decides to stop the movement, it will be somewhere in between. Also if it was moved down before. The odds that it is at 78% is quite limited and can live with that.

No, unfortunately not - summer was that hot, that nobody complained to have the shutters closed for shading.

If you find a solution, be so kind and post it here.