[SOLVED] restricting lights from a certain hour
-
@gwp1 before you change anything, do this: archive your entire "storage" subdirectory (ZIP) and send it to me.
@toggledbits Done.
-
The rule "Sunset Lights: On" is the one that triggered at 05:30 and ran the "Rainstorm Lights ON" reaction. It did that because "Day" is an acceptable mode in its first condition (but "Night" is not listed and so this condition was false before), and at the moment apparently 05:30 is before sunrise, so the second condition was also met.
-
The rule "Sunset Lights: On" is the one that triggered at 05:30 and ran the "Rainstorm Lights ON" reaction. It did that because "Day" is an acceptable mode in its first condition (but "Night" is not listed and so this condition was false before), and at the moment apparently 05:30 is before sunrise, so the second condition was also met.
@toggledbits Talking this thru...
Ruleset "Sunset Lights: On" should have run at sunset 20:29 (local sunset time on Friday 06/11/2021). It should include two Reactions, "Sunset Light Group On" and "Rainstorm Lights On" (done this way to prevent race condition/overlap if the same lamps were included in both reactions as well as prevent a gap at sunset when I'd have to turn off "Rainstorm Lights: On" lamps one minute before sunset kicks in.) I don't know why "Sunset Lights: On" would have run at 05:30 as it shouldn't be driven by mode but only by
sunset/sunrise
.Day would be an acceptable mode for ruleset "Rainstorm Lights: On" because, well, that's basically the point - we need these lights during the day as a storm has made it very dark during non-traditional times. I would expect "Rainstorm Lights: On" to run at 05:30 when mode switches to Day - but that's the reason for the
after <time>
conditions/constraints - to prevent it from taking action until after those time stops.EDIT: Ok, looking harder at that last half a sentence you wrote: "05:30 is before sunrise so the second condition was also met" - that would explain why "Sunset Lights: On" ran which would explain why Reaction "Rainstorm Lights On" ran. Since that reaction doesn't have the constraints, it seems that's overriding the ruleset "Rainstorm Lights: On" ?
-
@toggledbits Talking this thru...
Ruleset "Sunset Lights: On" should have run at sunset 20:29 (local sunset time on Friday 06/11/2021). It should include two Reactions, "Sunset Light Group On" and "Rainstorm Lights On" (done this way to prevent race condition/overlap if the same lamps were included in both reactions as well as prevent a gap at sunset when I'd have to turn off "Rainstorm Lights: On" lamps one minute before sunset kicks in.) I don't know why "Sunset Lights: On" would have run at 05:30 as it shouldn't be driven by mode but only by
sunset/sunrise
.Day would be an acceptable mode for ruleset "Rainstorm Lights: On" because, well, that's basically the point - we need these lights during the day as a storm has made it very dark during non-traditional times. I would expect "Rainstorm Lights: On" to run at 05:30 when mode switches to Day - but that's the reason for the
after <time>
conditions/constraints - to prevent it from taking action until after those time stops.EDIT: Ok, looking harder at that last half a sentence you wrote: "05:30 is before sunrise so the second condition was also met" - that would explain why "Sunset Lights: On" ran which would explain why Reaction "Rainstorm Lights On" ran. Since that reaction doesn't have the constraints, it seems that's overriding the ruleset "Rainstorm Lights: On" ?
@gwp1 Thinking further...
Removing the Reaction "Rainstorm Lights On" from this ruleset of "Sunset Lights: On" because it's redundant - let ruleset "Rainstorm Lights: On" handle the heavy lifting all on it's own.
You can reference the ruleset from earlier images, this is the
Set Reaction
Reset Reaction
to that ruleset.
-
@toggledbits Talking this thru...
Ruleset "Sunset Lights: On" should have run at sunset 20:29 (local sunset time on Friday 06/11/2021). It should include two Reactions, "Sunset Light Group On" and "Rainstorm Lights On" (done this way to prevent race condition/overlap if the same lamps were included in both reactions as well as prevent a gap at sunset when I'd have to turn off "Rainstorm Lights: On" lamps one minute before sunset kicks in.) I don't know why "Sunset Lights: On" would have run at 05:30 as it shouldn't be driven by mode but only by
sunset/sunrise
.Day would be an acceptable mode for ruleset "Rainstorm Lights: On" because, well, that's basically the point - we need these lights during the day as a storm has made it very dark during non-traditional times. I would expect "Rainstorm Lights: On" to run at 05:30 when mode switches to Day - but that's the reason for the
after <time>
conditions/constraints - to prevent it from taking action until after those time stops.EDIT: Ok, looking harder at that last half a sentence you wrote: "05:30 is before sunrise so the second condition was also met" - that would explain why "Sunset Lights: On" ran which would explain why Reaction "Rainstorm Lights On" ran. Since that reaction doesn't have the constraints, it seems that's overriding the ruleset "Rainstorm Lights: On" ?
@gwp1 said in restricting lights from a certain hour:
Since that reaction doesn't have the constraints, it seems that's overriding the ruleset "Rainstorm Lights: On" ?
You're mixing rules with global reactions. Global reactions are not bound by any rule. If you tell a global reaction to run, it runs. The fact that some rule may run it and at some specific time the rule would not run it is not a factor. The global reaction doesn't even know that rule exists. It's a one-way connection (rule -> global reaction); there is no connection the other way.
-
@gwp1 said in restricting lights from a certain hour:
Since that reaction doesn't have the constraints, it seems that's overriding the ruleset "Rainstorm Lights: On" ?
You're mixing rules with global reactions. Global reactions are not bound by any rule. If you tell a global reaction to run, it runs. The fact that some rule may run it and at some specific time the rule would not run it is not a factor. The global reaction doesn't even know that rule exists. It's a one-way connection (rule -> global reaction); there is no connection the other way.
@toggledbits This actually supports what I'm thinking happens here, then.
The ruleset has
Constraints
but, because the Reaction doesn't know of it, it's riding right over those constraints.This makes me feel even more confident that removing the call to the Reaction will resolve this issue. The ruleset "Rainstorm Lights: On" has the conditions and constraints necessary to correctly call for reaction "Rainstorm Lights On" - there's no need for ruleset "Sunset Lights: On" to ALSO call the Reaction - it's covered already.
-
@toggledbits This actually supports what I'm thinking happens here, then.
The ruleset has
Constraints
but, because the Reaction doesn't know of it, it's riding right over those constraints.This makes me feel even more confident that removing the call to the Reaction will resolve this issue. The ruleset "Rainstorm Lights: On" has the conditions and constraints necessary to correctly call for reaction "Rainstorm Lights On" - there's no need for ruleset "Sunset Lights: On" to ALSO call the Reaction - it's covered already.
@gwp1 Ok, bear with me: unsure if this ran correctly as now I saw the "Sunset Lights: On" trigger all lights because it was not yet sunrise but it was after 05:30 which is when DAY mode returns. As Sunset Lights: On runs during Day or Evening modes, it is correct (as currently configured) to act this way.
Doing some housecleaning on rulesets as I fear I may have a few that are duplicating efforts and a couple that need some Constraints.
-
The task of curating one's Rules is never quite done, I find. I visit them every day to tend to them like delicate violets.
-
Comments are vital! I include them both as
Comment
entries within the Rule body, as well as#comments
at the end of a line within an Expression. Example:AddOne := a = 0, #start at zero b = a + 1 #add one
@librasun @toggledbits I am delighted to say there were no lights between 05:30 and 06:30 (as planned) this morning.
Review:
-
Removed duplicate
Set Reaction
from ruleset "Sunset Lights: On" - this was already called elsewhere and was overriding the "Rainstorm Lights: On" ruleset. -
Removed
Day
as a considered mode from "Sunset Lights: On" as they're going on at sunset and Day mode ends then. It makesDay
a mode that should never trigger - but it was at 05:30 incorrectly as that's when Day mode restores. -
Returned the
weekend
andweekday
exclusions to theConditions
fromConstraints
set asafter
the appropriate alarm clock times.
My thanks to both of you - I really appreciate your feedback and guidance here!
-
-
T toggledbits locked this topic on