Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core 2024.1.0 - Valve Domain - Open / Closed are Inverted #107011

Closed
jvmahon opened this issue Jan 3, 2024 · 4 comments · Fixed by #107535
Closed

Core 2024.1.0 - Valve Domain - Open / Closed are Inverted #107011

jvmahon opened this issue Jan 3, 2024 · 4 comments · Fixed by #107535

Comments

@jvmahon
Copy link
Contributor

jvmahon commented Jan 3, 2024

The problem

This is for the Z-Wave water valve WV-01 by FortrezZ, LLC.

For Z-wave water valves, when they are represented as a Switch (pre-2024.1.0), the "On" position corresponds to the valve being shut, and the "Off" position corresponds to the valve being open.

Two issues:

  1. In 2024.1.0, Z-Wave water valve devices still identify initially as a Switch, but you can add a helper to convert to valve domain.
  • First issue - can Z-wave integration be updated so that z-Wave water valves add as a valve.
  1. In 2024.1.0, when the "Switch" for a Z-wave water valve has a "Valve" helper added, the helper does not properly understand that the "On" switch position corresponds to valve closed, and "Off" corresponds to valve On.

For example, as you can see in the image below, the Original Switch entity (now Hidden) is in the Off position. For Z-Wave valves, this means that water is flowing and the valve is Open. However, the Helper, image below, shows the valve in the closed position and the Logbook also shows "Closed".

This issue carries through to the Valve:Open service. When Valve: Open is used in an automation, it closes the valve.

image

What version of Home Assistant Core has the issue?

2024.1.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@jvmahon jvmahon changed the title Valve Domain - Open / Closed is Inverted Core 2024.1.0 - Valve Domain - Open / Closed are Inverted Jan 3, 2024
@home-assistant
Copy link

home-assistant bot commented Jan 3, 2024

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (switch_as_x) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of switch_as_x can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign switch_as_x Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


switch_as_x documentation
switch_as_x source
(message by IssueLinks)

@emontnemery
Copy link
Contributor

There's no way to know if a switch which is used to control a valve is open when the switch is on, or the opposite. The same is true for switches which control covers and locks.

I think we need an option in switch_as_x to invert the state of these domains.

@jvmahon
Copy link
Contributor Author

jvmahon commented Jan 3, 2024

There's no way to know if a switch which is used to control a valve is open when the switch is on, or the opposite. The same is true for switches which control covers and locks.

I think we need an option in switch_as_x to invert the state of these domains.

An invert function on the Switch type would be a great addition (for this and other purposes). As a longer-term solution, at least for Z-Wave products that were designed to be values it would be even better if the device would be added as a valve during pairing. Z-wave devices report both a generic type (i.e., Switch), as well as a specific type (VALVE_OPEN_CLOSE) - maybe that specific type information could be used during pairing.

Another thought ...

  • If the helper method is being used to change a switch to the valve, does the "helper" get to see that the underlying device being "helped" is z-wave? If so, then it could always apply the "inversion" effect. I recall in the Z-wave standards, all Z-wave water valves use 255 to mean "close the valve" (they do this because Z-wave water sensors send 255 as the Basic Set value to mean "alarm sensed" and if the water sensor is paired directly to the valve that 255 from the sensor gets the desired effect of closing the valve when a leak is detected).

In any case, its great to see this functionality being added (even if there are a few pieces like this that need to get worked out for it to reach its full potential).

@jvmahon
Copy link
Contributor Author

jvmahon commented Jan 6, 2024

@emontnemery , FYI - I tried modifying the valve.py entry that you added to the switch_as_x integration to create an inverted switch as valve. I've attached that file. I couldn't figure out how to get this installed and working though (I tried adding the switch_as_x as a custom integration to override the built-in, but I'm still learning how to do that and I haven't gotten it to work).

In any case, it seemed like a relatively simple update (changes were made to lines 42 and 53 (renaming the entity to ValveSwitchInverted for the inverted case) and 63, 73, 91 (inverting the on/off states). I'm not sure if much else is needed, but maybe this is a quick starting point, the idea would be to add this as a new named choice - e.g., "Invert On-Off Switch and Add as Valve" or "Zwave Valve Device Switch to Valve" or something like that. Better still might be a simple "Invert" toggle on the helper, but I wasn't sure if that was possible (or how to do it).

inverted_as_valve.zip

@github-actions github-actions bot locked and limited conversation to collaborators Feb 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants