Zigbee2MQTT - Controlling water valves but with unwanted auto-off behavior

I am trying to use some Moes ZWV-YC water valves with home assistant and zigbee2mqtt, I have added them to my z2m and am able to switch them on and off, as well as view their battery level. However they are showing some unwanted behavior where they always seem to switch themselves off 10 minutes after I switch them on.

This happens whether I use the device on/off switch in HA, or if I use the on/off in zigbee2MQTT WebUI on the device’s ‘exposes’ tab. Also if I publish a message to MQTTExplorer for the topic: zigbee2mqtt/watering_hose_2/set with payload: { "state": "ON" }

The devices are documented here:

The documentation says that “When setting the state to ON, it might be possible to specify an automatic shutoff after a certain amount of time. To do this add an additional property on_time to the payload which is the time in seconds the state should remain on…”

When I look at the ‘Exposes’ tab for the device on the zigbee2mqtt web ui, it only shows Battery, State and LinkQuality.

So I tried sending a command to the device with the dev console (I am not experienced with this stuff, used chatgpt to help with the hex codes, and trial and error to get the correct ontime and offwaittime field names)

Using the dev console to send such a message to cluster 0x0006 and command 0x42 with payload

{"ctrlbits": 0, "state" : "ON", "ontime": 300, "offwaittime": 120}

But the state does not change to ON. I am not sure whether these ontime or offwaittime are really supported, however if I just send the state:ON in the payload, I get an error back that the ontime and offtime parameters are missing.

I have also tried to publish a message to MQTTExplorer for the topic: zigbee2mqtt/watering_hose_2/set with payload: { "state": "ON", "on_time": 60 } (intending for 60 seconds) - this command has no effect. However if I change the payload to { "state": "ON", "ontime": 60 } then actually it does switch ON, but remains on for 10 minutes before switching off, so it just disregards the ontime.

Anyway, since I was stuck here, I tried writing a script that would send another ON message to the device after 9 minutes in the hope that it would reset the built in 10 minute OFF timer on the device.

Again, this didn’t work either. The messages were sent, but the device still switched itself off 10 minutes after the initial ON message.

The log output is as follows:

info 2025-05-14 15:52:36z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/watering_hose_1', payload '{"battery":47,"linkquality":255,"state":"ON"}'
info 2025-05-14 16:01:36z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/watering_hose_1', payload '{"battery":47,"linkquality":255,"state":"ON"}'
info 2025-05-14 16:02:36z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/watering_hose_1', payload '{"battery":47,"linkquality":255,"state":"OFF"}'

In the above, the ON messages correspond to my attempts to switch the device to ON, while the OFF message does not relate to any action in HA or z2m, so I can only assume it’s the device sending this. Note that it’s exactly 10min after the on message.

So now I am a bit stuck. The valves turning themselves off was not something I had expected, and it’s a problem for me, because I have a zigbee controlled electric pump supplying water to the system, so it’s bad for the pump and for my connections that the valves can just close themselves when they want.

What can I do? I don’t actually want to use on with timed off at all. Most of all I just wish that these valves would just stay on when I send them a command to be on, it seems like madness that they insist on only staying on for only 10 minutes.

My HA version info is:
Core 2025.4.4
Supervisor 2025.05.1
Operating System 15.2
Frontend 20250411.0
Zigbee2Mqtt version: 2.3.0-1

@fergus3000 did you find anything on this?
I am facing exactly the same issue.

What question did you pose to ChatGPT?

Having the same issue

Same here. I tried exactly the same things than @fergus3000 with the same results. Found that thread after my fails.

Also tried it with a tuya zigbee gateway. I’m able to use a different value there. But that only works with the active tuya app and then there is no parallel connection to home assistant possible. I’ll try another zigbee gateway.

Same issue here.

I’m trying this on HA Developer Tools:

service: mqtt.publish
data:
  topic: zigbee2mqtt/Válvula_Irrigação_Varanda_Suíte/set
  payload: '{"state": "ON", "on_time": 10, "off_wait_time": 0}'

Then I get this error:

Publish 'set' 'state' to 'Válvula Irrigação Varanda Suíte' failed: 'Error: ZCL command 0xa4c138c78586f314/1 genOnOff.onWithTimedOff({"ctrlbits":0,"ontime":100,"offwaittime":0}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":false,"direction":0,"reservedBits":0,"writeUndiv":false}) failed ({"target":17598,"apsFrame":{"profileId":260,"clusterId":6,"sourceEndpoint":1,"destinationEndpoint":1,"options":4416,"groupId":0,"sequence":189},"zclSequence":110,"commandIdentifier":11} timed out after 10000ms)'

