RM4 - List of example rules

Hi all,

I love the idea of browsing a long uninterrupted list of our communities favourite automations. Both for inspiration and guidance.

So please join in and share one or more of your automations that you think someone may find useful. Don't worry if its been posted before, you may have a different way of writing it.

Post anything from simple to complex. Something you find quite mundane may be a monumental help to someone else.


---- TO ENSURE A LONG UNINTERUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

Name of Rule: Wake Announcement / Alarm Clock

Comments: Triggers my bedside GH speaker to make an announcement every 5 minutes after my alarm until I've gotten up and triggered my bathroom lighting rule. Also ties in with an automated Public holiday switch.

---- TO ENSURE A LONG UNINTERUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

6 Likes

---- TO ENSURE A LONG UNINTERUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

Name of Rule: Capture and Restore lights with contact sensor

Comments: Brightens a light right above a cupboard while the door is open. Once the door is closed, the light returns back to its original level setting.

---- TO ENSURE A LONG UNINTERUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

2 Likes

---- TO ENSURE A LONG UNINTERUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

Name of Rule: Workday morning motion lighting

Comments: Triggers a light based off motion. Starts off dim with low colour temperature then after 3 minute delay changes the colour temp and starts to brighten. The light stays on till I leave the house. The front door contact sensor turns both the light off and sets the PB back to True ready for the next morning. The colour temp shift is actually a really refreshing way to wake up!!

---- TO ENSURE A LONG UNINTERUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

1 Like

---- TO ENSURE A LONG UNINTERUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

Name of Rule: Fridge Door Left Open

Comments: I have an LG side-by-side fridge with split door-in-door that allows you to access frequently used items like milk, sodas beer, etc. While the feature is pretty handy, the inner door doesn't close like a normal fridge door; it needs to be pushed until it latches. The design is so counter-intuitive that everyone who uses the inner door just swings it closed like every other fridge door on the planet. The end result is that the door doesn't latch and leaks tons of cold air. To add to this boneheaded design decision, LG decided that a "door left open" chime wasn't needed for the inner door despite being present on the main fridge door and the freezer door.

Hubitat to the rescue. I have a contact sensor named "Refrigerator Door" that monitors the closed state of the inner door. Triggered by this contact's open/closed state change, it allows the user to leave the inner door open for 2 minutes before sending a PushOver notification.

If the door is left open between the hours of 9 AM and 10 PM, the rule opens the "V-Fridge Door" virtual contact for 10 seconds, then closes it. This virtual contact is part of an Alexa routine triggered when the contact opens. The routine does an "announce" to every Echo device in the house and speaks the following message "Someone has left the refrigerator door open. Please close it.". The time condition prevents waking the entire house if someone grabs a late night snack beer. [EDIT] updated rule image (wordwrap causing THEN statement to appear on a separate line)

The rule repeats every 5 minutes until the door is finally closed.

fridge%20door%20rule

---- TO ENSURE A LONG UNINTERUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

4 Likes

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

Name of Rule: Freezing Outside Temp
**Comments:**This rule monitors the temp of my crawlspace using a temp probe attached to a Qubino 2 Relay module located in the crawlspace. If crawlspace temps drop below freezing it sends a Pushover notification and turns the water pipe heat tape on. Once temps return to above freezing it sends another Pushover notification and turns off the heat tape. The private boolean ensures the notifications are only sent once for each freezing temps/normal temps state change.

So why the odd device naming convention? My video doorbell is prone to lockups and the Qubino allows me to power cycle my doorbell transformer--I'm just leveraging the temp probe capabilities for this rule, which as you might guess has nothing to do with doorbells :slight_smile:

heat%20tape%20rule

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

1 Like

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

Name of Rule: Laundry Cycle Complete Notification (using power monitoring)

Comments: Here is my Dryer RM4 rule. The Washer one is basically the same, except for the power threshold. You'll need to figure that value out for your specific devices to prevent false alerts. My power data is collected every 30 seconds, so this rule currently requires 2 power updates in a row below the threshold to trigger the notification (this is the purpose of the 32 second cancellable delay statement. The Private Boolean logic prevents this rule from issuing continuous notifications once the cycle is complete.

image

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

5 Likes

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

