py-smart-gardena / hass-gardena-smart-system

Home Assistant custom component integration for Gardena Smart System
Apache License 2.0
211 stars 53 forks source link

Error 404 with 1.0 #170

Closed Atarinside closed 7 months ago

Atarinside commented 1 year ago

Hello, i'm using home assistant with the version 1.0 of this integration.

I have the Gardena gateway and the "smart automatic home & Garden pump". Nothing else (no mower...). I hope this pump is supported ? Anyway the gateway should.

I followed the instructions in the documentation. I created an api on https://developer.husqvarnagroup.cloud/ and added "Authentication API" and "Gardena smart system API". I used "https://my.home-assistant.io/redirect/oauth" as the redirect URL. I then installed the integration V1.0 in HA with HACS , restarted HA, added it to my integrations, filled in the application key and the application secret. Then i started the integration. I left the default settings "mowing time: 60, smart integration control time (30) smart watering time (30)"

But it does not work. The logs indicate :

Logger: homeassistant.config_entries
Source: custom_components/gardena_smart_system/__init__.py:86
Integration: Gardena Smart System integration ([documentation](https://github.com/py-smart-gardena/hass-gardena-smart-system), [issues](https://github.com/py-smart-gardena/hass-gardena-smart-system/issues))
First occurred: 10:31:03 (1 occurrences)
Last logged: 10:31:03

Error setting up entry for gardena_smart_system
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/gardena/smart_system.py", line 141, in __call_smart_system_get
    if self.__response_has_errors(response):
  File "/usr/local/lib/python3.10/site-packages/gardena/smart_system.py", line 131, in __response_has_errors
    response.raise_for_status()
  File "/usr/local/lib/python3.10/site-packages/httpx/_models.py", line 749, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://api.smart.gardena.dev/v1/locations'
For more information check: https://httpstatuses.com/404

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/gardena_smart_system/__init__.py", line 49, in async_setup_entry
    await gardena_system.start()
  File "/config/custom_components/gardena_smart_system/__init__.py", line 86, in start
    await self.smart_system.update_locations()
  File "/usr/local/lib/python3.10/site-packages/gardena/smart_system.py", line 146, in update_locations
    response_data = await self.__call_smart_system_get(
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 183, in retry
    await asyncio.sleep(seconds)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 605, in sleep
    return await future
asyncio.exceptions.CancelledError

and

Logger: gardena.smart_system
Source: custom_components/gardena_smart_system/__init__.py:86
Integration: Gardena Smart System integration ([documentation](https://github.com/py-smart-gardena/hass-gardena-smart-system), [issues](https://github.com/py-smart-gardena/hass-gardena-smart-system/issues))
First occurred: 10:30:06 (8 occurrences)
Last logged: 10:30:56

404 : {r['errors'][0]['title']} - {r['errors'][0]['detail']}

if I restart ha with debug logs enabled, the integration stays in "initialization" for a long time (>10 minutes). Debug logs:


2023-05-12 11:03:29.668 ERROR (MainThread) [gardena.smart_system] 404 : {r['errors'][0]['title']} - {r['errors'][0]['detail']}
2023-05-12 11:03:29.677 INFO (MainThread) [gardena.smart_system] Backing off __call_smart_system_get(...) for 1.5s (httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://api.smart.gardena.dev/v1/locations'
For more information check: https://httpstatuses.com/404)
2023-05-12 11:03:37.626 ERROR (MainThread) [gardena.smart_system] 404 : {r['errors'][0]['title']} - {r['errors'][0]['detail']}
2023-05-12 11:03:37.640 INFO (MainThread) [gardena.smart_system] Backing off __call_smart_system_get(...) for 1.6s (httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://api.smart.gardena.dev/v1/locations'
For more information check: https://httpstatuses.com/404)
2023-05-12 11:03:39.463 ERROR (MainThread) [gardena.smart_system] 404 : {r['errors'][0]['title']} - {r['errors'][0]['detail']}
2023-05-12 11:03:39.467 INFO (MainThread) [gardena.smart_system] Backing off __call_smart_system_get(...) for 3.2s (httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://api.smart.gardena.dev/v1/locations'
For more information check: https://httpstatuses.com/404)```

My config :
Home Assistant 2023.5.2
Supervisor 2023.04.1
Operating System 10.1 on Odroid-XU4
Interface utilisateur : 20230503.3 - latest
PaxCZ commented 1 year ago

Same here: Home Assistant 2023.5.2 Frontend 20230503.3 - latest Gardena Smart System: 1.0.1

grm commented 1 year ago

Hello both,

@Atarinside : did you solve the problem ? Which equipment are you using ? you activated the gardena api ? If you call the GET /locations directly from here : https://developer.husqvarnagroup.cloud/apis/gardena-smart-system-api#openapi, does it works ?

Are you also trying t setup the integration for the first time ?

Atarinside commented 1 year ago

@Atarinside : did you solve the problem ? No.

Which equipment are you using ? Gardena gateway and the "smart automatic home & Garden pump" : https://www.gardena.com/fr/outils-jardin/smart-system/smart-system/kit-smart-automatic-home-garden-pump-50005/967085401.html The Gardena gateway works fine with the Gardena app on my phone but not with HA. Both are on the same network. My HA is installed on an ODROID XU-4 with the disk image downloaded from HA website. I also use Nabu Casa.

you activated the gardena api ? Yes. + "Authentication API" and "GARDENA smart system API"

If you call the GET /locations directly from here : https://developer.husqvarnagroup.cloud/apis/gardena-smart-system-api#openapi, does it works ? No. I'm not 100% sure how to do it. I've done this : https://i.imgur.com/09Xd3SV.png Then i clicked on "execute" : https://i.imgur.com/atyMTeG.png

Are you also trying t setup the integration for the first time ? Yes. But i tried also to unsinstall, install all available versions of the application with the same result.

mafischerhei commented 1 year ago

Hi!

I have the same configuration. Installed the Gardena integration the first time using 1.0.0

"If you call the GET /locations directly from here : https://developer.husqvarnagroup.cloud/apis/gardena-smart-system-api#openapi, does it works ?" Yes it does

And I have the same 404 errors, so nothing works.

Atarinside commented 7 months ago

Hello guys,

using the 1.1.1-rc3 version, i've managed to make it work.

In fact the solution was to create the API key/secret using THE SAME EMAIL ACCOUNT as on the gardena APP on my phone.

So : 1 - If needed, download the Gardena app for your android phone, register/create an account and check it's working with your gardena gateway. 2 - Follow the installation instruction for here : https://github.com/py-smart-gardena/hass-gardena-smart-system but login to https://developer.husqvarnagroup.cloud/ with the same account you used on your phone.

Best regards.