I’m currently trying to create a rule that checks if the sun is shining on windows and it should be shaded.
Therefore I created some groups
// Overall Group Group:Switch Fenster_Sonne // One group for each angle of windows Group:Switch Fenster_Sonne_110 (Fenster_Sonne) Group:Switch Fenster_Sonne_200 (Fenster_Sonne)
My plan was to iterate over Fenster_Sonne and get the angle from the seperate subgroups-name (e.g. 110 and 200). This is working so far.
Unfortunately I’m not able to iterate over the sub group to update the switch items which are part of it because of the following error:
2019-10-09 14:15:11.268 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule 'Sonne scheint auf Fenster': 'members' is not a member of 'org.eclipse.smarthome.core.items.Item'; line 30, column 3, length 16
This is my rule:
rule "Sonne scheint auf Fenster" when System started or Item Sonne_Azimuth changed then val azimuth = (Sonne_Azimuth.state as QuantityType<Number>).doubleValue Fenster_Sonne.members.forEach[grpItem | val direction = Double.parseDouble(grpItem.name.split("_").get(2)) var new_state = OFF logInfo("fenster.rules", grpItem.name) if (azimuth > direction) new_state = ON grpItem?.members.forEach[item | item.postUpdate(new_state)] ] end
The error is caused by
grpItem?.members.forEach[item | item.postUpdate(new_state)]
Am I missing something or is it not possible to iterate over nested groups?