ELK after sunset rules

RobNJ

Member
So I am going a little crazy trying to understand how the sunset/sunrise rules work. I have no problem with the relative time of day rules working.

When I use a sunset rule to have an event (i.e.turn light on when not secure) the rule runs even during the day time.

If I wanted a light to turn on after sunset, wouldnt I just use: When the time is later than Sunset or
When the time is equal to Sunset?

Why then does this still run during the day?

I even added a 2nd "and" of before 6:00AM thinking it had to be bounded by a time frame. But, this stopped the rule from working at all.

What am I missing?

Thanks!
 
howdy,
you need to create an another rule to turn the light off. once its turned on it stays on untill it is told to turn off.
 
The first line of the rule is the Trigger. So you should be able to write a rule:

WHENEVER SUNSET
AND (other Conditions)
THEN Turn Light x On

And it should only trigger once. Now if you have other rules, with a time as the secondary AND conditions they may trigger as well. I have Sunrise/Sunset lighting rules written like above and they only run once.

If you are writing rules with the Sunset/Sunrise for the AND condition I would use IS DARK OUTSIDE and IS LIGHT OUTSIDE instead. Before 6am is not consider after Sunset that is why your rule never runs, it is consider before sunset (of the next day). You would probably need to write two rules to cover it if you want so use the Sunset/Sunrise without IS DARK/IS LIGHT. There is no OR, writing multiple rules, is the equivalent of OR which is common in PLC programming. But you are correct, it really shouldn't run during the day with the AFTER SUNSET by itself since the clock should "reset" the next day. It is quirky.

i.e.

WHENEVER (Trigger)
AND AFTER SUNSET
AND BEFORE MIDNIGHT
THEN Turn Light x On

WHENEVER (Trigger)
AND BEFORE 6AM
THEN Turn Light x On
 
Thanks for the replies.
I am using the sunset variable in the "and" portion of the rule, maybe that is my problem.
I will flip that around tonight when I get home and see how it works. To me it shouldn't matter, but we will see.
 
The order is very important - the first item is the trigger... the And specifies additional conditions. For example:
Code:
Whenever Sunset AND Front Door is not secure then XXXXXXX
is very different from
Code:
Whenever Front Door becomes Not Secure AND Sunset THEN xxxxxxxx
The first one would only fire one time when the Sunset time occurs -- it'll see if the front door is secure - if it is, it won't execute the action; if it's not, it will.

The second one will fire every time the front door opens and will check to see if it's sunset or past; if so, it'll execute, otherwise it won't.

The Elk always needs a definitive trigger which will cause it to check other conditions then fire off an action. If you are trying to do something that doesn't have an associated trigger, like reacting to temperature or something like that, you have to use a time-based trigger - such as Every 60 seconds AND outdoor temperature < indoor temperature THEN set cooling mode off THEN announce "Open the windows!"

Also, for many functions, the "is dark" function is better than "sunset" - depending on what you're trying to accomplish.
 
Thanks Work2Play, a light bulb just went on in my head about how this works now.
I tried 2 different approaches last night and one had success. It was to use the "is dark" as an "and" function.
I should be good now.
 
Just when I thought I had this working, Last night I swear it worked, tonight it doesnt. The bizzare thing is that it works when I set it to "light outside". The time is set correct. I set it again from my PC just to make sure. This is what I have that does not work.

WHENEVER Front Door (Zn 1) BECOMES NOT SECURE
AND IT IS DARK OUTSIDE
THEN TURN Front Light [34 (C2)] ON FOR 1 MIN
 
Make sure your location longitude and latitude are correct or the Elk won't be using the right times for sunrise and sunset.

Also, i thought I remembered reading somewhere that "Dark "Outside" was some variable (plus or minus 30 minutes) before or after actual sunset time, but I couldn't find the thread. If so that might affect your triggers. Maybe some one else can chime in on that.
 
:hesaid:

For the front door rule, there's a magic time of day where I'd expect it to turn on the front light, but it doesn't.

In my case that's fine for outside lights because they turn on automatically 30 minutes before sunset; but I also have rules about when it's dark outside and I open the front door, light a path through the house - and noticed if I come home during that bewitching hour, it doesn't kick on though I think it should.

A workaround to this that gives you more control - pick an output and use that....
Whenever 45 minutes before sunset, turn on output 100; whenever sunrise, turn off output 100.
Then change your rule to reference that output instead. There's a catch - if the system resets during that time period, it'll be off until the next day... there are workarounds for that too, but my system never resets, so it's fine.
 
I have never had an issue with IS DARK OUTSIDE, but I admittedly did move all my lighting rules to the ISY recently. All of my issues were with the unreliability of Insteon. Maybe add a email/log/voice entry to the rule to let you know it ran and verify it isn't just your lighting command that is failing.
 
Just when I thought I had this working, Last night I swear it worked, tonight it doesnt. The bizzare thing is that it works when I set it to "light outside". The time is set correct. I set it again from my PC just to make sure. This is what I have that does not work.

WHENEVER Front Door (Zn 1) BECOMES NOT SECURE
AND IT IS DARK OUTSIDE
THEN TURN Front Light [34 (C2)] ON FOR 1 MIN

This rule is supposed to work. however, I have written the exact same rule multiple times for multiple doors and some of them work and some of them don't. I spoke with Elk about it several years ago and they said there was some bug and that I should do work2play said about turning an output on and then writing a second rule that says:

Whenever output xxx turns on
Then turn light on

Also, what kind of lights are using.. . it could be a comm issue with the lights.
 
Update on this one as I was on vacation.
My time zone was set correctly. I did not take notice of the values, but I did do another "calculate" for the sunrise/sunset and after saving, now it appears that dark and light are ok. At least for today.....will see if this changes again.
 
Back
Top