Help creating a virtual switch that tracks valve state

I think this is possible, but I can't figure it out..

I'm trying to control a valve by voice (google assistant). I think Google needs a button or switch because it doesn't work with a valve.

so, virtual switch to the rescue! I can have the switch open and close the valve.. but I would really like the switch state to reflect the same state as the valve too.. on when valve is open, etc.

can someone help me figure this out? I know rule manager can have a trigger when the valve state changes. but, how can I set the switch state without re-triggering the valve? does that make sense?


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.

1 Like

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!

1 Like

it's an Orbit Bhyve driver. I've had similar questions before though on other device types so this will be helpful regardless

1 Like

Aha - you can make the suggestion to @dman2306 to add Switch Capability to that driver. It might be useful to others as well.

awesome - thanks for the help!

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


also you can use my device handler that has switch and contact as well as valve capabilities that is what i do

i use it for both dome and gopher valves

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.