Rule Machine 4.0 Christmas Lights

Hello everyone, first post here so please go easy on me. I am trying to set up a rule to run my outside Christmas lights. I want it to run between 2 dates ( 1 December to 6 January) and to switch the lights on at 45 minutes before sunset and off at 23:30. I have it partially working at the moment (It switches on) but it will not switch the lights off.

Any ideas, this is my first attempt at a rule, I have only had the Hubitat for a month.

Hopefully I have attached a screen shot of the rule, if there is any more information you need please let me know.

Thanks, Jon.

Trigger OK

IF time is sunset-45
On christmas lights
elseif time is 2330
off christmas lights
endif

1 Like

The above would definitely work (assuming you aren't experiencing any slowdowns that would cause the actions to not run within the minute that the trigger fires). But if you don't have a reason to use Rule Machine, this could easily be handled by two Simple Lighting automations: one that turns them on at sunset-45, and another that turns them off at 11:30 PM. (Two very simple rules in Rule Machine would also work: one for each of your triggers, with the actions section consisting only of the "on" or "off" action you want to happen at that time.)

If you're trying to learn Rule Machine, this is not a bad place to start. I would recommend reading the docs to see some examples. If you aren't trying to learn Rule Machine, using it is way overkill for the task at hand. :slight_smile:

Hi Razorwing, thanks for getting back to me so quickly but I can't see anywhere to put that text in.

Sorry for being a bit thick.

Jon.

Welcome to the Hubitat Community!

Further to what @razorwing posted, if you want to limit by date, this will work. It's not nessecary to evaluate again before off, since that will be done at 45 min before Sunset and at 11:30 PM. If the time is Sunset -45, and the date is between December 1 and January 6, then the lights will turn on, but if it's not either of those and it is 11:30 PM, then they are going to turn off. So you can just use ELSE in this case.

1 Like

Hi I think 2 rules are probable easier for some reason I can't seem to edit the rule I have created. So I'll try the 2 rules way. the reason I want it in rule machine is because we are away from just after Christmas until the middle of january and I don't want out lights still running after the 6th.

Jon

You should be able to edit any rule. The trick is that since you've already added actions, to get the IFs and things suggested above, you'll have to use the options like "Insert action before". You can't re-order actions after they've been added, only delete and add new ones elsewhere (before another or at the end)--a limit to the app UI model Hubitat inherited from a certain other platform many of us migrated from. :slight_smile:

Starting a new rule and creating it as above would also work. You could also manually disable your app, including the Simple Lighting automations, rather than automating the dates, though I do like the idea of automating that, which would probably be most easily done with RM (or you can delete it and re-create it next year--I'm trying not to do that this year, but I can't guarantee I won't totally re-do any of my hubs before then...).

@jon.d.tyler I think I was a little vague in my answer and I missed the dates. So SmartHomePrimer's is the way to go.
If you wanted to break it down so you can maybe understand it better then you could do this. This is the long version and maybe once you understand this then SmartHomePrimer's will be shorter but do the same thing.

IF time is sunset-45 and
between dec 1 and january 6 then
on christmas lights

elseif time is 1130 and
between dec 1 and january 6 then
off christmas lights

endif

OR

2 IF statements within the same rule.

IF time is sunset-45 and
between dec 1 and january 6 then
on christmas lights
endif

IF time is 1130 and
between dec 1 and january 6 then
off christmas lights
endif

So just to clarify, the original problem is that for either of those two times, I think the rule machine will turn the light off and then back on again. You need either the two separate rules of the if/else clause in the action.

I'll have to do this for my nightlight (still learning too). Unfortunately, some of the Christmas lights are on WiFi outlets which the Hubitat can't deal with, so I have to leave it to Alexa.

You can obviously just handle the timing from Alexa, but if you want to setup the rule logic from HE, you can. You simply need to create a virtual motion sensor that is trigged when a switch is turned on. Then share that with Alexa. When that motion is triggerd, you have an Alexa routine operate the WiFi device.

Use this code for motion sensor as a switch

Oh HO! Thank you! Alexa has seen virtual switches, but not to read only to change I think. This is a good tip. I'll try it since I WOULD like to keep everything together. I've also read about hacking WiFi outlets so I would have have to go through the outlet's web server. I'd really like to do that, but for now insufficient time and the wrong brand of outlet.

1 Like

Hi guys, thanks for all the advice I'm giving up for the night I just can't seem to get it to work properly all the drop down menus just confuse me I think it would be a lot simpler if I could input what I want as a text file or something.

I'll just get the house sitter to go into the garage on the 6th and unplug the lights, a bit rubbish but I know it works.

Thanks again.

Jon.

Your action needs to be "Conditional Actions", then you can input the condition after IF and then the action that will take place after THEN

Here's a step by step (granted, it's a lot of steps for such a simple rule, but that's the way conditional actions in RM 4 are handled). It's not hard, but it does involve more clicks than I would prefer.

Step 1.
11%20PM
Step 2.


Step 3.

Step 4.

Step 5.

Step 6.

Step 7.

Step 8.

Step 9.

Step 10.

Step 11.

Step 12.

Step 13.
33%20PM
Step 14.

Step 15.

Step 16.

Step 17.

Step 18.

Step 19.

Step 20.

Step 21.

Step 22.

Step 23.

Step 24.

Step 25.

Step 26.

Step 27.

5 Likes

@SmartHomePrimer Great job! This is how I have always imagined helping someone who is new to Hubitat. We need to carry on this method.

3 Likes

Thanks. It is a lot of work to setup and keep all the screen shots straight though. And the numbering got really screwed up. Maybe I should have put a return between lines? :thinking:

I'd like to help everyone this way, but it's often much more complex. This is a very simple rule, so generating and posting more than 27 screenshots isn't going to work. It's an unnecessary amount of images for Hubitat to host as well if we were to do this often.

Not sure what the best solution is, but I'm not convinced I've found it. :wink:

Granted it would have to be a simple rule but that is usually what they are for the guy who is a real beginner. Anything more than that I agree would be too much. Teaching them the basics by showing as many steps as you can, most times, can be an 'ah ha' moment for them.

1 Like

Thanks that’s amazing I’ll give it a go tomorrow. I’ll let you know how I get on.

Once again thanks to everyone here.

Jon.

1 Like

Very impressive! And thanks again for the hint about the motion/switch driver. I did have to modify it slightly (or at least that made it easier) but removing the action to stop seeing motion after a few seconds. By doing it that way, I can just set up two routines in Alexa, one triggered by motion to turn of lights on and one triggered by no motion to turn them off.

1 Like

Thanks very much for showing me the way with the new rule machine automation.

Does using PREDICATE CONDITION help any if I chose that for performing this rule between two dates?

1 Like

Can anyone please help me understand why my rule is NOT firing? I thought I copied what this thread showed but as you can see both conditions are true and my lights are yet to be turned on. What am I missing or have done wrong here?

Download the Hubitat app