Check for specific months in IF condition


#1

Hi all - I want to have an IF condition that has condition 1 which I already know how to do and as condition 2 I want to see if it is currently the month of Nov, Dec, Jan, Feb, Mar, or Apr:

Like this:
IF condition 1 is True AND CurrentMonth in (1,2,3,4,11,12) then XYZ

How can I do this? Thank you.


#2

Try…
image


#3

Great, thanks so much!


#4

I have a question about something like this. Is it better off being written

IF {$month} is any of 1,2,3,4,11,12 then
IF condition X is True

So that it doesn’t even bother trying to check any other conditions unless you’re in one of the desired months?
Or is that already the case with the AND statement?

In line with some of the issues I’ve seen others having trying to run Webcore in Hubitat, if I were going to go that route I would want to reduce system memory/processing costs as much as possible. So we have three ways to write that If block:

IF {$month} is any of 1,2,3,4,11,12 AND condition X is True

IF {$month} is any of 1,2,3,4,11,12 then
IF condition X is True

IF condition X is True then
IF {$month} is any of 1,2,3,4,11,12

Which consumes the lowest system overhead while obtaining the desired result?


#5

I’d be tempted to try and use it in the restriction if possible.
image

Not sure about overhead system overhead impact though. In my head I think it’s a good thing since you’re stopping processing even before other conditions are evaluated.


Am I missing something