In Rule Machine, use the Valve Changing State as your Trigger. Then, add in a Conditional action to check if the Valve State and Virtual Switch State DO NOT Match - if so, change the state of the Virtual Valve accordingly.
In your other automation/rule, perform the same logic, but in reverse. Use the Virtual Switch as the Trigger. As a Condition, If the Valve does not match the Switch, adjust the Valve accordingly.
This way the actual valve is only commanded to do anything when it is not in the correct state.
If you're using a custom Driver for the valve, it would be much simpler to just add the Switch Capability to the driver code. This way the two attributes would always be kept in sync by the driver, and no rules would be needed at all.
This would be the best solution. @jpage4500 - which valve is this?
The generic z-wave valve driver has Switch capability, but I just noticed the built-in Sinope valve does not. Tagging @mike.maxwell to see if it possible to add Switch Capability to the built-in Sinope Valve driver - thanks!
I'm not going to lie.. that was absolutely painful to enter in.. I figured I'd share what my rules look like if it'll help anyone.. but, here's hoping the HE guys can come up with an easier way to create/edit rules!
Rule 1 -- opening / closing a valve ("Orbit Hose") when toggling a virtual switch ("Hose")
Rule 2 -- keeping the virtual switch in sync with the valve
Thanks Kahn, I added the above as a new driver.
Changed the 'type' in one of my Neo Coolcam Power Plug to 'Econet EBV105 Water Valve'.
The "Neo Coolcam Power Plug" accepted the new type. I plugged in valve and have a functioning valve. Both open/close and on/off control switch and therefore the valve.
Tested a water sensor. Water shut off and sent notification received.
Not sure if was supposed to be that easy, but pleased it was.
Thanks so much.