Show Off Your Rule Machine Rules

I just wanted to revive an old post about creative Rule Machine rules. I used Google’s Gemini to completely write a rule from scratch and it works. Now I’m interested in what the community is doing and if they might wanna share their favorite rules with the rest of us.

The Goal:

I told Gemini that I wanted to when the Garage doors or the Fridge doors have been open and stays for more than 15 minutes. I want the complete list spoken to me at once and if devices are opened or closed during that 15, update the list. Gemini wrote this (minus the device names of course).

Set Private Boolean(false) False
While (Garage Door 1, Garage Door 2, Garage Door 3 any door is open(F) OR
Bar Fridge freezer door, Bar Fridge fridge door, Rec Room-Door, Front Door, Kitchen Fridge Fridge door, Kitchen Fridge Freezer door any contact is open(T) [TRUE]) Repeat every 0:15:00
Set OpenDoorList to ' '
IF (Garage Door 1 door is open(F) [FALSE]) THEN
Set OpenDoorList to '%OpenDoorList% Garage Door 1,( Front Door, Garage Door 1,)'
END-IF
IF (Garage Door 2 door is open(F) [FALSE]) THEN
Set OpenDoorList to '%OpenDoorList% Garage Door 2,( Front Door, Garage Door 2,)'
END-IF
IF (Garage Door 3 door is open(F) [FALSE]) THEN
Set OpenDoorList to '%OpenDoorList% Garage Door 3,( Front Door, Garage Door 3,)'
END-IF
IF (Front Door contact is open(T) [TRUE]) THEN
Set OpenDoorList to '%OpenDoorList% Front Door,( Front Door, Front Door,)'
END-IF
IF (Rec Room-Door contact is open(F) [FALSE]) THEN
Set OpenDoorList to '%OpenDoorList% Rec Room Door,( Front Door, Rec Room Door,)'
END-IF
IF (Variable OpenDoorList( Front Door,) is ≠ ' '(T) AND
Announcements(off) is on(F) [FALSE]) THEN
Notify iPad, Rich's iPhone Via HE and Speak on Sonos Group: All Areas(volume: currentvolume(35)): '%OpenDoorList% has been left open, please check if that is the desired state.( Front Door, has been left open, please check if that is the desired state.)'
END-IF
END-REP
Set Private Boolean(false) True

This rule sets a dimmer to 75% at a random time between 11:15pm and 12:00am, waits 2 minutes and then dims it down to 10% over a 5 minute period in 10 second intervals. Once it hits 10%, it waits 1 minute and sets it back to 100%, waits another minute and then turns the dimmer off.

What was the purpose coming back on and then off ?

The dimmer turns back on at whatever the last dimmed percentage was. I want it to come back on to 100% the next time I turn it on. So I set it back to 100% before turning it off. Keep in mind that the rule dims down to 10% only. If I don't turn the dimmer back up to 100% before turning it off, the next time it comes on it would be at 10%.

I assume that dimming devices cannot use "level pre-staging" or the presetLevel() command to set level without turning on.

To be honest, I haven't tried nor could I tell you. I just based the rule off how I know my dimmers work.

If that capability is available you’ll find it listed on the device “commands” page.

1 Like

Looks like this particulat dimmer doesn't support it.

I'm using a GE In-Wall Paddle Dimmer, 300S with the Generic Z-Wave Dimmer driver.

I just learned something new from AI.

I can exploit the 0-second fade/duration trick to instantly change the internal memory of the dimmer to 100% right as I turn it off, preventing it from actually fully turning on at 100%.

I changed the action in my rule to Dim: E---- Lights: 100 --> fade: 0

Because the fade/duration is 0, the dimmer updates its internal "last dim level" state to 100% virtually simultaneously with receiving the "off" command, ensuring it's ready for full brightness next time.

1 Like