Finally got around to start working on this.
Apparently there is something I am failing to understand when it comes to groups.
In a rule where I have a “Member of gIndoorLight” trigger the group exists and work.
When I try to do gIndoorLight.members.forEach in a cron triggered rule it cannot be found and I get an error saying “The name ‘gIndoorLight’ cannot be resolved to an item or type”.
What am I missing here?
Just to eliminate one error that crops up for some users, restart OH. Sometimes, especially immediately after an update, OH fails to recognize a bunch of Items until the next restart. It seems unlikely that that is the case but we can easily rule it out with a restart.
Watch openhab.log for any errors and report them here.
I don’t see anything obviously wrong with the Rule, assuming your “Updated” Rule actually triggers and runs.
The group is created in the UI, so not using an Item file.
So my guess was that the groups are not created because of the way that cron runs or something.
Will restart, but have done that a bunch of times.
This is when automatic is run, no relevant warnings before this:
2019-12-11 21:20:06.842 [WARN ] [eclipse.smarthome.model.script.light] - System started
2019-12-11 21:20:07.625 [WARN] [eclipse.smarthome.model.script.light] - Automatic executed
2019-12-11 21:20:07.627 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Automatic': The name 'gIndoorLight' cannot be resolved to an item or type; line 36, column 2, length 12
Maybe. Nothing you have shown so far confirms the existence of a group with that name. Have you actually defined it? Linking an Item to group-name is not sufficient.
2019-12-11 21:38:43.231 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'indoor_light.rules', using it anyway:
There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.
That was my first thought, but the Member of gIndoorLight triggered Rule is running and running without error. So the Group does appear to exist. So I’m with Scott, this is really weird.
That could be a symptom. The error means it can’t figure out what type light is in the forEach. That strongly hints that there is something wrong with gIndoorLight. But it works as a trigger and you even get the same error in the Rule triggered by the Group.
Out of ideas, let’s try stuff.
Copy “gIndoorLight” from the Rule trigger and replace the “gIndoorLight” on the forEach line. There is something about it that even at .rules loading time is seen as a problem. Maybe there’s a hidden character or something weird like that going on.
Ok, that solved it.
I created the group in an .items file and it started working.
I did test removing items from the group before and stopped getting updates, so the system seemed to know about the group in the “Member of”,