[BUG] Hydrawise Binding - Scheduled runnable ended with an exception

Hi guys,

anyone else having trouble with the Hydrawise binding?

2020-05-03 14:26:04.317 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: null
        at org.openhab.binding.hydrawise.internal.HydrawiseCloudHandler.pollController(HydrawiseCloudHandler.java:127) ~[?:?]
        at org.openhab.binding.hydrawise.internal.HydrawiseHandler.pollControllerInternal(HydrawiseHandler.java:310) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

I created the thing as usual via PaperUI and pasted the API-Key from Hydrawise. Tried both variants with “-” and without between the brackets.

Thing-status stays “INITIALIZING”.

openHAB version is latest STABLE.

Thanks & KR

Hi,

tried with a different JDK - same issue;

2020-05-05 07:59:19.066 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: null
        at org.openhab.binding.hydrawise.internal.HydrawiseCloudHandler.pollController(HydrawiseCloudHandler.java:127) ~[?:?]
        at org.openhab.binding.hydrawise.internal.HydrawiseHandler.pollControllerInternal(HydrawiseHandler.java:310) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_252]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) ~[?:1.8.0_252]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_252]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[?:1.8.0_252]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]

EDIT #1: I’ve set up a fresh Debian VM, with Zulu8 and openHAB latest stable, with no binding installed except Hydrawise. Same error as above.

EDIT #2: following the code on GitHub, I manually tried the URL https://app.hydrawise.com/api/v1/customerdetails.php?api_key=XXXX-XXXX-XXXX-XXXX&type=controllers, getting back a valid JSON, so the issue must be something within the binding.

EDIT #3: I tried to set the optional “Controlled ID” from the JSON request in the thing configuration, that also didn’t help.

EDIT #4: following snippet’s URL is “file not found” (setcontroller.php).

private static final String SET_CONTROLLER_URL = BASE_URL
            + "setcontroller.php?api_key=%s&controller_id=%d&json=true";

EDIT #5: according to the API documentation there’s no setcontroller.php (anymore?). So that might be the case that the above mentioned exception is thrown. Already pinged @digitaldan.

EDIT #6: the following URLs are working, according to the API documentation;

https://api.hydrawise.com/api/v1/statusschedule.php?api_key=XXXX-XXXX-XXXX-XXXX&controller_id=YYYYYY
https://api.hydrawise.com/api/v1/customerdetails.php?api_key=XXXX-XXXX-XXXX-XXXX&type=controllers
https://api.hydrawise.com/api/v1/setzone.php?api_key=XXXX-XXXX-XXXX-XXXX&action=ZZZ

Hi , see this open issue for a summary of whats going on:

In short, Hydrawise suddenly changed their API and removed quite a bit of functionality, breaking most applications using it. There is another API that their own clients use (mobile/web) and other 3rd parties that i am now targeting. I just finished up last night most of the bits for this and will be posting a test version very soon. I’ll use the giuthub issue to keep people up to date.

2 Likes

Hi there,
many thanks for your fast reply - if you need testing, just drop me a line!

@digitaldan: I would be happy to help testing, too. Have the same issue and only just today got the hydrawise controller installed physically :slight_smile:

Really looking forward to having a working binding and appreciate your work!!

Best,
David

Hi @digitaldan,
switched to OH3, running Hydrawise binding for 3.0.0.

Still the same issue - binding is stuck in “Initializing”…

01-Jän.-2021 11:42:48.232 [WARN ] [re.internal.common.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: null
        at org.openhab.binding.hydrawise.internal.HydrawiseCloudHandler.pollController(HydrawiseCloudHandler.java:125) ~[?:?]
        at org.openhab.binding.hydrawise.internal.HydrawiseHandler.pollControllerInternal(HydrawiseHandler.java:309) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

Is there any workaround/JAR to get rid of this issue?

Many thanks & happy new year!

The binding is unfortunately not working, i had a build working with the new API, but left it unfinished, and move to other things. Its probably time for me to get back to that. Let me see if i can get that up and running and i will post a new jar back here as soon as I can. Thanks.

I have an updated Jar located at

Release Hydrawise 3.x pre release · digitaldan/openhab-addons · GitHub ,

This uses the new GraphQL API as they severely crippled the one we had been using. There is also a new Thing structure to the binding if you are coming from the one in 2.x that used the old API. The updated version has a "Account " bridge thing which represents your online account, then a “Controller” child thing which represents the actual sprinkler controller. You will need to remove your existing thing and then add a new Cloud thing (in the GUI) , the rest will be auto discovered and added to your inbox. There is an updated README that explains this at openhab-addons/README.md at hydrawise-api-change-3.x · digitaldan/openhab-addons · GitHub

1 Like

Hi @digitaldan, as always - many thanks for your fast reply and that lightspeed distribution.

Installing the JAR - works
Adding the bridge - works
Adding the controller - works (automatically in inbox)

Channels return results as intended.

Hi @digitaldan, many thanks also from my side.

Hi @digitaldan, I’m on 3.1.0.M5 and get this error when starting (your pre-release 3.1.0) bundle:

Error executing command: **Error executing command on bundles:**
**Error starting bundle 274: Could not resolve module: org.openhab.binding.hydrawise [274]**
**Unresolved requirement: Import-Package: javax.measure; version="[1.0.0,2.0.0)"**

I found the PR which changed the version:

Yeah, i just need to compile and post it again, i’lll try and get to it in the next few days

1 Like

new 3.1.x version out on Release Hydrawise 3.x pre release · digitaldan/openhab-addons · GitHub

Thanks a lot Dan, works great now.
Do you plan to add this to the openHAB repo?

Yes, and in fact i started cleaning it up for review. There was a ton of code changes, its basically a rewrite of the binding, so lots to review before i can submit.

2 Likes

Hi Dan, thanks for the binding, brilliant, a couple of questions if you can assist with Hydrawise over local thing giving response code 404.
Pro HC firmware 4.31, installed binding shipped with OpenHAB 3.2.0M5

  • Is this the correct one for local connection or the jar above pre-release 3.x is still the preferred atm?
  • How do I get access to the local username and password? I might be missing something obvious here … :grimacing:

Screen Shot 2021-12-19 at 3.35.04 am

Thanks!

The username and password will be in the settings menu on the unit itself, not through their app. Unfortunately they removed local access from later hardware versions some time ago, so its likely you may not have local access as an option, for example my firmware is 1.89 which is from around 2017 , i think it may have been removed in v2 or v3.

Thanks. Yep, looks like I don’t have that option.

hello dan,

I use openhab3 and have now installed the latest binding 3.2.
everything works so far. the bridge and the items are online.

But I can’t manage to OPEN the valves via openhab.
If I open the valves via app/browser/module, I can CLOSE it with openhab.

so, just the OPENING doesn’t work.
what am I doing wrong? can someone help me?

I use the following item to control…
{channel=“hydrawise:controller:…:zone1#run”}

thanks!

Can you print the the whole Item line please?