I have the following problem. I am using openhab2 with the knx2 binding and I have some items to define states to control my house (e.g. summer on or off/night on or off/windows open or closed). I want to send these states periodically to the knx bus. My first thought was to define a group to put all knx items who should be send periodically to the bus together. But I have no idea how to request the actual state of the group members and send them again to the bus inside a rule.
Can anybody help me and give me a hint?
Thank you Rick, works, but i have one new problem I don’t understand.
The states seem to be send in the log, but I don’t recieve these commands on my knx bus.
Under normal operation my knx system is working with openhab. From my understanding sendCommand should do the job like I thought.
Any hints?
The rule:
rule “test”
when
Time cron “0 4/1 * * * ? *”
then
gKNX_zyk.members.forEach[ i | i.sendCommand(i.state) ]
end
I need your help again. Since a few weeks (sorry I don’t know exactly the date or the change I made) I get the following error in my karaf log:
Rule 'test': Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(org.eclipse.smarthome.core.items.Item,java.lang.String) on instance: null
First I thought hat one of the group members has the state " null", but this was not the matter.
I did not change any thing on the rule.
Assuming the Rule is unchanged from the above, add some logging statements to the forEach to log out i.name and i.state before sending the command. This will hopefully tell us which Item is causing the problem and why.
Indeed, if the item’s state is NULL or UNDEF I would expect to see that error. You can filter those out by changing the loop to:
gKNX_zyk.members.filter[ i | i != NULL && i != UNDEF].forEach[ i | i.sendCommand(i.state) ]