greetings everyone, thank you for all the help you’ve given me so far.
On my old home automation system I had the ability to switch modes such as normal mode, and holiday mode.
During holiday mode I would not have my outdoor lighting on when my holiday lights are on and once my holiday lighting went off at midnight my normal outdoor lights would come back on but this behavior only happen when my home control system was in holiday mode.
How can I accomplish the same thing with hubitat?
normal mode runs from Jan 2nd to November 15th
holiday mode runs from November 16th to Jan 1 midnight
I want to make it so that the hub switches moods automatically.
The benefit to this is I can set all my Christmas lights up on the first weekend of November and on November 16 they will start to run automatically up until January 2.
There are many ways you could accomplish this, though I'm not sure using modes is exactly what I'd recommend. It certainly can work, but most people use modes to reflect time of day, home/away, or some combination of the two. That being said, it's ultimately just a hub-wide string variable you can set to whatever you want to via whatever means you want to (just many of the built-in options for doing so like Mode Manager are geared towards this, and many apps that use modes like Motion Lighting or even Rule Machine actions seem to have this use case in mind).
What you might want to do instead is use a hub variable. This can be configured in Settings > Hub Variables. For a simple on/off thing like Holiday Mode vs. "normal," you could make a single Boolean variable called something like Holiday Mode, then establish that true/on = Holiday Mode and false/off = normal mode. This can be easily switched with a rule or two. This variable can then be used in rules and other apps to restrict or modify your automations as needed (Rule Machine would give you the most flexibility, though an increasing number of other apps can also make use of hub variables).
That's the general idea, at least -- or the particular direction I'd go. There are lots of possibilities (you could forego the idea of a variable and just use a virtual switch to track this instead, for example). If you need more specific guidance or have preferences about which way you want to go and need more help, feel free to ask!
You do not need a required expression, which mostly affects whether a rule triggers but doesn't cause anything on its own (in most cases, some new cancelation features excepted). Even Rule Machine itself may be overkill, though it should work. If you're using a switch instead of a variable (or have a switch connector created for your variable), Basic Rule would work.
But for a simple Rule Machine solution: consider creating two rules, one triggered on your start date and the other on your end date. Then, in your actions, set the variable (or switch or mode or whatever) to the appropriate value.
My bad...that was me assuming Basic Rule could handle date triggers without really looking. So, two Rule Machine rules like I ended up suggesting might really be the best way. That screenshot is Basic Rule, not Rule Machine, by the way, so we are referring to a different app for this other scenario.
Sort of. The trigger looks good. There is no need to manage or create conditions (those are for using in conditional actions and other places you can use expressions--not needed here). Just go straight to actions and add an action to set your variable, mode, switch, or however you are implementing this in your system. Should be doable in just a single action.
Be sure to hit Done or Install Rule when you're finished.
okay i got that part. i am still way lost on how to make a rule that will utilize it.
this mode will literally change the way the outdoor lights will behave when holiday mode is active.
right now the outside lights come on 40 mins before sunset. when holiday. mode is utilized, the Christmas lights will come on at sunset and at midnight, they will turn off and the outside light will come on until sunrise
That is up to you. You will have to write a rule that checks the mode (or variable or switch or however you implemented this), perhaps with conditional actions, or maybe two entirely different rules with a required expression--just some way to make different things happen depending on this. Or find some app that uses modes (or, again, whatever your solution is) in this way (though that is less likely if you're using modes since this kind of use isn't what most apps have in mind for those).
In your example above, you could make two rules. One triggers at sunset, one triggers at sunset-40. One has a required expression of Mode is Holiday, the other has a required expression of Mode is Normal (or NOT Mode is Holiday if you have multiple others modes, or whatever logic you need). Your actions, in either case, would turn on whatever lights. A required expression prevents a rule from triggering if the action is false.
Another method: one rule that triggers at sunset-40. Then a simple conditional action like IF (Mode is Holiday) Wait for events: Elapsed time --> 0:40:00. Then, turn on the lights. This will effectively delay things 40 minutes if you're in holiday mode, otherwise proceed immediately.
For turning off, you can use a second or third rule triggered at midnight (easy), again with a required expression, plus another rule for the other time of year. Or one rule with a wait if you're in holiday mode. Or, you could also add a "IF (Mode is Normal) THEN Wait for event: time is 12:00 AM / ELSE Wait for event: Time is Sunrise / END-IF" (a "full" conditonal action), and "Off: Lights" action to any rule above.
...and those are just a few of the nearly infinte possibilities.
@bertabcd1234 Thank you again, you have always supported me as I learn..
So I know this is going to spark a heated debate but so I do not have multiple rules is this idea possible....
(Please forgive me as I am not even close to a programmer)
/////////////////
If holiday mode is active, and the time is sunset -20 minutes
Turn Christmas lights on
else
If holiday mode is not active, and the time is sunset -40 minutes
Turn outdoor lights on
\\\\\\\\
If this is possible, I just have to figure out how to build it in HE..
There is nothing wrong with having multiple rules, and multiple simple rules are generally easier to maintain than one large rule. So I wouldn't pursue that goal for any inherent reason. But in this case, I think such a rule would still be pretty simple. Maybe something like:
Trigger: Time is sunset-40 minutes
Actions to run:
IF (Mode is Holiday) THEN
Wait for event: elapsed time --> 0:20:00
On: Christmas Lights
ELSE
On: Outdoor Lights
END-IF
This is using a bit of a timing trick, that sunset-40 plus a 20 minute wait is the same as sunset-20. If I got the math wrong or your modes reversed, just fix my logic.
They don't matter, except that you definitely can't get rid of one because you're using it. They don't do anything on their own; as the text above hints at, it's basically a bank of conditions you can use (or are using somewhere, like you are in that IF), and it provides a single place you can edit them without needing to edit or recreate the action, but just having something there has no effect on its own.
Not exactly. An IF does not create an event subscription. The IF line will be evaluated at the point in the rule when it was reached, then execution will proceed in accordance with your logic. A trigger event (or, probably less commonly, running the actions from another rule) is necessary to get your actions to start running in the first place.
The easiest way to do this is probably two different rules, each triggered on a specific day/time, that sets your mode, though as usual with Hubitat, there are a variety of ways you can do the same thing. If you don't already have something set up for this, that is what I would recommend.