I've seen a couple requests for more advanced use cases of RM, figured I'd post a couple of mine.
What it does: Fade a dimmer down from 100% to 10% over the course of 30 minutes at sunset, and fade it back up over the course of 30 minutes at the later of sunrise or 6:00AM. If the light is turned off or someone manually overrides the light level during the fade period, fading stops to avoid "loss of manual control" frustration (AKA the WAF ). If the dimmer is off and turns back on, it goes automatically to it's target level, whether or not time is currently in one of the fade periods.
The way I set it up, this automation requires 6 rules. It also requires a virtual dimmer (that must be ON all the time in order for tracking to work correctly) to act as a variable to store the target dimmer levels.
Rule 1: Physical Dimmer - Set High
(This rule sets the physical dimmer to 100% any time it's turned on during the day, outside of the fade periods)
- Trigger Events
-- Physical Dimmer on - Conditions
-- Time between 6:30AM and Sunset
-- Time between Sunrise + 30 min and Sunset - Rule
-- Time between 6:30AM and Sunset
-- AND
-- Time between Sunrise + 30 min and Sunset - Actions when True
-- Dim: Physical Dimmer: 100 - Example:
--
Rule 2: Physical Dimmer - Set Low
(This rule sets the physical dimmer to 10% any time it's turned on during the night, outside of the fade periods)
- Trigger Events
-- Physical Dimmer on - Conditions
-- Time between Sunset + 30 min and Sunrise
-- Time between Sunset + 30 min and 6:00AM - Rule
-- Time between Sunset + 30 min and Sunrise
-- OR
-- Time between Sunset + 30 min and 6:00AM - Actions when True
-- Dim: Physical Dimmer: 10 - Example:
--
Rule 3: Set Virtual Dimmer Target Level
(This rule manages the virtual dimmer that stores the target level for the physical dimmer)
- Conditions
-- Time between 6:00AM and Sunset
-- Time between Sunrise and Sunset - Rule
-- Time between 6:00AM and Sunet
-- AND
-- Time between Sunrise and Sunset - Actions when True
-- Fade Virtual Dimmer up to 100 over 30 minutes - Actions when False
-- Fade Virtual Dimmer down to 10 over 30 minutes - Example:
--
Rule 4: Track Virtual Dimmer
(This rule causes the Physical Dimmer to track/follow the Virtual Dimmer's level as it changes)
- Trigger Events
-- Dimmer level becomes Virtual Dimmer <= 100 - Actions
-- Track Dim: Physical Dimmer - Restrictions
-- Enable/Disable with private Boolean - Example:
--
Rule 5: Enable/Disable Tracking
(This rule enables tracking in Rule 4 if the dimmer is on and within 5% of the target level, disables otherwise)
- Conditions
-- Physical Dimmer on
-- Dimmer level of Physical Dimmer >= Virtual Dimmer - 5
-- Dimmer level of Physical Dimmer <= Virtual Dimmer + 5 - Rule
-- Physical Dimmer on
-- AND
-- Dimmer level of Physical Dimmer >= Virtual Dimmer - 5
-- AND
-- Dimmer level of Physical Dimmer <= Virtual Dimmer + 5 - Actions when True
-- Rule Boolean True: Rule 4 - Actions when False
-- Rule Boolean False: Rule 4 - Example (I have extra conditions in mine that only allows it to run when my wife or I is home, I did not add those to the text above):
--
Rule 6: Enable Tracking
(This rule enables tracking in Rule 4 when the physical dimmer is first turned on)
- Trigger Events
-- Physical Dimmer on - Actions
-- Rule Boolean True: Rule 4 - Example:
--