openhab-addons icon indicating copy to clipboard operation
openhab-addons copied to clipboard

[hydrawise] Communication error

Open clown-m opened this issue 11 months ago • 49 comments

I upgraded to 4.1.2 today while i saw that there is an authorization bugfix in the hydrawise binding done, but still i got this message after the upgrade in the BASIC UI Thing setup:

COMMUNICATION_ERROR
Request failed with HTTP status code: 400 response: {"errors":{"message":"Could not resolve promise"}}_

I am running the Hydrawise Binding on openHAB 4.1.2 stable version on a Debian Buster Machine.

This failure comes up since some days, all other APP's are running as normal.

Any idea?

clown-m avatar Mar 24 '24 13:03 clown-m

{"errors":{"message":"Could not resolve promise"}}_

Hmm, that's an error coming from the Hydrawise servers, seems like they have a bug, although i'm not sure why its working for me and others and not your account. You want want to try deleting the "account" and "controller" thing and add them back new.

digitaldan avatar Mar 24 '24 15:03 digitaldan

I removed already the Binding and the account thing's. No success, still did not work

clown-m avatar Mar 24 '24 15:03 clown-m

I started the DEBUG mode, here is the log entry:

org.openhab.binding.hydrawise.internal.api.HydrawiseConnectionException: Request failed with HTTP status code: 400 response: {"errors":{"message":"Could not resolve promise"}}
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.sendGraphQLRequest(HydrawiseGraphQLClient.java:315) ~[?:?]
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.sendGraphQLQuery(HydrawiseGraphQLClient.java:261) ~[?:?]
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.queryControllers(HydrawiseGraphQLClient.java:115) ~[?:?]
        at org.openhab.binding.hydrawise.internal.handler.HydrawiseAccountHandler.poll(HydrawiseAccountHandler.java:232) ~[?:?]
        at org.openhab.binding.hydrawise.internal.handler.HydrawiseAccountHandler.poll(HydrawiseAccountHandler.java:227) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
        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:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:840) [?:?]
2024-03-24 17:23:01.729 [DEBUG] [rnal.handler.HydrawiseAccountHandler] - Will try again during next poll period
org.openhab.binding.hydrawise.internal.api.HydrawiseConnectionException: Request failed with HTTP status code: 400 response: {"errors":{"message":"Could not resolve promise"}}
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.sendGraphQLRequest(HydrawiseGraphQLClient.java:315) ~[?:?]
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.sendGraphQLQuery(HydrawiseGraphQLClient.java:261) ~[?:?]
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.queryControllers(HydrawiseGraphQLClient.java:115) ~[?:?]
        at org.openhab.binding.hydrawise.internal.handler.HydrawiseAccountHandler.poll(HydrawiseAccountHandler.java:232) ~[?:?]
        at org.openhab.binding.hydrawise.internal.handler.HydrawiseAccountHandler.poll(HydrawiseAccountHandler.java:252) ~[?:?]
        at org.openhab.binding.hydrawise.internal.handler.HydrawiseAccountHandler.poll(HydrawiseAccountHandler.java:227) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
        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:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:840) [?:?]

clown-m avatar Mar 24 '24 16:03 clown-m

Can you turn on TRACE logging and see what we are sending? I wonder if its choking on a GraphQL variable that maybe is not supported in your region.

digitaldan avatar Mar 24 '24 16:03 digitaldan

Ok, here is the TRACE 👍

