Rule not working properly automatically but working perfect when run manually

Need some help. I have a rule that triggers at sunset, it controls some lights and switches inside which works just fine. It also is set to control lights outside and turn them different colors depending on the dates. When I run the rule manually by clicking on the "run actions" button everything works as expected. When the rule triggers at sunset on its own the lights do not change color. Need to know what I am doing wrong. I have re-created this rule several times hoping to find a solution. Attached is what the rule looks like now. I used the if NOT, I used if AND, If OR and nothing worked.

I'd start with turning on logging for the rule if you haven't already...

Not completely related to your question. But, you might want to change one of the If - Then expressions so they don't have overlapping dates. Not sure what might happen on October 15. Also, what is it going to do between Nov 1 and Nov 30? (My guess is Orange unless you manually change the lights at some point)

I re-created the rule and this is what I have tried in the past but I think the logic was not correct. It seems that this should work. Can someone take a look and let me know what I am doing wrong.

You really should turn on logging so you can see what's happening.

Your first IF should be and AND not an OR.

Because it's an OR, that IF is always true. It's always either not October or not December. When it's not October... it still might be December. See? If those conditions were AND, then it's possible to be neither October nor December.

The other thing you might do is to turn the whole thing upside down, so to speak:

IF between December 1 and December 31 THEN
   do the Christmas stuff
ELSE- IF between October 1 and October 31 THEN
    do the Halloween stuff
ELSE
     do the "normal" stuff
END-IF

Completely aside from RM debugging, it looks like you're trying to build a rule to do what Holiday Lighting was built for. Maybe give it a look and save yourself some work rebuilding everything?

1 Like

Thanks. Did turn on logging and changed the OR to AND. We will see what happens tonight. I will keep you guys posted.

The change did not work. If I run the actions manually it all works great. It doesn't work automatically, which makes me think the rule is set up properly but something is not right with the way the hub runs it for some reason.

Post the logs for your rule so everyone can see what's happening.

Let me know if this works. I ran the rule manually @ 5:51 it ran @ 5:26 on its own at sunset

app:2712022-12-23 05:51:42.907 PMinfoAction: Wait for event: When time is Sunrise(7:29 AM)

app:2712022-12-23 05:51:42.890 PMinfoAction: END-IF

app:2712022-12-23 05:51:42.859 PMinfoAction: END-IF

app:2712022-12-23 05:51:42.855 PMinfoAction: Set color: Driveway Light, Front Door Light Orange Level: 100 (skipped)

app:2712022-12-23 05:51:42.847 PMinfoAction: ELSE-IF (Between October 15 and October 31(F) [FALSE]) THEN (skipping)

app:2712022-12-23 05:51:42.792 PMinfoAction: Set color: Front Door Light Red Level: 100

app:2712022-12-23 05:51:42.725 PMinfoAction: Set color: Driveway Light Green Level: 100

app:2712022-12-23 05:51:42.720 PMinfoAction: IF (Between December 1 and December 31(T) [TRUE]) THEN

app:2712022-12-23 05:51:42.704 PMinfoAction: ELSE (do actions)

app:2712022-12-23 05:51:42.702 PMinfoAction: Color Temperature: Driveway Light, Front Door Light: 6500 -> Level: 100 (skipped)

app:2712022-12-23 05:51:42.697 PMinfoAction: IF (NOTBetween October 15 and October 31(F) AND
NOTBetween December 1 and December 31(T) [FALSE]) THEN (skipping)

app:2712022-12-23 05:51:42.665 PMinfoAction: On: Christmas Tree , Lava Lamp (Command only switches that are off)

app:2712022-12-23 05:51:42.610 PMinfoAction: Dim: Kitchen Light 2, Kitchen Light 3 , Kitchen Light 1: 100

app:2712022-12-23 05:26:00.678 PMinfoAction: Wait for event: When time is Sunrise(7:29 AM)

app:2712022-12-23 05:26:00.640 PMinfoAction: END-IF

