Hey Peeps,
Out of curiosity, is there a way to set a DATE restriction where you don’t have to enter the year? I want my Xmas piston to only run Nov 25 to Jan 1, no matter what the year.
Suggestions welcomed.
Hey Peeps,
Out of curiosity, is there a way to set a DATE restriction where you don’t have to enter the year? I want my Xmas piston to only run Nov 25 to Jan 1, no matter what the year.
Suggestions welcomed.
Rather than using a restriction, you could use an if
after the every
statement and use
{int(formatDateTime($now, 'MMdd'})) greater than or equal to 1125
If you also want to run it on January first (not sure whether it was inclusive), you would have to add
OR {int(formatDateTime($now, 'MMdd'))} equal to 101
EDIT: you actually can use this in an expression as well - here’s your piston reworked (I used "less than or equal for the January 1st so it is easier to adjust if people want to add a few more days… Also, I don’t have an RGB bulb so it changed that entry to Dimmer 1
)
Here’s a similar question, same basic idea as @ahndee’s answer but a bit more readable. Note that with either of these solutions your BETWEEN will need to OR together two conditions like @ahndee showed to handle dates up to Dec 31 and then dates following Jan 1 (reasons described in the other thread).
Eh, not really more readable… the benefit to ahndee’s is that it doesn’t require a BETWEEN at all so you don’t have to worry about representing December 31 and January 1 since the less than or equal takes care of that.
You’ll just need OR rather than AND, otherwise you could do one condition for NOT BETWEEN Jan 3 and Nov 24
This was timely as I’d rebuilt what I’d had in CoRE in webCoRE and was having some issues. Here’s what I came up with: