Repository navigation
Add full native support in zha for the Valve entity (device type exposed in Home Assistant)? #528
Description
Activity
@TheJulianJES will you consider adding adding "valve" to EntityPlatform in zigpy and add quirks v2 valve entity to zha based on SwitchMetadata/ZCLEnumMetadata similar to your new PRs that add siren entiry to also try fufill this request to add basic valve device support for Zigbee devices?
Also see related PR:
As well as these related device handler requests:
- https://github.com/zigpy/zha-device-handlers/issues?q=is%3Aissue%20state%3Aopen%20water%20AND%20valve
- [Device Support Request] Sonoff SWV-BSP Smart Water Valve zha-device-handlers#3298
- [Device Support Request] MOES Water Valve Smart Sprinkler zha-device-handlers#4678
- [Device Support Request] Moes battery powered valve controller for water and gas zha-device-handlers#4074
- ## Support Tuya TS0601 (_TZE284_zm8zpwas) smart valve controller (model PF-PM070D TYZ) zha-device-handlers#4672
- [Device Support Request] Smart Water valve --TS0601 by _TZE284_nnhwcvbk-- zha-device-handlers#4308
- [Device Support Request] Zemismart Zigbee Smart Valve Ultrasonic Water Meter ( _TZE284_vuwtqx0t TS0601 ) zha-device-handlers#4280
- [Device Support Request] Zigbee Water Valve Shutoff (currently works as a "light") zha-device-handlers#4103
- [Device Support Request] ADAPTOR Tuya Water Shutoff Valve TS0601 by _TZE200_nqaqq4cf zha-device-handlers#4942
- [Device Support Request] TS011F by _TZ3000_tvuarksa zha-device-handlers#5041
- [Device Support Request] TS0601 _TZE204_1oft6qso watering controller zha-device-handlers#5108
FYI, puddly has a opened a draft for adding an initial base valve platform with basic support to zha here:
-
Add support for the Valve platform #673
"This is a bit of a strange platform because the ZCL R8 spec does not actually support valves in any way. There are no clusters, there are no device types, nothing. So this functionality is again provided by an entity class relying on the existence of
OnOff+ (optional)LevelControl, accessible at the moment only with YAML platform overrides. It is a lower priority than the generic Switch entity and thus will never be discovered by default. This will be available for quirks to use in the near future." -
"As with the other new platforms, this is only an abstract base. Device support will need to be implemented in https://github.com/zigpy/zha-device-handlers/. The ZCL spec doesn't have a concept of valves (only
OnOffandLevelControl clusters without a distinguishing device type) so this platform cannot participate in ZCL discovery." -
Add ZHA valve platform home-assistant/core#183740
"Add the valve platform to ZHA. This is exposed internally by ZHA and with this change, will be exposed externally to Home Assistant."
For reference, of interest, be aware of these indirectly related PRs for Home Assistant’s core adding frontend, triggers and conditions:
-
Add valve to switch_as_x domains home-assistant/frontend#19118
-
Allow inverting switch_as_x cover, lock, valve home-assistant/frontend#19324
-
Improve mock for cover, alarm, lock, lawn mower, valve and vacuum home-assistant/frontend#29999
-
Add valve open/close card feature home-assistant/frontend#26488
-
Demo valve registry entry and device home-assistant/core#165803
-
Add is_closed state attribute to valve home-assistant/core#165227
-
Add
valve.openedandvalve.closedtriggers home-assistant/core#165160 -
Add opening/closing state icons to valve domain home-assistant/core#169644
-
Allow for decimals in cover and valve favorites home-assistant/frontend#51633
All in all these show that valve as an entiry domain and device type platform is now already a first-class citizen in Home Assistant!
Reacted by Demian-
Hi @Hedda ,
thanks for your work on the valve platform! I hope it will be available soon, because I also have the Sonoff SWV.Thanks@Hedda,
Having valve support would greatly improve the user experience for my zigbee water valve.Reacted by DemianTip if someone wants to test this summer is to check out the new SONOFF SWV-ZF2 Hydro Series Hydro Series Zigbee Smart Water Valves which has one or two valves and is designed to hook up to a tap outdoor for a garden hose to sprinklers or DIY irrigation.
Links and info:
-
Sonoff SWV-ZF2 Hydro Series Hydro DUO with two valves and Flow Meters:
- Sonoff SWV-ZF2U (NH) Hydro Series Hydro DUO for North America -> https://www.zigbee2mqtt.io/devices/SWV-ZF2.html
- Sonoff SWV-ZF2E (BSP) Hydro Series Hydro DUO for Europe -> https://www.zigbee2mqtt.io/devices/SWV-ZF2.html
-
Sonoff SWV-ZF Hydro Series Hydro ONE with one valve and a Flow Meter:
- Sonoff SWV-ZFE (Hydro Series Hydro ONE with Flow Meter) -> https://www.zigbee2mqtt.io/devices/SWV-ZFE.html
- Sonoff SWV-ZFU (Hydro Series Hydro ONE with Flow Meter) -> https://www.zigbee2mqtt.io/devices/SWV-ZFU.html
-
Sonoff SWV-ZN Hydro Series Hydro Lite without Flow Meter:
- Sonoff SWV-ZNU (NH) Hydro Series Hydro Lite without Flow Meter -> https://www.zigbee2mqtt.io/devices/SWV-ZNU.html
- Sonoff SWV-ZNE (BSP) Hydro Series Hydro Lite without Flow Meter -> https://www.zigbee2mqtt.io/devices/SWV-ZNE.html
Note! Models come with different fittings: NH for North America (National Hose) and BSP (British Standard Pipe) for Europe.
Sonoff claims it is compatible with Home Assistant's ZHA but the zha-quirk in ZHA Device Handlers still needs further development:
-
Add support for SONOFF SWV1C and SWV2C water valves zha-device-handlers#4993
-
Add Sonoff SWV-ZFE smart water valve zha-device-handlers#4927
Official documentation is avalable here but does not cover any details on Zigbee clusters or attributes and such:
CNX Software has a nice writeup which covers use cases and features/functions exposed when used with Sonoff's own gateways and controlled with the eWelink app:
Also be aware Sonoff still sell their older model(s) of Zigbee Smart Water Valves without Flow Meter (but with "Flow Detection"):
- Sonoff SWV-NH (NH) original Sonoff SWV non-hydro model -> https://www.zigbee2mqtt.io/devices/SWV.html
- Sonoff SWV-BSP (BSP) the "old" original Sonoff SWV non-hydro model -> https://www.zigbee2mqtt.io/devices/SWV.html
Again note that the each Zigbee ID ships as two different models with different fittings, NH or BSP, for North America and Europe.

