nyholm
(Robert Nyholm)
June 25, 2020, 6:50pm
1
How can I Update the State of a Group Member?
Based on some condition I want to update the member state. I’ve tried the following without success:
My code looks something like this
ggSummary?.members.forEach[ mysummary0|
if (…) {
mysummary0 = MyString
mysummary0.state = MyString
postUpdate.mysummary0(MyString)
postUpdate.mysummary0.state(MyString)
}
]
Your help is much appreciated.
rlkoshak
(Rich Koshak)
June 25, 2020, 6:58pm
2
It kind of looks like you are just trying random syntax to see what might works. When ever you have a question like this you should always refer to the docs first. In this case, https://www.openhab.org/docs/configuration/rules-dsl.html#manipulating-item-states .
None of those four lines are valid.
nyholm
(Robert Nyholm)
June 25, 2020, 7:47pm
3
I can’t find anything in the documentation that tells me what does work. This is sort of indirect addressing.
rlkoshak
(Rich Koshak)
June 25, 2020, 7:52pm
4
A member of a Group is an Item. The docs say
MyItem.postUpdate(<new_state>)
- Change the status of an Item without causing any implicit actions. Can be used to reflect changes that may be caused by other means.
So the code that will work is
mysummary0.postUpdate(MyString)
1 Like
nyholm
(Robert Nyholm)
June 25, 2020, 7:55pm
5
I thought I tried that but i see had syntax issue with the cart before the horse!
Thank you again.
system
(system)
Closed
August 6, 2020, 11:55am
6
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.