Hi there,
I always had a problem that my group items states derived from member items had been delayed a lot. This made all my rules very complicated.
As this problem was getting a lot worse since I switched to OH4 I found some workarounds.
I don’t like them because they use way more calculating power but they work and they may help others:
Instead of working in rule directly with the group item im know checking all the members of this group items:
Code Examples: JavaScript Scripting (ECMAScript 2022+)
The delayed version which sadly doesn’t work always:
if (items.getItem("groupitem").state === "OPEN") {
// do something
}
My solution:
if (items.getItem("groupitem").members.find(item => item.state === "OPEN") ) {
// do something
}
Or as a trigger vor a rule:
The delayed version which sadly doesn’t work always:
triggers.ItemStateChangeTrigger(groupItem)
My solution:
triggers.GroupStateChangeTrigger("groupItem)
The concept is always to check the childs directly even if the functionaly is not even needed.
I really hope there will be a solution in the future that deriving the Group States from Member Items is not so delayed anymore.