2024-03-24 17:34:02.782 [DEBUG] [rnal.handler.HydrawiseAccountHandler] - Handler initialized.
2024-03-24 17:34:04.087 [TRACE] [l.api.graphql.HydrawiseGraphQLClient] - Sending Request: {"query":"{\n  me {\n    email\n    lastContact\n      controllers {\n      id\n      name\n        status {\n        summary\n        online\n        lastContact {\n          timestamp\n        }\n      }    \n      location {\n        coordinates {\n          latitude\n          longitude\n        }\n        forecast(days: 3) {\n          time\n          updateTime\n          conditions\n          averageWindSpeed {\n            value\n            unit\n          }\n          highTemperature {\n            value\n            unit\n          }\n          lowTemperature {\n            value\n            unit\n          }\n          probabilityOfPrecipitation\n          precipitation {\n            value\n            unit\n          }\n          averageHumidity\n        }\n      }\n      zones {\n        id\n        name\n        status {\n          suspendedUntil {\n            timestamp\n          }     \n        }\n        icon {\n          id\n          fileName\n          customImage {\n            id\n            url\n          }\n        }\n        number {\n          value\n          label\n        }\n        scheduledRuns {\n          summary\n          currentRun{\n             id\n            startTime {\n              timestamp\n            }\n            endTime {\n              timestamp\n            }\n            duration\n            status {\n              value\n              label\n            }\n          }\n          nextRun {\n            id\n            startTime {\n              timestamp\n            }\n            endTime {\n              timestamp\n            }\n            duration\n          }\n        }\n      }\n      sensors {\n        id\n        name\n        input {\n          number\n          label\n        }\n        status {\n          active\n          waterFlow {\n            value\n            unit\n          }\n        }\n        model {\n          modeType\n          active\n          offLevel\n          offTimer\n          delay\n        }\n      }\n    }\n  }\n}"}
2024-03-24 17:34:04.988 [TRACE] [l.api.graphql.HydrawiseGraphQLClient] - Received Response: {"errors":{"message":"Could not resolve promise"}}
2024-03-24 17:34:04.989 [DEBUG] [rnal.handler.HydrawiseAccountHandler] - Retrying failed poll
org.openhab.binding.hydrawise.internal.api.HydrawiseConnectionException: Request failed with HTTP status code: 400 response: {"errors":{"message":"Could not resolve promise"}}
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.sendGraphQLRequest(HydrawiseGraphQLClient.java:315) ~[?:?]
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.sendGraphQLQuery(HydrawiseGraphQLClient.java:261) ~[?:?]
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.queryControllers(HydrawiseGraphQLClient.java:115) ~[?:?]
        at org.openhab.binding.hydrawise.internal.handler.HydrawiseAccountHandler.poll(HydrawiseAccountHandler.java:232) ~[?:?]
        at org.openhab.binding.hydrawise.internal.handler.HydrawiseAccountHandler.poll(HydrawiseAccountHandler.java:227) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
        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:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:840) [?:?]
2024-03-24 17:34:04.994 [TRACE] [l.api.graphql.HydrawiseGraphQLClient] - Sending Request: {"query":"{\n  me {\n    email\n    lastContact\n      controllers {\n      id\n      name\n        status {\n        summary\n        online\n        lastContact {\n          timestamp\n        }\n      }    \n      location {\n        coordinates {\n          latitude\n          longitude\n        }\n        forecast(days: 3) {\n          time\n          updateTime\n          conditions\n          averageWindSpeed {\n            value\n            unit\n          }\n          highTemperature {\n            value\n            unit\n          }\n          lowTemperature {\n            value\n            unit\n          }\n          probabilityOfPrecipitation\n          precipitation {\n            value\n            unit\n          }\n          averageHumidity\n        }\n      }\n      zones {\n        id\n        name\n        status {\n          suspendedUntil {\n            timestamp\n          }     \n        }\n        icon {\n          id\n          fileName\n          customImage {\n            id\n            url\n          }\n        }\n        number {\n          value\n          label\n        }\n        scheduledRuns {\n          summary\n          currentRun{\n             id\n            startTime {\n              timestamp\n            }\n            endTime {\n              timestamp\n            }\n            duration\n            status {\n              value\n              label\n            }\n          }\n          nextRun {\n            id\n            startTime {\n              timestamp\n            }\n            endTime {\n              timestamp\n            }\n            duration\n          }\n        }\n      }\n      sensors {\n        id\n        name\n        input {\n          number\n          label\n        }\n        status {\n          active\n          waterFlow {\n            value\n            unit\n          }\n        }\n        model {\n          modeType\n          active\n          offLevel\n          offTimer\n          delay\n        }\n      }\n    }\n  }\n}"}
2024-03-24 17:34:05.272 [TRACE] [l.api.graphql.HydrawiseGraphQLClient] - Received Response: {"errors":{"message":"Could not resolve promise"}}
2024-03-24 17:34:05.273 [DEBUG] [rnal.handler.HydrawiseAccountHandler] - Will try again during next poll period
org.openhab.binding.hydrawise.internal.api.HydrawiseConnectionException: Request failed with HTTP status code: 400 response: {"errors":{"message":"Could not resolve promise"}}
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.sendGraphQLRequest(HydrawiseGraphQLClient.java:315) ~[?:?]
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.sendGraphQLQuery(HydrawiseGraphQLClient.java:261) ~[?:?]
        at org.openhab.binding.hydrawise.internal.api.graphql.HydrawiseGraphQLClient.queryControllers(HydrawiseGraphQLClient.java:115) ~[?:?]
        at org.openhab.binding.hydrawise.internal.handler.HydrawiseAccountHandler.poll(HydrawiseAccountHandler.java:232) ~[?:?]
        at org.openhab.binding.hydrawise.internal.handler.HydrawiseAccountHandler.poll(HydrawiseAccountHandler.java:252) ~[?:?]
        at org.openhab.binding.hydrawise.internal.handler.HydrawiseAccountHandler.poll(HydrawiseAccountHandler.java:227) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
        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:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:840) [?:?]

clown-m avatar Mar 24 '24 16:03 clown-m

Can you try something for me?

  1. Login to the web hydrawise app at https://app.hydrawise.com/
  2. After you successfully log in, go to https://app.hydrawise.com/api/v2/graph/explore
  3. Enter the following in the pane on the left, then click the Play button at the top, and report back the result in the right pane. I have a screenshot below of what it looks like for me.
{
  me {
    email
    lastContact
      controllers {
      id
      name
        status {
        summary
        online
        lastContact {
          timestamp
        }
      }    
      location {
        coordinates {
          latitude
          longitude
        }
        forecast(days: 3) {
          time
          updateTime
          conditions
          averageWindSpeed {
            value
            unit
          }
          highTemperature {
            value
            unit
          }
          lowTemperature {
            value
            unit
          }
          probabilityOfPrecipitation
          precipitation {
            value
            unit
          }
          averageHumidity
        }
      }
      zones {
        id
        name
        status {
          suspendedUntil {
            timestamp
          }     
        }
        icon {
          id
          fileName
          customImage {
            id
            url
          }
        }
        number {
          value
          label
        }
        scheduledRuns {
          summary
          currentRun{
             id
            startTime {
              timestamp
            }
            endTime {
              timestamp
            }
            duration
            status {
              value
              label
            }
          }
          nextRun {
            id
            startTime {
              timestamp
            }
            endTime {
              timestamp
            }
            duration
          }
        }
      }
      sensors {
        id
        name
        input {
          number
          label
        }
        status {
          active
          waterFlow {
            value
            unit
          }
        }
        model {
          modeType
          active
          offLevel
          offTimer
          delay
        }
      }
    }
  }
}
image

digitaldan avatar Mar 24 '24 18:03 digitaldan

Ok Dan, here is the result of the query:

{ "errors": [ { "message": "Schema does not define the required query root type.", "extensions": { "category": "graphql" }, "locations": [ { "line": 1, "column": 1 } ] } ] }

clown-m avatar Mar 24 '24 18:03 clown-m

can you post a screen shot ? Does the left panel show any red, like its malformed ?

digitaldan avatar Mar 24 '24 18:03 digitaldan

also make sure these are selected

image

digitaldan avatar Mar 24 '24 18:03 digitaldan

Ok, here is what you want, no red on the left side

image

clown-m avatar Mar 24 '24 18:03 clown-m

