Sonoff Zigbee Smart Water Valve

....aaaand it works as a charm. Valve status gets updated immediately, Thank you sir. Very well done indeed !

1 Like

The updated driver resolves the open/closed states. Thanks!

1 Like

Thank you for the tests! I have updated the production version of 'Tuya Zigbee Valve' to 1.3.5 and it is now available for update via HPM.

4 Likes

Hmmm. This is probably me doing something wrong. But I set up basic rule to open valve 15 minutes, then shut it down. I had set Irrigation Timer value to 900, which should cover the 15 minutes. I had done this for two valves that I installed. Both started properly at the assigned time, but closed after exactly one minute. Some screenshots attached from devices and events list. What is going wrong ?




... and the logs at the moment the valve closed after one minute.

I found a suspect:

@Field static final Integer DEFAULT_AUTOOFF_TIMER = 60

Imma change that to 1000 and see if that does anything.

1 Like

This is the default value of the irrigation duration, if the 'autoOffTimer' (from the Preferences section) is not set...

Now I realize that the auto off function is always active, even if the timer is set to a big number like 9999.. I am going to add some logic to be able to disable the auto-off, so that the Sonoff valve can stay open until an explicit 'close' command is sent.

I'm an idiot. Never saw that preference setting. Thanks. :smiley:

Probably there is still an issue in the code, setting the irrigation timer from the button should also update the preference.

I reset autoofftimer in the code to 60. Updated the preferences to a higher number. For my info, what do I click to make it use the changed driver ? I click configure initialise refresh three times and that seems to do it. Wondering what the proper way is....

Testing now...

You don't need to click on Initialize of Configure buttons, the changes in the Preferences are accepted when you click on the 'Save Preferences' button.

I will make some minor improvements related to the autoOffTimer, please wait for the next update.

Save preferences also activates any hack changes I made in the driver code ?

My tests so far. When I had the autoofftimer variable at a high number, everything worked as expected. Open valve, irrigationStartTime gets updated, volume rises etc etc.

Clicking on close the valve, irrigationEndTime gets updated, and lastValveOpenDuration gets updated. All normal.

When I changed the variable back to the default 60 seconds, everything works, but what threw me off was that after 60 seconds open, the lastvalveopenduration gets updated to 60.
First I thought the valve had closed, but in fact it hadn't. The duration gets updated every 60 seconds, to 120, 180, 240 etc. That was the only thing.

Thanks so far though !

1 Like

This is hopefully the last update (for today :slight_smile: ) :
ver. 1.3.6 2024-09-23 - Sonoff valve:

  • irrigationDuration 0 will disable the valve auto-off;
  • default auto-off timer changed to 0 (was 60 seconds);
  • invalid 'digital' type of autoClose fixed;
  • added workState attribute;
  • logging improvements;

The default value of 60 seconds for the auto-off timer was chosen randomly, now I think that a default value of 0 (disabled) is a better approach.

Both the dev. and the main branches are updated to ver. 1.3.6 and available for manual update, but the automatic update via HPM is not pushed for now.

2 Likes

Thanks man. Very much appreciated.

These Sonoff valves are great from what I've seen so far. Of course I'll have to see the battery life on them and general durability. But for the price it's difficult to ignore. I will order some extra.

One last question: The irrigationDuration is something inside the valve ? So if I set it to 15 minutes, and somewhere in between the valve loses connection to the hub, does it still turn off after 15 minutes ? If that's the case then that's probably the way to go in using these valves right ? As opposed to Rule Machine them open / closed on a schedule.

Yes, when the irrigationDuration timer is set, the Sonoff valve will be shut off automatically when the timer expires, even if the connection to the hub was lost. This is a very nice feature!

When the valve is auto-closed (or closed by pressing the physical button on the device), you should see a text [physical] in the logs. When the valve was closed by the HE 'close' command, the log will include [digital].
(physical/digital was the bug fixed in the latest update).

1 Like

Awesome. I'll go that route then. Until now I've been sending three close commands 30 seconds apart after a cycle because I have a big garden and the grid is not always 100% stable. Thx.

Was trying to add this to my Google Home from Hubitat, and it turns out Google Home won't connect with valves. I tried creating a virtual valve and it wouldn't sync with Home either, but I created a virtual switch and that synced. I was hoping I could just use the switch binding functionality in Hubitat, but the valve doesn't report itself as a switch to make it available. Outside of making some rules in rule machine, is there a way to get this to show up as a device in Google Home, or a quick way to sync it to a virtual switch? I'll probably just make some rules for now, but hoping to learn something new if there's functionality I'm missing already.

The native Google Home app is pretty limited in what types of devices it can pass to Google -- you could try the community Google Home integration instead.

If you end up keeping your switch setup, you'll have to set up rules to manage the device-to-device coordination.

1 Like

Wasn't aware of the community Home integration. Looks like I'll spend a bit of time looking in to that! Thanks.

Have you tried the HE inbuilt Mirror app?
Create a virtual switch and then sync the valve open/closed states to the virtual switch off/on states.

I could add a Switch capability to the Tuya Valve driver, but I am not sure whether this will not mess with some other application (HomeKit as an example)…

1 Like