OH3 Rule lambda doesnt work anymore because of strange item

  • Platform information:
    • Hardware: intel nuc
    • OS: ubuntu 16
    • Java Runtime Environment: openjdk version “11.0.12” 2021-07-20 LTS
    • openHAB version: 3.1

The following error shows in openhab.log

2021-08-17 20:42:51.671 [INFO ] [nhab.core.model.script.shutterlambda] - processing Group member EG_Windfang_Spots
2021-08-17 20:42:51.671 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'shutter-2' failed: Could not cast OFF to java.lang.Number; line 123, column 29, length 21 in shutter

the function is following but has definitive no “EG_Windfang_Spots” item in. Also the group of the rollershutters doesnt belong to the item…

                        if (blind === null) {
                                logInfo("shutterlambda", "Group member returned null")
                            } else {
                                logInfo("shutterlambda", "processing Group member " + blind.name)}
                       
                 --> line 123      if ((blind.state as Number) == targetHights.get(blind.name.toString()).intValue) {
                            logInfo("rules", logPrefix + "Oeffne Rollladen: " + blind.name.toString())
                            blind.sendCommand(UP)

the whole rule/function is here:

val shadingEnd = [GroupItem shutter |

        val String logPrefix = "Verschattung deaktivieren - "

                    val Map<String, Number> targetHights = newHashMap ( 
                        "EG_Arbeitszimmer_Ost" -> 75,
                        "EG_Arbeitszimmer_Sued" -> 75,
                        "EG_Jalousie_Essen_Tuere_West" -> 100,
                        "EG_Jalousie_Schiebetuere_rechts_Sued" -> 100,
                        "EG_Jalousie_Schiebetuere_Sued" -> 100,
                        //"EG_Jalousie_Essen_Tuere_West_Lamellen"-> 75,
                        //"EG_Jalousie_Schiebetuere_rechts_Sued_Lamellen"-> 75,
                        //"EG_Jalousie_Schiebetuere_Sued_Lamellen"-> 75, 
                        "EG_Fenster_West" -> 75,
                        "EG_Tuere_Kueche" -> 75,
                        "OG_Ankleide" -> 75,
                        "OG_Elternschlafen_West" -> 75,
                        "OG_Elternschlafen_Sued" -> 75,
                        "OG_Kinderbad" -> 75,
                        "OG_Kind1_Sued" -> 75,
                        "OG_Kind1_Ost" -> 75,
                        "OG_Kind2_Ost" -> 75,
                        "KG_Hobbyraum_Abstellraum" -> 75
                     )
                    // Rollladen öffnen
                    logInfo("rules", logPrefix + "Rollladen werden geoeffnet")

                    shutter.allMembers.forEach[ blind |

                        if (blind === null) {
                                logInfo("shutterlambda", "Group member returned null")
                            } else {
                                logInfo("shutterlambda", "processing Group member " + blind.name)}
                       
                       if ((blind.state as Number) == targetHights.get(blind.name.toString()).intValue) {
                            logInfo("rules", logPrefix + "Oeffne Rollladen: " + blind.name.toString())
                            blind.sendCommand(UP)
                            //Pushnachricht versenden                        
                            //sendPushoverMessage(pushoverBuilder("Verschattung für (" + blind.name.toString() + ") beendet, Rollladen wird geöffnet."))
                        } else {
                            logInfo("rules", logPrefix + "Rollladen: (" + blind.name.toString() + ") wird nicht geoeffnet, da dieser zwischenzeitlich manuell verändert wurde.")
                        }    
                    ]                         
                    // Letzte Ausführung mit entsprechendem Zeitstempel belegen
                    AutoShading_End_last.postUpdate(ZonedDateTime.now.toLocalDateTime.toString())
                    

                    //Variablen zurücksetzen
                    isActiveWest = false
                    isActiveEast = false
                    isActiveSouth = false
    return true;
]

its strange can you find something? Where does the EG_Windfang_Spots comes from? I can also post the items, things if required.

Thanks alot and BG

Maybe you’ are calling your lambda with a Group that you didn’t expect (the ‘shutter’ in your lambda).

I want to open the shutters but there is no item in the group like in the .log. Where does "EG_Windfang_Spots” come from?

Why not log out shutter.name to begin with, confirm what Group you are dealing with. That Group thinks it has a member Item EG_Windfang_Spots

logInfo(“rules”, logPrefix + shutter.name ) ? is this correct?

Well, you’re already using logInfo() elsewhere in your rule so that part shouldn’t be difficult. yourItemReference.name gives you a string on the Item/Group name, again you’re already using that.
This is just because you are getting a member Item that you don’t expect, it would be smart to know exactly what it is supposed to a member of.