core icon indicating copy to clipboard operation
core copied to clipboard

Hydrawise throwing lot of errors since a few days

Open N3rdix opened this issue 1 year ago • 4 comments
trafficstars

The problem

Since a few days I receive a lot of errors in regular intervals for the hydrawise integration which seems to be related to the API. Is anyone else facing the same issue? Although the integration seems to work normally it doesn't feel right to ignore the errors...

The debug log does not show any additional information unfortunately...

What version of Home Assistant Core has the issue?

2024.3.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

hydrawise

Link to integration documentation on our website

https://www.home-assistant.io/integrations/hydrawise

Diagnostics information

Errors:

2024-04-15 14:05:14.788 ERROR (MainThread) [homeassistant.components.hydrawise] Error requesting hydrawise data: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://api.hydrawise.com/api/v1/statusschedule.php?api_key=XXX&controller_id=XXX')
2024-04-15 15:18:54.092 ERROR (MainThread) [homeassistant.components.hydrawise] Unexpected error fetching hydrawise data: 'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 318, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/hydrawise/coordinator.py", line 40, in _async_update_data
    user = await self.api.get_user()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pydrawise/legacy.py", line 56, in get_user
    customer_id=resp_json["customer_id"],
                ~~~~~~~~~^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

Debug log:

2024-04-15 15:57:32.703 DEBUG (MainThread) [homeassistant.components.hydrawise] Finished fetching hydrawise data in 1.668 seconds (success: True)
2024-04-15 15:59:33.659 DEBUG (MainThread) [homeassistant.components.hydrawise] Finished fetching hydrawise data in 1.623 seconds (success: True)
2024-04-15 16:44:19.712 DEBUG (MainThread) [homeassistant.components.hydrawise] Finished fetching hydrawise data in 1.677 seconds (success: True)
2024-04-15 16:46:26.907 ERROR (MainThread) [homeassistant.components.hydrawise] Error requesting hydrawise data: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://api.hydrawise.com/api/v1/statusschedule.php?api_key=XXX&controller_id=XXX')
2024-04-15 16:46:26.909 DEBUG (MainThread) [homeassistant.components.hydrawise] Finished fetching hydrawise data in 7.871 seconds (success: False)
2024-04-15 16:48:28.724 INFO (MainThread) [homeassistant.components.hydrawise] Fetching hydrawise data recovered

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

N3rdix avatar Apr 15 '24 14:04 N3rdix

Hey there @dknowles2, @ptcryan, mind taking a look at this issue as it has been labeled with an integration (hydrawise) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of hydrawise can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign hydrawise Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


hydrawise documentation hydrawise source (message by IssueLinks)

home-assistant[bot] avatar Apr 15 '24 14:04 home-assistant[bot]

Neither error seems very harmful.

Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8

That's likely a server error (probably throttling error?) that's not returning the expected type. If we can get https://github.com/home-assistant/core/pull/106904 merged that will go away entirely.

'NoneType' object is not subscriptable

I can avoid that error, but it will still be a data fetch failure. Again, the server is returning something funky that we're not expecting. https://github.com/home-assistant/core/pull/106904 would make that disappear as well.

These sort of transient errors are sort of par-for-the-course with cloud APIs unfortunately. I'm inclined to just let these be, but I can reduce the spamminess a bit if you think it's worth cleaning up logs.

dknowles2 avatar Apr 15 '24 23:04 dknowles2

That's likely a server error (probably throttling error?) that's not returning the expected type. If we can get https://github.com/home-assistant/core/pull/106904 merged that will go away entirely.

Appreciate your fast reply und the proposal, thanks. Sounds like the right step to switch to the new API, I welcome that 😀

if these kind of errors are expected when the server gives an wrong result throttling the about of messages would be appreciated. I still could hide the error completely with a filter in the logger if needed, but that just hides the symptoms.

N3rdix avatar Apr 16 '24 04:04 N3rdix

The 2024.5 release will use a newer Hydrawise API. I expect these types of transient errors to basically disappear.

dknowles2 avatar Apr 27 '24 13:04 dknowles2

@home-assistant close

dknowles2 avatar May 07 '24 12:05 dknowles2