Sonoff Zigbee Smart Water Valve

Alas, still seems to be a glitch in the matrix. I manually installed the 1.3.6 driver. Tested at short interval (100 seconds) and it worked flawless. Then I tested with 5 minutes (300 irrigation duration) and it didn't close by itself.

What I'm doing in RM is set the IrrigationDuration to 300, and next command opens the valve. No closing command since valve should close itself after 300 seconds right ?

Attached log / event at moment it should have switched off. Hope it makes any sense.



That’s strange, but I am testing in ideal conditions, my valve is on the desk very close to the hub…

I will dig further in the next days, I have one doubt that I can check.

1 Like

No rush. I just added the three close commands at the end of the script for now :slight_smile:

1 Like

It's not showing up as an option for mirroring in the inbuilt mirror app. I managed to get it to work in two different ways, actually. First with virtual switches and rules to keep them synced, and second I managed to get the community Google Home function working. I don't think you need to change anything at this point, at least not for me!

2 Likes

I ran into this at 15 minutes on the previous version (before the "it won't update status" changes). It was intermittent though. I didn't dig into it and just created a backup RM rule to make sure it was off. Once hurricane Helene passes I will dig into here too.

2 Likes

I am planning to dig to the bottom of this issue, a water valve should be 99.99% reliable!

What can be done on a driver level is to implement automatic retries for both open and close commands. If an open (or close) command is not confirmed by the device for 10 seconds, wait another 30 seconds and try again (3 times, for example). If all three attempts fail, send an event so that the RM rule can send alarm notifications.

In the last versions I have implemented some kind of workaround for updating the valve open status - the driver is sending first a standard 'zigbee.on()' command and then a second command 'onWithTimedOff(seconds)' - it may not be the correct way of implementing a timed on function. Will have to research and experiment more.

1 Like

Yes, would be nice to find out whether or not the valve itself is reliable with this feature. I'll be monitoring here. For the time being I'm just sending two close commands after every cycle, regardless. Better safe than drowned, is what I always say.

Just received delivery of my Sonoff and paired it to HE.

Driver Version is: 1.3.6 2024/09/23 12:55 PM
Advanced Device Details/Data reports: softwareBuild: 1.0.2

Testing it next to the computer (ie not yet connected to water), and only connected to HE (no Homekit or other integration) I noticed the following:

  1. Current States Valve does not update to closed when closed via Preferences Auto Off Timer.
    Set the Auto Off Timer to 10 seconds, then clicked Open on HE Device details page. The valve clicks, indicating it has opened, and the Current States Valve changes to open. About 10 seconds later, that valve clicks again, indicating it closed, but there is no change to the Current States Valve field; it remains showing open. Irrigation start time, end time, irrigation duration and last open duration are all accurate. Clicking refresh in the device details commands section updates the valve status. It does not update the irrigation end time.

  2. After item 1, if I have not clicked refresh, but click Close on the HE device details page, there is no audible click of the valve because it is already closed, but the Valve Status updates to closed, and the irrigation end time updates to the time I clicked close. Irrigation duration and last open duration do not change.

  3. If, while the valve is closed and showing closed (after item 2 above) I manually open the valve by pressing the button on the valve (and hear the click indicating it opened), the irrigation start time updates to when I pressed the button on the valve, but nothing else changes - the valve Status does not update to open, AND the auto off timer does NOT work; the valve will remain open indefinitely, and AFTER the auto off timer duration has passed, the button on the valve starts double blinking green about every 2 seconds. In this state, both Save preferences and Refresh will update the valve status, but not invoke the Auto Off.

  4. When it is in the state of item 3 above, if I press the button on the valve, the valve audibly clicks indicating it is closed, the irrigation end time updates and the Last Valve open duration updates, but neither the valve status or the irrigation duration update. Save preferences updates only the valve status to closed; irrigation duration remains.

  5. Changing the Preferences Auto Off Timer to 0 and setting the duration in the Device Set Irrigation Timer field (the latter has a reference to Auto Off in the small print) does not work; as soon as I click Save Preferences, the Device Set Irrigation Timer field reverts to 0.

To deploy this device, I need an Auto Off Timer that works regardless of whether the valve is turned on via an automation, via clicking the on button on a HE dashboard or device details page, or manually via clicking the button on the valve itself. It appears this last requirement is what is currently not working.

I have my Sonoff SWV valve updated to firmware version 1.0.3, but I don't think this makes a difference for the basic operations.

  • endpointId: 01
  • application: 10
  • firmwareMT: 1286-200A-00001003
  • inClusters: 0000,0001,0003,0006,0020,0404,0B05,FC57,FC11
  • manufacturer: SONOFF
  • model: SWV
  • outClusters: 000A,0019
  • softwareBuild: 1.0.3

When you click on the 'Set Irrigation Timer' button, do you see the 'irrigationDuration' state changing?
image
image

When you click on the open() button, the 'írrigationStartTime' should show the current time and the irrigationEndTime should show asterisks :
image

