I checked the forum for "best practices" posts, but most were fairly old or quite "specific".
As general background I can "code", so I understand all the underlying concepts in the Rule Machine (though I am new to Hubitat). I also understand the difference(s) between Events, Conditions etc. What I do not know is how the Hubitat Rule Machine functions "internally" and how it interfaces with drivers (and driver states and variables), and if and how different hierarchical/nesting structures might be affected by "best practices" (or not).
An example, to illustrate:
- A greenhouse has additional grow lights to compensate for "not sunny" conditions.
- In order to not affect the plants negatively, the "total daylight time" should not exceed a certain amount of time, which is basically a simple daily on-off timer.
- Grow lights are expensive, and should not be repeatedly turned on/off just because clouds sail by (covering the sun for a few minutes).
- In order to avoid "too much light", condition 3 should "err on the side of caution" (avoid "doubling" the amount of light, even for a shorter time).
- The daily timer needs to be manually set through-out the season, but the rest of the "system" should be "always automated" and "always on" (when the grow lights are set to be "on").
- The grow lights can also be turned on/off manually.
Hardware-wise all that is needed is a simple (light) switch (also connected to a manual button), an illuminance metering device and Hubitat's Rule Machine (C-8). Logically it is not all that complex, but at first glance the functionality can be accomplished in several different ways. The question is if there is a "best practice" how to hierarchically nest the above conditions and/or how to split them between different rules (linked by variables and/or switch/illuminance meter condition)?
"Best practice" is (in my world ) defined as logically functional, less complex, less taxing (on the system) and less prone to error (for instance from devices not updating their condition "in a timely manner"). If this was VBA, Python or some other "code", I could have the snippet up and running (and tested) in a few leisurely hours, but is there a "best way" to do it when using the Rule Machine? And if so, what is that "best practice"?
If the question above is too broad, then a bit more specific:
Since the Rule Machine is event driven, my logical (?) solution (as a Hubitat noob) would be to add all the involved events (timer on/off, manual on/off, "no sunlight/sunlight is back") as separate rules and have them communicate/interface with each other using a set of global variables ("states"/conditions and event time/timers). Because such a "de-structured nesting" intuitively feels more "robust". However, having read the Rule Machine manual (and a lot of comments) it seems the Rule Machine and the Hubitat OS is inherently built to explicitly handle some of those functions, and it might actually be a "better practice" to utilize it's inherent nesting to full extent.
I have about half of my hardware (quite a lot too ) installed with functional drivers (though a lot of them are "generic Zigbee") and it is time to start "the automation", so the main goal of this fairly long question is getting that (most important) part off to the best possible start (and trial and error is NOT the answer... ).