image

clown-m avatar Mar 24 '24 18:03 clown-m

hmm, so odd, does your system show online when you login to the webportal?

image

digitaldan avatar Mar 24 '24 18:03 digitaldan

Yes both Hydrawise Controller are online and attached to the WLAN

clown-m avatar Mar 24 '24 18:03 clown-m

image

clown-m avatar Mar 24 '24 18:03 clown-m

can you try removing sections in the GraphQL query and run again? I would start by removing forecast first

forecast(days: 3) {
...
}

then if that still breaks, remove zones, then sensors? I'm trying to isolate this to a specific part of the query thats breaking it for your account, I'm not sure what they don't like in it.

digitaldan avatar Mar 24 '24 18:03 digitaldan

I reduced the forecast up to this

forecast(days: 3) { time }

Still errors, only if i take it completly out, then it works

clown-m avatar Mar 24 '24 19:03 clown-m

Ahhh, ok , thanks for doing that. i figured the broken promise on their end was trying to hit some 3rd party service. Let me think how i can fix this and still keep weather for the users where it works.

digitaldan avatar Mar 24 '24 19:03 digitaldan

Does the forecast works on your implementation? Where could i find the docu, on the hunter site is only an email address to ask questions?

clown-m avatar Mar 24 '24 19:03 clown-m

It does, and it works for others, but the API is not supported by them for 3rd party use, so i would not go asking questions and bringing attention to our binding

digitaldan avatar Mar 24 '24 20:03 digitaldan

out of curiosity, if you go back to the original query and replace the forecast(days: 3) with forecast(days: 0) , and leave the rest of the body intact, does it work ?

digitaldan avatar Mar 24 '24 21:03 digitaldan

Dan, it give an error but the rest of the information seems to be ok.

image

clown-m avatar Mar 24 '24 21:03 clown-m

Gotcha, thanks. If i have to i might make the weather part an option of the controller thing, so it can be disabled, although i think its still odd the query causes their backend to generate an error like that. If this was a public API i would open a bug ticket up, but since its not, will just have to work around it.

digitaldan avatar Mar 24 '24 21:03 digitaldan

May be they do not offer the forecast feature for germany/europe? In your old version the forecast did not have values and i did not set them up, but it does not give me an error (just for your info). I do not really need the informations, i have a private weather station and send these data to weather underground and wu send the data to Hydrawise, so my data will end in my controller at the end.

clown-m avatar Mar 24 '24 21:03 clown-m

May be they do not offer the forecast feature for germany/europe?

Thats my suspicion too, but a GraphQL service should be returning an empty result when no results are available, not an internal error (looks like nodejs maybe?) which is definitely a bug on their end . I'm going to probably send a test GraphQL request to test if weather is supported and drop it if its not. Hopefully its not too much work.

digitaldan avatar Mar 25 '24 13:03 digitaldan

Thanks for your support i really appreciate your work.

clown-m avatar Mar 25 '24 14:03 clown-m

If you need someone fpr testing, don't hesitate to ask, i am interested in your solution and using the software.

clown-m avatar Mar 25 '24 18:03 clown-m

Same problem on Account thing - Request failed with HTTP status code: 400 response: {"errors":{"message":"Could not resolve promise"}}

DenDeXTeR51 avatar Mar 25 '24 21:03 DenDeXTeR51

Where do you live? We think that Hydrawise did not offer the "forecast" in all countries, the problem seems to be, that Hydrawise answer this by an error message.

clown-m avatar Mar 26 '24 10:03 clown-m

Ukraine, forecast always work for me, so I dont know why its broken now... At HydraWise.com web-ui I see forecast and everything seems ok

DenDeXTeR51 avatar Mar 26 '24 10:03 DenDeXTeR51

@digitaldan Can you add to Binding configuration option "Do not load forecasts" if this solves issue? At least we will have working zone triggers....

DenDeXTeR51 avatar Mar 26 '24 10:03 DenDeXTeR51