After 10 seconds, ther valve closing time and state should be reflected in the current states:
image

Have you tried pairing the valve for a second time to your hub (without deleting it) ?

2 Likes

Thank you so much for your help.

Yes. I used to put the value in and then click "Save". I just learned 2 days ago you have to click the box again.
[See Picture/Camera on Easy Dashboard - #6 by sburke781]

Yes, it does.

The closing time is reflected. However the "Valve" field still shows open.

Just tried that. If valve is opened via Device Details page and closed via 10 second auto off, "Valve" value still shows open after it closes. If I click "Refresh" or "Configure" it updates.

How do I go about updating from 1.0.2 to 1.0.3?
On my 1.0.2, in Current States, I also have this information that is different from yours (this is when valve autoclosed after 10 seconds)
image

Also:

  1. what is the difference between this in the Device Commands:
    image

and this in the Device Preferences?
image

  1. Does the Auto Off also extend to when the physical button on the device is pressed?
1 Like

Something is wrong with the automatic recognition of your device type.
Can you temporarily change the driver to the HE inbuilt 'Device' driver, then click on all the "Delete * " commands. This will clean up all the states and variables that have left from the previous tests.

Then assign again the "Tuya Zigbee Valve" driver. Click on the Initialize() button. Click also on the Ping() button.

Then refresh the web page in your browser (F5 in Chrome).

Do you see all the Current States as in my screenshot below?

Use the Ping() command to check your device's Zigbee connectivity. I see 'RTT: timeout!' in your screenshot — this means that the latest ping to the device has failed. The 'rtt' should be a numeric value, measuring the time in milliseconds between sending a simple command to the device and receiving the acknowledgment.

2 Likes

Changed "Type" to Hubitat System "Device" then clicked Save Device.
That brought up, in the Commands section, "Delete all Scheduled Jobs, "Delete all current states" "delete all child devices" "Delete all States", each of which I clicked, then I clicked "Save Preferences". All data in "Current States" then disappeared.

Selected "Tuya Zigbee Valve" driver, clicked Save Device, then clicked "Initialize"
This populated the current states, and now the power source is actually populated with the word "Battery" instead of a box, and the lqi and rssi match yours.
Then clicked on the "Ping" box, then F5.
Yes, now I see all the Current States as in your screenshot except rtt is the last value on mine, and the lqi, rssi and rtt values are different. rtt is 1791. I moved to within 10' from HE and hit Ping again and it reduced to 866, but later increased to 2127

Test #01
When "Set Irrigation Timer" in commands is set to 10, and "Auto Off timer (Irrigation Duration)" in Preferences is set to 0, and I click open in the Commands section, valve opens & reports "valve:open", then closes itself automatically after 10 seconds but still reports "valve: open". Clicking ping does not change that. Clicking refresh changes it to "valve: closed"

Test #02
When "Set Irrigation Timer" in commands is set to 10, and "Auto Off timer (Irrigation Duration)" in Preferences is set to 15, and I click open in the Commands section, valve opens & reports "valve:open", then closes itself automatically after 15 seconds but still reports "valve: open". Clicking ping does not change that. Clicking refresh changes it to "valve: closed"

Test #03
When "Set Irrigation Timer" in commands is set to 10, and "Auto Off timer (Irrigation Duration)" in Preferences is set to 15, and I click the button on the device, valve opens but still reports "valve:closed", and it does not close itself; after 10-15 seconds it just starts 2x blinking green and stays that way. Clicking ping does not change that. Clicking refresh changes it to "valve: open". Clicking Close on the device details page closes the valve and changes current state to "valve: closed"

Current States after the above:
image
Info from Device Details Data section:
image

ETA: Went back and numbered the above, then redid each test to grab the log data from each. Was going to post it but it so LOOONG I'm going to DM it to you. Interestingly this time for Test #02 the valve status did change to close on my screen (which might have something to do with switching between the log and device details screen; not sure), so I did a 2nd test, where it remained reporting open, and so I also sent you that data, as Test #02.2.

1 Like

Thank you for the detailed report, @calinatl !

I will analyze the logs as soon as I have the chance in the following days. I am still not sure why the open/closed state does not update automatically in your environment.

Have you tried pairing the device again to your hub (without deleting it)?
When you paired it to your hub for the first time, do you remember which HE driver was selected automatically? Some weird Tuya devices require that the correct driver was installed in advance, before pairing it to the hub, because the initialization/configuration commands are accepted only during a short time frame that follows the pairing. Sonoff devices typically do not need this, but I can't be 100% sure.

Sonoff SWV valve will also work with the HE-built 'Generic Zigbee Switch' driver. If you change to it and send several on/off commands, is the 'switch' attribute always updated correctly?

I'm interested in replacing a couple ob Bhyve hose controllers. Any idea what the range of these is? My ZigBee mesh is pretty solid. I want to place one of these about 50 feet from the nearest ZigBee repeater.

Yes, per your previous instruction.

No, I can't recall, but it definitely was not the Tuya Zigbee Valve, as I remember going to HPM to get that when I realized I did not have it.

Changed to the Generic Zigbee Switch driver, clicked "Save Device" then Configure, then Refresh. The Current States now have a switch: value.

  • When I turn the "switch" on and off from the HE Device Commands section, the switch: value properly updates between on and off. (The valve: value also remains on the Current States list but it no longer properly updates).
  • When I turn the "switch" on an off via the physical button on the Sonoff SWV, the switch: value also properly updates.

ETA: one other thing I noticed that might be helpful is that when using the Tuya Zigbee Valve driver, if I set the Preferences Auto off timer to 10, and do not enter anything in the Commands Set Irrigation Timer, then click Refresh from the HE device commands screen, then click Open from from the HE Device Commands:
a. When I first click open, the IrrigationDuration:, irrigationEndTime, IrrigationStartTIme, and lastValveOpenDuration all change from previous values to a string of **, and the valveStatus changes from shortage to clear (but valveStatus change is not 100% reliable)
b. About a second after I click the screen, the valve clicks indicating it is opening, and IrrigationDuration changes to 10, irrigationStartTime changes to the start time, valve changes to open, and workState changes from manual control to cycle timing / quantity control.
c. If the valveStatus changed to clear, it will auto shut off after 10 seconds, and IrrigationEndTime changes to the end time, lastValveOpenDuration populates, and workState changes back to manual control.
HOWEVER:
If, after doing a few cycles of the above and getting the same results (with valveStatus remaining clear), I decide to click the physical button on the Sonoff SWV to open it, I get different results
a. When I first click the physical button, only IrrigationStartTime changes to a string of **. IrrigationDuration:, irrigationEndTime, and lastValveOpenDuration all remain at their previous values. The valveStatus sometimes changes from clear to shortage or shortage to clear (but valveStatus change is not 100% reliable). WorkState remains manual control.
b. The device does not auto shut off. lastValveOpenDuration updates every minute, from 60, to 120, 180 etc. The valve does not AutoClose. In this state it looks like this, with the IrrigationEndTime BEFORE the IrrigationStartTime:
image
Sometimes, if I leave it open for a few minutes, valveStatus changes from clear to shortage.
c. If I click the HE device Command Close, irrigationEndTime and lastValveduration populate. It then looks like this:
image
Same result if I click the physical button on the device to close it.

The above results are the same if I enter 10 into the Set Irrigation Timer box and then click on the box.

I ran about 50+ tests to get the above write up. ONE TIME when I opened the valve from the physical button on the Sonoff, it did auto close in 10 seconds.

1 Like

For now I can think of two possible reasons for the inconsistent auto-off reporting : either a bug in the driver, or a bug in the Sonoff firmware version 1.0.2

To exclude the possibility of a firmware bug, can you make one more test ?

Install this driver :

https://raw.githubusercontent.com/dan-danache/hubitat/master/ikea-zigbee-drivers/Ikea_E1836.groovy

It is not written for this device, but for the Ikea Askvader On/Off Switch (E1836).
So there will be error in the live logs - ignore these errors, they do not affect the on/off operations. After changing the driver, click on the 'Configure' button once.

Enter '1' under the ''On With Timed Off' button : 1 (one) corresponds to 10 seconds auto-off timer for the Sonoff valve. Then click on the button above.

image

Observe the Current States 'switch' attribute - does it update reliably?
(again - ignore anything else and any errors in the logs).

This custom Ikea driver uses the same Zigbee command to automatically turn the switch off after a timeout, but the scaling is different ( 1 second for the Ikea switch equals 10 seconds for Sonoff).
If your Sonoff valve is controlled reliably and the state is always updated, then the problem that you observe may be in the Tuya driver.

Could there be something amiss with the valve itself? I have this valve and my software is 1.02 and am using this driver and the valve status is correct, even when manually operating the valve. I have attached a screenshot below of the valve for comparison.

If I can help at all with this let me know.

1 Like

@oldcomputerwiz This is very interesting. My Device Details data is exactly the same as yours.

  1. Are you saying that when you manually turn the valve on from the button on the valve not only does the Current States field valve: change, but the Current States field valveStatus: also changes?
    This is mine when closed:
    image
    And when opened via the button on the physical valve:
    image

  2. Do you have either the Commands section "Set Irrigation Timer" set for a specific duration or the Preferences section Auto off timer (Irrigation Duration) set for a specific duration? If so, if you press the physical button on the valve to open it, does it auto close after the set duration?

I guess I missed part of what is wrong. I thought you were having issues with whether the "valve" State followef the open and closed of the valve. Based on your response, this isn't what you are discussing so I apologize for interjecting. I'm curious, what should valve status change too when the valve is open and closed?

As for your second question, yes, I have a timeout set for 15 minutes and it works regardless of how the valve is turned on. I washed the vehicle last evening and had to keep manually turning on the valve because it was turning off after 15 minutes so I am 100% sure of this behavior. I use the 15 minutes when watering sections of the lawn

1 Like