Is there a way to create a rule to define a variable to indicate which scene to turn on based on a date and then from a separate rule call that variable to turn on the scene without having to recreate the if statements to define the date periods?
Rule 1
If A set variable to "Christmas"
or if B set variable to "New Years"
Rule 2
At Sunset turn on Variable (which would be either Christmas of New Years scene)
It needs to be two rules because as part of Rule 1 I am also setting a Automation switch to ON so other automation don't run.
I have it working but basically repeated the if statements in both Rule 1 and 2 and was trying to see if I can somehow just define it in Rule 1 to determine which scene to execute in Rule 2 without recreating the If statements
Yes, you can create a Global Variable string and easily set it using a rule based on dates, all in Rule Machine. I use a simpler "on vacation" type of boolean. But I like the idea of an overall one like that so I could switch my Halloween set to my Christmas set, etc...
Select the Create, Set or Delete Global Variables table.
Select the "Add Another Global Variable" button.
Enter a name for the new variable (since I want something similar I am naming mine "Time Of Year").
Once the name is entered, hit the Enter button or click on a blank space (do not navigate away from the page) to get the field for "Variable Type for X Name" dropdown.
Select the type, I am figuring on String.
Set initial value of the string. I set mine to Normal (not sure all the possibles, but will definitely have things like Vacation, Halloween, Christmas...).
Select somewhere and you can see the variable added to the table. From there you can just use it in your Rules to configure it how you want. Or to check on it as a condition for other Rules.