Rule Machine: Contact sensor to change virtual contact sensor's state

I need help using RM? That is triggered by the “real” contact sensor to change virtual contact sensor's state. I'm using the VCS to invert open/closed state.

Trigger: Contact changed


IF (Contact open) THEN
  close() on virtual contact
  open() on virtual contact

To get the open() and close() things above, you'll need to use the Set Variable, Mode or File, Run Custom Action > Run Custom Action action. You'll be prompted to choose a capability for the "target" device; anything the virtual sensor supports would work, but "Contact" is a logical choice. You should then be able to choose one of the commands after selecting the device. Do not add any parameters (these commands don't take any).

Some Mirror app changes may make this "mapping" a bit easier in the near future without using Rule Machine, but for now, something like this should work (and will continue to either way).

There may also be other ways to get at your goal, but if this is what you've decided is best, it should work!

1 Like

Thanks for the quick response. Tried mirror app, contact sensor's aren't listed as "Primary device *"
RM will work fine, once I get it sorted. No commands found?

Right, the Mirror additions have been hinted at in other posts by staff but are not in the current release.

Regarding "No Commands Found": that is odd. Are you using the built-in "Virtual Contact Sensor" driver for this? If not, what are you using? It has to be a virtual driver of some sort (may or may not actually have "virtual" in its name, but all the built-in ones like this do).

Was using this driver, giving the Preferences to
Reverse States?
Reverting back to the system driver, there are command, parameter type, string value?


That driver should work, though the system driver should too unless you need some feature it doesn't provide. Not sure why EMI isn't showing you the options for the first; the driver looks OK.

As mentioned above, this command takes no parameters, so don't add any.

The feature is to have the ability to Reverse States and want the ability to change it to open when it's closed to display on a Dashboard.

Virtual contact isn't changing?

You added a string parameter (or least started). You will likely see an error in Logs related to this, a good thing to check when you are having problems. Remove it (finish adding it first if it doesn't let you--just type anything), enable all logging for the rule, and check Logs again for clues if it still doesn't work.

Solved. Thanks

Download the Hubitat app