NOOB with Complex Lighting Profile

New to Hubitat, but not new technology, and would appreciate some feedback and pointers as I migrate from WEMO and SmartThings (good riddance to both) to Hubitat C-8 V2.3.7.145 with Rule Machine 5.1. (Not a developer, but was proficient with Fortran in the ‘80s, have configured my Ademco Vista 15p to do things a professional installer told me couldn’t be done, and routinely abuse Excel.)
Leak detection and shutoff is straight forward in Simple Automation Rules, and exterior lights on for a duration from an alarm panel output, Restricted to hours of darkness and when not already on, was straight forward in Basic Rules, but my use case for lighting is far more complex.
I haven’t gotten Pre-staging Dimmer Levels to work on my GE/Jasco enbrighten 43096 Dimmer Plug, so my lighting code doesn’t use it. (With the GE Zigbee Dimmer driver, the commands don’t take, and with the Generic Zigbee Dimmer driver, the switch turns on with the command.)
I have a light in the living room that I want to come on near sunset, dim as the sun sets, and then later in the evening dim over time towards bedtime. As the sun sets later in the summer, I want to generally intercept this profile.
Will the following work?
Is it Hubitat resource efficient?
Any recommendations for improvement?
How will the system behave when the sun sets at 19:59:58, and the 5 second fade up to 75 is still in progress when the 20:00 rule commands a dim over time to start down?
The conditions are between times, but what happens is the sun sets at exactly 20:00:00?
Is there an App that allows for more complex calculations, both on the IF statement and output calculation?
Is there a better Hubitat App for what I am doing?

Rule Machine (RM)






What’s the latest sunset in your area? That will help determine how best to interrupt your lighting rule. You might be able to simplify your three lighting rules into one; though, lateness of sunset might determine that.

You’ll have conflicting commands in this scenario unless you cancel the first fade (which can be done).

Your if condition that starts at 20:00:00 would run. The IF statement that ends at 20:00:00 is actually saying the last time this part can run is 19:59:59.

Latest sunset this year will be 21:13:06. I must have been looking at twilight earlier when I was thinking it was 21:52, so I can take out the ELSE for the initial turn on and the the IF between 21:30 and 21:53.

Thanks JB10!
For the 19:59:58 / 20:00 conflict, it would be easy to add a nested IF ELSE to set a hard transition for the final minute, but for behavior consistency, I need to pull the subsequent steps into each scenario with WAIT/DELAY as appropriate, or is there a more elegant solution that I should explore? For the transition from 30 to 75, I really want to finish that one, but for the ramp down from 40 to 30, it really doesn't matter if it starts from 41 or 40. So I'll make the predecessor cancelable and and a cancel step.

And a much simpler answer occurred to me, I moved the 20:00 action to 20:01 :slight_smile: