disforw / inverse

Create an inverse switch from a Home Assistant switch entity using the UI
8 stars 1 forks source link

Add support for Valves #3

Open jvmahon opened 6 months ago

jvmahon commented 6 months ago

Can a similar helper be made to invert the switch and show it as a valve?

In HomeAssistant 2024.1.0, a new valve type was added and it does not work propertly with Z-wave valves.

Z-wave valves are generally represented as a switch where "On" means "stop the flow".

The Valve helper can be added to the Z-wave valve "switch", but they have it backwards for valves - when the helper is added, the "On" value of the switch is mapping to "turn on the flow", so it needs to be inverted. That is , to work with Z-wave where a "on" means "stop flow", the switch On needs to map to "Valve Closed".

Thanks

disforw commented 6 months ago

Instead of complicating it and getting into whether your wires should be flipped or not, how about we just create an inverse for valve? More integrations are going to release a valve entity in the future.

jvmahon commented 6 months ago

I think it has to be "inverse switch and change it to a valve" - if that's what you mean, then yes, that would work. I am also checking with the person who added the "valve" type to switch_as_x and maybe this will get added directly into HomeAssistant's core integration. So maybe hold off a little bit and I'll see if I get a response to that.

disforw commented 6 months ago

Here's the thing, I think you may be mistaken. I have a zwave valve, and it's working perfectly. Open is on, closed is off.

Right now my sprinkler valve is off/closed for the season Screenshot_20240106-124547

disforw commented 6 months ago

You may want to reverse the polarity of your valve wiring... It's wrong.

disforw commented 6 months ago

OR use this to invert the switch, then change the inverted switch to a valve using switch_as_x

jvmahon commented 6 months ago

Interesting. And I think I figured out this may be because some valves don't properly identify their Z-WAVE Specific Class. Your device uses this to identify itself as a valve. Mine doesn't.

I checked the Z-wave device database at opensmarthouse.org. Your device, the LGZW water valve, shows up having a Generic Class of GENERIC_TYPE_SWITCH_BINARY And a Specific Class of "SPECIFIC_TYPE_VALVE_OPEN_CLOSE" https://opensmarthouse.org/zwavedatabase/1063

image

My device, a Fortrezz WV-01 shows up having a Generic Class of GENERIC_TYPE_SWITCH_BINARY but a Specific Class of "SPECIFIC_TYPE_NOT_USED" . https://opensmarthouse.org/zwavedatabase/368

image

So my assumption is that HomeAssistant knows that if the specific type is "SPECIFIC_TYPE_VALVE_OPEN_CLOSE" it knows what to do. Else, it gets it wrong.

jvmahon commented 6 months ago

OR use this to invert the switch, then change the inverted switch to a valve using switch_as_x

Yes, that seems to work. Thanks!

disforw commented 6 months ago

Oh, well wait a second... That's pretty easy too, you can open a PR with Zwave-JS to change that! https://github.com/zwave-js/node-zwave-js/blob/86b137ef54357e84fc7e50df8a558a7b2f540525/packages/config/config/devices/0x0084/wv-01.json#L4