app:2712022-12-23 05:26:00.635 PMinfoAction: END-IF

app:2712022-12-23 05:26:00.630 PMinfoAction: Set color: Driveway Light, Front Door Light Orange Level: 100 (skipped)

app:2712022-12-23 05:26:00.625 PMinfoAction: ELSE-IF (Between October 15 and October 31(F) [FALSE]) THEN (skipping)

app:2712022-12-23 05:26:00.574 PMinfoAction: Set color: Front Door Light Red Level: 100

app:2712022-12-23 05:26:00.490 PMinfoAction: Set color: Driveway Light Green Level: 100

app:2712022-12-23 05:26:00.454 PMinfoAction: IF (Between December 1 and December 31(T) [TRUE]) THEN

app:2712022-12-23 05:26:00.436 PMinfoAction: ELSE (do actions)

app:2712022-12-23 05:26:00.433 PMinfoAction: Color Temperature: Driveway Light, Front Door Light: 6500 -> Level: 100 (skipped)

app:2712022-12-23 05:26:00.427 PMinfoAction: IF (NOTBetween October 15 and October 31(F) AND
NOTBetween December 1 and December 31(T) [FALSE]) THEN (skipping)

app:2712022-12-23 05:26:00.323 PMinfoAction: On: Christmas Tree , Lava Lamp (Command only switches that are off)

app:2712022-12-23 05:26:00.211 PMinfoAction: Dim: Kitchen Light 2, Kitchen Light 3 , Kitchen Light 1: 100

app:2712022-12-23 05:26:00.141 PMinfoEvent: Triggered at Certain Time

You really need to post screen prints of logs, not copy/paste. It's too hard to see what's happening. But on the surface it looks like both runs are exactly the same. What isn't working?

1 Like

The part that is not working is that the lights do not change color. They turn on but the driveway light does not change to green and the front door light does not change to red. But if I click the run actions button it works perfectly. Screen Prints below. One from tonight that was run automatically by the hub and the one I ran yesterday manually.
Automatic One

Manual One from yesterday:

Anyone have a solution for this by chance?

The logs say that the light color was changed. What kind of lights are these? How are they connected to your hub? You may be having mesh issues. Have you looked in the device page for the light at the Events tab? Have you looked at the documentation?

3 Likes

I agree, it says they were but the color did not change. Again these work great when I run the actions manually. Both lights are RGB hue lights connected to the hue hub and connected to HE through bridge integration. I would think this is not a mesh issue since everything works fine when triggered manually. Not sure what to look for in the events tab, I have looked at documentation but have not been able to make any headway since. The part that gets me is that everything works as designed when triggered by pushing the "run actions" button but when triggered automatically by sunset, in this instance, the lights to do not change color. With that in mind it seems that the rule machine is the issue. I don't know what the difference is between hitting the "run actions" button and having the rule run at sunset.

a bunch of other stuff could be running at sunset as that is a normal time for that and one of the automations or devices could be spamming the hub thus causing the color change to be missed..

for a test change the time in your rule to sunset-30 and see if it helps

4 Likes

This is a good idea. I had alot of things running at sunset and sometimes something would miss. Separating them by a few minutes seems to work better.

2 Likes

I had one automation with Hue lights that I added a 1 second delay to because otherwise it was hit-or-miss whether or not it would work. There were a bunch of other things going on at the same time. In my setup the Hue integration is pretty solid. But every now and then it can be quirky.

1 Like

I have updated the rule with both a -30 offset for sunset and 1 second delay for both lights. I will update tomorrow.

This worked but not because of the offset, I think. After the rule ran 30 minutes before sunset everything worked correct. Went out a few hours later and found that the lights were back to daylight. Come to find out, the reason this was not working was because of something I had done some time back. turns out that the hue hub was also running a sunset automation and resetting the lights. Thank you all for you time and your suggestions, it led me down the correct path of tracing down my own stupidity and finally got this working corrections. I appreciate it and sorry for wasting your time on my own mistake.

3 Likes