Rule Machine - Migration from ST/WebCORE help

Ok, so I am looking at learning how to use RM - and I will be the first to admit my head is kinda assploding a bit - so if I am missing something obvious, dont feel bad laughing at me ... :wink:

(and I know I can look at the WebCoRE port to HE, but I would prefer to do this 'native' if I can ...)

I have a simple piston

If Front Door Motion becomes active OR Front Door Unlocks
   and Mode is NIGHT
    With Entrance and Porch Lights
        Capture Current Switch State & Dimmer Level
        Set Dimmer Level to 100%
        Wait 3m or until Door Locks
        Restore Previous States of Entrance and Porch Lights

For the record - if this matters
Motion Detector in this case is a RING Doorbell Pro (still connected to ST and linked via HubLink (and sending data properly in the logs)
Door Lock is a Schlage - again connected via HubLink and sending Locked/Unlocked properly. I did have to change the Driver to VIrtual Lock instead of Virtual Omnisensor but its showing correct actions in the logs
Lights are via Lutron Caseta Pro (standard dimmers) and function correctly in HE)

I am having a hard time figuring out what type or RM to use (Rule, Trigger, Triggered Rule, Actions etc) and how to set this up in the IDE

I guess I am looking for samples to build from, an idiot's guide to RM, or some help building out this fairly simple (in my head coming from WebCore) process ... from which I can hopefully grok it and run with it


I struggled a lot with transitioning from webCore to RM as well. Hopefully one day we will have an RM For Dummies wiki but in the meantime this link might help get you started.

1 Like

Thanks … working through this I see I can capture the state of a switch, but not a dimmer which is problematic for what I am trying to do …gonna have a bit of Balvenie and rethink this :slight_smile:


1 Like

You may have just inspired me to crack the seal on this bad boy.


GMTA :slight_smile:

exactly whats in my wee glass :wink:

I notice the Aberlour is mostly gone though. So tasty.

1 Like

Indeed, but the glass of Balvenie I had tonight hit the spot. Seal cracked, nectar absorbed…good call @JHoke.

I’m a big fan of the Laphroaig Quarter Cask, if you like a smoky peaty Scotch.

Ok, the scotch didnt help ... so I'm gonna try more ...

Seriously though, hoping that someone can throw me a lifeline

I am looking to turn on lights and set dimmer to 100% when one of these happens

  • Door 1 Opens
  • Door 2 Opens
  • Door Lock Unlocks
  • Motion is Detected

Then after the above - turn the light off after three minutes unless motion continues to be detected before the three min timeout

If possible, I'd also like to capture the state before turning on the light (switch on/off and dim level) and afterwards, restore the previous state.

I'm banging my head a bit ... wishing I drank more and that there was a Rules Machine Examples wiki :slight_smile:

Did you ever figure this out?

I’m trying to have lights turn on when a motion sensor detects motion OR a contact sensor opens. The turn off only if the motion sensor doesn’t detect anything for a period of time.

You can do this with rule machine, but it's much easier with built-in Motion Lighting Apps. Just go to Apps > Load New App > Motion Lighting Apps

I might be wrong but I don't think you account for the contact sensor being open with Motion Lighting.

Maybe a Rule in RM something like this will work

I tried that, but if I leave the door open, the rule will never change to false, and so it won't be reset when the motion reactivates.

and motion lighting doesn't seem to have a built in way to account for contact sensors.

Is there a scenario where the contact sensor will open and not also trigger the motion sensor?

Right you are sir! You have to make a simple rule that translates the contact sensor open/close to a virtual switch on/off action, and then you can define that virtual switch under additional options in Motion Lighting.

However, you can also just as easy (read: easier) create two Hubitat Simple Lighting rules with the Simple Lighting app. One for the motion sensor and one for the contact sensor.

I think you might need 2 rules for this...actually a rule and a triggered rule that then evaluates the rule.

Create a rule that turns the light on when there is motion and shuts off after 3 mins of inactivity (with a cancel on activity within the below

And then a triggered rule that runs only when the contact is open....which also turns the light on (in case there is no motion as well)....but also forces an evaluation of the Rule above.


Do it like this:

Click "Define a Rule"
Give it a name
Select Conditions:

  • Door 1 open
  • Door 2 open
  • Door lock Unlocks
  • Motion active

Define Rule:
Select each of those conditions and put an OR in between all of them

Select Actions for True:

  • Control Dimmers, bulbs shades fans
  • Set these dimmers
  • Set to 100%

Select Actions for False:

  • Delay or repeat these actions: 3mins, then select "Cancel on truth change ON". This'll reset the 3min timer if someone moves.
  • Set these dimmers to... 50% or whatever baseline you want it to be temporarily until we figure out how to capture a state.

Then at the end, Restrictions: Restrict it to Night Mode

I think in every scenario I can think of that would work, except if you somehow were able to enter the bathroom without the motion sensor ever detecting you. Then the trigger would call on the rule and if it remained false, the light wouldn't activate. Which really begs the question, why do you need both because a properly placed motion sensor in the bathroom should always detect you.

Anyway, here's another way using a rule and motion lighting, which I believe should do what you want as well. I like motion lighting because of the extra options that are nicely presented, rather than having to work your mind into how to create the rule to do all those motion lighting and contact (switch) tasks.

The light would activate as soon as the door opened (as part of the trigger) before it runs the action to evaluate the rule. Then if there is no motion, it will shut off after 3 minutes.

I read this a couple of times before realizing you were replying to @JHoke. He hasn't been active for quite a while.