It works if I leave the payload as '{"state": "ON"}' only.

Gemini suggests that this could be due to a low Zigbee signal, despite the current LQI being 120.

I’ll update here if I find a solution, and I appreciate it if anyone could share a solution. In the meantime, I’ll continue using a timer to keep it up to 1 minute. It seems like it’s still limited to 10 min max if not closed manually.

It could be a language issue, but the “might” in the Z2M docs actually mean "there’s a good chance it won’t work.

When setting the state to ON, it might be possible to specify an automatic shutoff after a certain amount of time.

That paragraph is present in most Z2M devices with an on/off service. While, in theory, it should be part of the base zigbee specification, that command almost never works.

The valve turning off automatically after some time sounds exactly like the issue that the SWV had initially. Basically, it’s some kind of safety feature built into the device.
Check if you have any firmware updates available, if not, contact the manufacturer.
@fergus3000 @anujtripathi04 @zbuh @Eisbaer2 tagging you in case you need to put pressure on the manufacturer to release an updated firmware

I don’t think there’s a big chance for a firmware update. But we could try. Anybody knows how to contact the manufacturer?

I have a kind of solution: I bought a “MOES Multi Mode Tuya Smart Gateway ZigBee Bluetooth Mesh Hub” on aliexpress (https://de.aliexpress.com/item/1005006022604588.html). With that I could change the power off to 3h (and even more) and the value is saved even after directly connecting the valve to zigbee2mqtt again without the gateway.

Sorry I didnt update, I got a bit disheartened with the whole thing. Now a year on and I am still stuck with this as I am about to setup my irrigation - very interesting that the Gateway device mentioned by @Eisbaer2 is able to change the default timed off behavior of the valve - so it should be possible to configure the valve but the commands are unknown.

To answer the earlier question about my use of chatGPT, tbh I tend to be conversational, so it was pretty similar to what I wrote in my initial post. It could only help me up to a point though, and got into a circular rabbit hole of thinking it would know how to fix it. However I have got a years more experience with AI and chatGPT has improved too so I will try some more, probably might try claude too.

The solution I ended up with last year was that I had several of these valves connected to one pump source and I would alternately open one valve whenever the active valve was about to time out - it wasnt a great solution though, the communication from my house to the valves was unreliable, and having the pump on while all valves were closed ended up damaging the pump and the pipe connections. I was thinking about just abandoning these valves and getting a different brand, but they are quite expensive so I’ll have another go…

Alright - I have a little progress and some success. Now I can re-configure the timed off setting using a linux pc and a standard conbee controller.

Firstly, I tried again with a new chatgpt context, but still ended up going in circles with the chat telling me to do things, none of which worked. Since I am out of my depth I decided to use this as a case to try out claude code terminal. I had a spare conbee 3 controller, and an old laptop with a clean linux install, I plugged in the controller, installed claude code, and after quickly getting bored with pressing enter to let it take its next step, decided to put it into ‘dangerously-skip-permissions’ mode. This was really fun, I just occasionally made a comment or suggestion and let it get on with it, while I played Civilization on my other pc and occasionally listened to the valve clicking :sunglasses:

So after a while it seemed to get a handle on the problem, and figured out how to use a combination of deCONZ and zigpy to use some python scripts to configure my valve. I have successfully managed to set my timed off on my valve to 3 hrs. The entire write up and scripts are here - so this should be repeatable without using any AI helpers.

I have done this on my rack of 5 valves, and the 3 hr timer works great, even after I re-paired them with my z2m in home assistant. Now I am gonna get them out in my garden and start watering.

Still, I have one valve left that I have not yet re-configured - for this one I don’t care about the 10 minute cutoff, but I will use it for further testing and dev, once I am done with garden tasks :slight_smile:

My next steps will be to verify that I can actually configure the setting using my home assistant RPi as per my writeup. Then I have a couple of things that I’d like to try that might be impossible:

  1. See if I can disable the timed off altogether (not sure if that’s gonna possible)
  2. Try to make a PR for the zigbee2mqtt to add support for changing the timed off,

This was a fun little exercise, thanks for the clue about being able to configure the valves in Tuya!