This rule has no trigger which does mean it can't run on its own. It can however be triggered from other rules. Since I evaluate locking the door in several other rules, I split out the logic into this one rule and trigger it from those rules. This technique could eliminate complexity in some of your rules and make changes quicker and cleaner.

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

4 Likes

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

Name of Rule: Notifications: TTS via AlexaTTS

Comments:
I use text-to-speech announcements for various events that range from the mundane (move clothes to the dryer) to the potentially serious (water heater leak sensor is wet). Rather than add complexity to each triggered rule that has an notification action, I simply setup a global variable "tts_payload" to which the notification is set. I then have a separate rule that runs each time the variable "tts_payload" changes. This rule is pasted below

I'd like to receive the more critical announcements by SMS when I'm not at home.
Therefore, rules that indicate a critical condition has triggered (eg. peripheral contact sensor triggered, leak sensor triggered, smoke alarm) also turn on a virtual switch called "Emergency". If this switch is on and I am not at home, then the variable "sms_payload" is set to the value of "tts_payload", and the TTS announcement occurs on the Echo Dot in my Office. "sms_payload" is separately processed to notify me via SMS.

Because, I don't want to badger the maid with announcements and or have announcements when I have visitors, virtual switches indicating either of these conditions cause the rule to be exited.

Under all other conditions, announcements are made at two different Echo devices.

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

3 Likes

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

Name of Rule: Lights on Contact or Motion

Comments:
This rule turns on a light when motion is detected or a contact sensor (e.g., door) opens, then off with a 1-minute delay after motion stops or the contact sensor closes. While Motion Lighting can handle this exact scenario (and I always encourage people to try Simple Lighting or Motion Lighting first), I've seen many people ask for how to do this with just contact sensors (easy: take out the motion below) or with other, more complex conditions that are do-able in Rule Machine. This should provide a good basis for doing something more complex.

image

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

1 Like

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

Name of Rule: Doggy Door

Comments:
The purpose of this rule is to turn on the back yard light that is on the garage on a lone switch in the garage with a contact sensor when we let the pups out from the patio door in the kitchen. The concept is this: Open the door. The dogs go out and the light turns on. Close the door. The light stays on. Open the door. Dogs come in and the light is still on. Close the door. Light turns off. Walk away. Kinda slick. It's restricted to only run between sunset and sunrise. There's a little quirk that sometimes leaves it on that I haven't bothered to work out yet, but the rule works great otherwise.
[Edit]
I forgot to mention that you need to create a virtual dimmer switch to do the counting. I'm sure there are other ways to capture state, but this was the easiest way to wrap my head around it.

2 Likes

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----

Name of Rule: LivingRoomTV status controls lighting

Comments:
I use this rule each time I turn on my living room TV. There is nothing special about the rule itself; however, it makes use of two useful integrations/drivers written by others. The two integrations are:

  • @armand’s Roku TV Device Handler. This integration is useful for lots of things; the sole use in this rule is to determine when my Roku TV is turned on or off.
  • @ogiewon’s HTTP Momentary Switch. In this rule, I make use of two momentary switches created with this driver - Sonos-pause and Sonos-join. Sonos-pause pauses the living room speakers when the TV turns on, and Sonos-join re-joins them to other Sonos speakers when the TV is turned off.

Useful Rule Machine features that this rule makes use of, include:

  • A global variable (daylight) which is set to 1 shortly after sunrise and to 0 shortly before sunset.
  • A local variable (lights-on) that is set to 1 if certain lights were on when the TV was turned on, and to 0 when the TV is turned off.
  • Capture - which captures that state of lights
  • Restore - which restores lights to their pre-existing state when the TV is turned off.

This rule works like this:

  1. When the TV is turned ON, Sonos speakers are silenced and bias lighting behind the TV is turned on.
  2. If certain lights are on, the local variable “lights-on” is set to 1 and the status of those lights is captured before they are either turned off, or depending on the global variable “daylight” are set to different color temperature and intensity. The variable “daylight” also determines the intensity of bias lighting.
  3. When the TV is turned OFF, the living room Sonos are re-joined to other Sonos and bias lighting is turned off.
  4. If the mode is NOT Sleep, then lighting is restored to the parameters in play before the TV was turned on. On the other hand, if the mode is Sleep, different lighting conditions are chosen.

---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----