RM Example: Lights that fade down at sunset, fade up at sunrise, with manual override

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 :rofl:). 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)

6 Likes

This is cool btw! So basically 6 rules per lighting device/scene? How do you manage your list? Seems it would be HUGE.

That is awesome - I wish others with good detailed rules would post more of them .. they start to answer some questions. Well done.

1 Like

Correct. Rules are free right? I have ~150 of them :rofl:

I have this automation set up for 3 dimmers inside the house that we use for ambient lighting.

Kitchen Cabinet Lower Light goes from 20% to 50%
Living Room TV Lower Light goes from 10% to 100%
Niche Light goes from 10% to 40%

3 virtual devices:

3 sets of 6 rules:

1 Like

Hmm. How about a separate category for example pistons.
Sorry to keep banging on about this. :wink: :slight_smile:

2 Likes

That's blown my little mind, but it's logical and effective. The virtual device is a new concept for me here in combination with the rules, Going to try and process that now and how i can use it.

1 Like

Bobgodbold, I was trying to pull together a set of regular patterns for RM, but having seen this I tend to agree, just an area in the community for RM examples could be more effective. Especially if laid out as coherently as this.