-
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Size
Area
Could you add zha application platform support for
valveentity as native device type in Home Assistant for valve devices? See:and
Update: Sounds as if this upstream Home Assistant core could also need a device class for "timed open" to the valve entity. See discussion:
This native Valve entity device type expose valves as more than a switch to show a valve in different states (Open, Opening, Closed, Closing, Stopped, Unavailable, Unknown, and current valve position), with device class for water, gas, or none.
It it primarly intended to replace switch/cover entities used today for these type devices as workaround, providing a dedicated entity type for controlling fluid/gas valves (water, gas, irrigation), not only allowing for states like open, closed, opening, and closing, but also supports partial opening (set_valve_position) for percent control, so that a valve state does not always need to be open or close (like a switch is always either ON or OFF) but can also optionally expose opening percentage in the device preferences, (however that is one one of the key difference between non-Zigbee valves is that some non-Zigbee devices have a better ways of exposing Valve open percent control).
Anyway, currently the Valve entity looks to only be supported in the zha integration as an extension of the switch or cover entiry as an such is not presented in Home Assistant as a "Valve" entiry but instead as a switch or cover entiry.
(The workarounds that users are using now because this is missing in ZHA is to change the entity type from swich to valve in the entity settings or use the "Change device type of a switch" helper integration).
The native Valve entity device type was introduced as a new new entity type in Home Assistant 2024.1 (January 2024) release:
Initially this new Valves so far support the following device classes:
Ideally, we want to combine this with ZHA device handlers to present correct device type of each product model in Home Assistant to know if something that today just expse a switch should instead in the future really be exposes as a valve in ZHA. As relevant to the the roadmap work on the upcoming improving experience when add device class to a new device via a device database:
First device setup wizard focusing on Matter devices OpenHomeFoundation/roadmap#31
As an proof-of-concept and code example see Matter Valve:
Another one with more features/functionality is the MQTT Valve (which is part of the mqtt component in Home Assistant code):
https://www.home-assistant.io/integrations/valve.mqtt
Yet another integration with the Valve entiry is SmartThings:
https://www.home-assistant.io/integrations/smartthings/
Update: And also Shelly too now:
Currently, many other integrations also have native support valves and now provides a valve entity (which also means that the valve entities also work with Home Assistant Voice, Amazon Alexa, and Google Home).
Many new existing new products include valves for pools, sprinkler systems, garden watering, and main water lines, or house gas valves.
Most are just generic shut off valves products that that simply expose either state and position or just on and off via a switch, but quickly looking through list of other water shutoff valves on Z2M supported devices it seems some expose it differently:
https://www.zigbee2mqtt.io/supported-devices/#s=valve
https://www.zigbee2mqtt.io/devices/SWV-ZF2.html
https://www.zigbee2mqtt.io/devices/ZVL-DUAL.html
https://www.zigbee2mqtt.io/devices/ZVG1.html
https://www.zigbee2mqtt.io/devices/TS0601_water_switch.html
https://www.zigbee2mqtt.io/devices/ZVL-DUAL.html
https://www.zigbee2mqtt.io/devices/QT06_2.html
https://www.zigbee2mqtt.io/devices/GX02.html
https://www.zigbee2mqtt.io/devices/VA4220ZB.html
https://www.zigbee2mqtt.io/devices/LYAI-14.html
https://www.zigbee2mqtt.io/devices/L14.html
Then that "valve" device type will compliment the other device types entities that the ZHA integration already supports as application platforms within Home Assistant, i.e.:
PS: Off-topic here, but FYI, for reference, noted that there are a few others as well that are starting to ask for a new device type component for "irrigation system" as well in Home Assistant as that is a new device type now supported by the Matter standard and the HomeKit specification, (i.e. an additional new device type that is specifically used to control a group of irrigation zones for watering landscapes with multi-zone sprinklers or gardening beds, with the main difference that a single "irrigation system" device will have several device entities for zones which are sub-components the main device, but do not act as a hub managing multiple separate devices).