Issue of the topic: I need a rule, where openhab switches the item “relay8” OFF, when item io1 and io2 are both OFF. I tried so many ways but I don’t figure it out how that simple rule sould work…
Important for me is that the rule checks the states and don’t waits for an event of both things…
Can you help me or send me a sample rule for that?
p.s: i read many of the articles in here…
rule "simple switch check"
when
Item io1 changed or
Item io2 changed
then
if (io1.state == OFF && io2.state == OFF) {
relay8.sendCommand(OFF)
}
end
The rule will trigger everytime io1 or io2 changes
Then the rule checks if the state (.state) of io1 AND (&&) the state (.state) of io2 are both EQUAL (==) to OFF
Then if that condition is true then rule will send an OFF command (.sendCommand(OFF)) to relay8
You need to start reading the documentation…
I gave you the rule snippet as an example but we are not here to write code for you.
You need to read the docs and have a go a it. If your code doesn’t work, read the docs again. If it still doesn’t work look in the forum. And then ask for help.