Collaboration on Developing a Hunter Hyrdrawise Irrigation App/Driver

Heh, it goes both ways. If I had tested installing even once I would have found your first installation issue. :wink:

Got it installed and it is definitely reading data from the controller... now I have to play with it and see if I can drown my flowers!

1 Like

Tom this is great, thank you very much for enabling this.

Now this is definitely me being stupid, but I can't work out how to un-suspend a zone. I currently use IFTTT to suspend/unsuspend zones based on soil moisture levels (the moisture sensors aren't connected to the Hydrawise controller) and pass "-1" to the api

(https://app.hydrawise.com/api/v1/setzone.php?api_key={controllerID}&action=suspend&relay_id= {{relayID}}&custom=-1)

but if I put "-1" in the string the log kicks out an error:

" dev:1282021-06-07 10:02:05.094 errororg.codehaus.groovy.runtime.InvokerInvocationException: java.text.ParseException: Unparseable date: "-1" (suspendZone)"

From what I can see in the code (I am not a developer...) you are expecting a date in the suspend command, so I tried setting a date to today, or a minute ago but the result was an even longer suspension.....to the year 53401 to be exact!

2021-06-07 10:25:43.072 debugSuspending Lawn Front Left till Sunday, 21st of June 53401, 09:00AM (United Kingdom Time)

Could you let me know how I can achieve an "un-suspend"?

Thanks again for the excellent work.

Marc

I'm not sure, exactly, as @JustinL implemented that functionality and I never tested it.

With that said, as a total guess -- maybe it doesn't like dates in the past, so perhaps you could try setting it to something in the near future, like a minute or an hour or a day in the future. We could also just add a special case to handle a "-1" input the way you described.

I also don't know about this system, but in other APIs I have used the timezone offset was sometimes confusingly included. @JustinL, do you recall what you had to do to un-suspend when you were making this support?

No, I don’t recall. The Hunter API documentation is slim at best. It makes no mention of setting -1 as the time, so the code does not expect it either. I don’t know what to tell you other than my reading of the API (and the integration) assumed a run command would unsuspend a zone.
https://support.hydrawise.com/hc/en-us/article_attachments/360058265154/Hydrawise_REST_API.pdf

Our time developing this was so short and we abandoned it fairly quickly. Especially since we don’t have any way to test it anymore, I am afraid I won’t have much more to offer than that. The best bet for this would be for a developer with a Hunter system to take over the code.

To say the API is slim is an insult to slim APIs, it's as if they created it reluctantly and they haven't made the documentation any clearer over the years. I got the following response in 2016 from Hydrawise (before they sold to Hunter) when I asked about un-suspending a zone:

"I think there's a mistake in the documentation for suspending a zone. The 'custom' value should be the UNIX epoch that the zone should be suspended until (not the number of seconds from now). To unsuspend just send the suspend command again then give a UNIX epoch time of right now."

Creating a Unix Epoch time was beyond my capabilities....but then I discovered that putting a 0 or a -1 in there works too.

This is just FYI.....I am certainly not asking for any code changes, you guys making this available is an enormous help in itself.

Marc

I sent a quick pass at an "unsuspendZone" command in PM. Please let me know if it works out and I will add it.

@defenderdogs helped me track down a couple of bugs in the code, and testing shows that suspendZone (with "YYYY-MM-DD" format) and unsuspendZone are working correctly.

I posted the updated Hunter_Hydrawise_Zone driver code updated the version to 1.0.1 for HPM.

I am late for the resumption of the party.

I installed the Hydrawise System driver which installed the Hydrawise Controller as a child.

The controller happily cycles through if I do "Run All Zones." That's a great sign!!

I installed a driver for a Zone and used the API, Controller code (The same one as in the Controller driver), and "6" as the zone for a set of sprays I can see from my desk. The Zone does not respond to "Open" or "Run Zone." What did I miss?

If developers ever need to log onto a system, I will be happy to Zoom and let you take over my Hubitat GUI.

Thanks,
Jason

Never mind.
I looked at the readme in the github.
I found the Children under the controller.
They work as designed!
I must remember - RTFM.

Jason

1 Like

I think the API restricts you to three requests per 30 seconds per this page - Hydrawise API Information – Hydrawise

1 Like

Hey guys. Thanks for this. It's basic but still works. I wanted to add the ability to turn the sprinklers on via google assistant command and this did the trick. I set up a virtual switch for on and off, shared it through the Google Home app, and have a rule that handles turning the sprinkler on and off via those.

One suggestion to tomw or whomever is maintaining the code, would be to add a valve capability the controller driver. When setting up rule machine and "run custom action" I could only select and control the individual zones, when what I wanted to do was control the "run all zones" command, which is on the controller device rather that the individual zone devices. I modified the driver code for the controller to add a valve capability, which then allowed me to select the "run all zones" command.

@corey, does it still work if you add capability "Actuator" rather than valve? runAllZones is a custom command, and it doesn't support the other commands required by valve. So, I'd prefer a more generic capability that will still work.

Just tested by switching it from Valve to Actuator in the driver and that works just fine as well. Thanks for the suggestion. Like I stated, I was just trying to find a way to run the "Run All Zones" command from rule machine.

1 Like

Awesome, thanks. I just updated to include that capability on GitHub and also bumped the version for HPM to 1.0.2.

Tom-
Fyi there's an error in the zone driver code you just published. It's causing HPM to fail. I tried updating the driver manually and get this:

Method definition not expected here. Please define the method at an appropriate place or perhaps try using a block/Closure instead. at line: 430 column: 1. File: Script1.groovy @ line 430, column 1.

That is odd. Are you sure it was my driver? None of the three have >400 lines. And I just installed successfully using HPM from this URL: https://raw.githubusercontent.com/tomwpublic/hubitat_hydrawise/main/packageManifest.json

It also worked when I grabbed this code and manually saved it into the Drivers Code section on Hubitat: https://raw.githubusercontent.com/tomwpublic/hubitat_hydrawise/main/Hunter_Hydrawise_Zone

Weird. It's giving me this:

That is weird. Can you turn on logging for HPM and then run the upgrade with the Log window open to see if any other clues pop out?

I'm rebooting my hub quick. I saw another goofy SQL error so maybe it's all related.