In my programm i want to filter my items by groups. But while runtime it could be possible, that some groups could be added to or removed at specific items. And in this case i want to update this specific items in my programm by sending update messages from OH.
So you plan to create groups dynamically in code and attaching items for those groups
If you can code this then you can code the testing of items in groups or not before and after.
I am sorry, I don’t mean to sound difficult, but I tried this approach and it was very cumbersome and difficult to implement in code. I went back to the drawing board and defined my groups and items for all the functionality I required.
There are no limits on the numbers of groups you can create
There are no limits on the numbers of groups an item can belong to
There are no limits on the nesting of groups
With proper planning and naming convention I have all the functionality I require.
I followed my own coding and the following design patterns:
If I understood it right I’m working on the same approach. I use group membership and group trigger to do some actions. If I do not need a special item in the group I just remove it from the group. And I have proxy items which controll group membership. If needed I can provide my solution.
I have a group for door/window contact. This group is checked for changes. If I do not want to monitor one item I just remove it from the group and thats all. Some work must be done to ensure that the group internal handling works well.
Please provide your solution.
I’ve tried to work with group-change trigger like:
Member of MyGroup changed
// give me the triggeringItem.name
The Member is also a Group. I’ve tried also to change the ‘changed’ to ‘received update’ but without success. The rule triggers not, if I remove a Subgroup (Member) of MyGroup from an item.
Could the fact, that I remove the groups via the .items file, is the reason that the rule is not triggering? Or how can i solve it, that the rule is triggering when the Subgroups are added or removed from the items?
I’ve read something about that Groups need an Item Type in order to get triggered. But how can I trigger a Group that contains Items with different Types like Dimmer, Switch and String?