is there a notation for “not” in rules? Something like:
if (!isWeekend() && !isBankHoliday() && status_vacation.state==OFF) {
// workday
do soemthing
}
I only succeed with this version:
if (isWeekend() || isBankHoliday() || status_vacation.state==ON) {}
else {
// no holiday & no vacation -> workday
do something
}
I’ve tried this with openHAB 2.5 and want to simplify my rules. Any hint or idea?
Hi Markus,
yes I’m looking for a NOR, because if you want the behavior on “free” days, you have to keep in mind that you can have three different reasons. Of course it would be possible to use multiple if or an else. But I like it the stylish way
And thanks for your tip, which helped!. But if you have to take the complete parenthesis in brackets, then it works. means:
if (!(isWeekend() || isBankHoliday() || status_vacation.state==ON) )
{ // do your stuff
}
Thanks! I had not tested the formula and failed to mention that. Glad you figured it out.
By the way, if you format your post with code fences it makes for much easier reading: How to use code fences