jonkristian / alko

AL-KO Robolinho component for Home Assistant
MIT License
16 stars 3 forks source link

Issue with configuring: timeout() got an unexpected keyword argument 'loop' #3

Closed szerwi closed 1 year ago

szerwi commented 1 year ago

I have a problem with configuring Alko integration in Home Assistant.

I have added client_secret to configuration.yaml. When I'm adding the integration and put all the necessary keys, I get an error: Retrying setup: timeout() got an unexpected keyword argument 'loop'

Complete log:

Logger: custom_components.alko
Source: custom_components/alko/__init__.py:98
Integration: AL-KO ([documentation](https://github.com/jonkristian/alko))
First occurred: 7:37:31 PM (49 occurrences)
Last logged: 8:28:03 PM

Unexpected error fetching alko_coordinator data: timeout() got an unexpected keyword argument 'loop'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 239, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 195, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/alko/__init__.py", line 98, in async_update_data
    await alko.get_devices()
  File "/usr/local/lib/python3.10/site-packages/pyalko/__init__.py", line 39, in get_devices
    response: ClientResponse = await self._client.get(
  File "/usr/local/lib/python3.10/site-packages/pyalko/client.py", line 25, in get
    return await self.request("GET", url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pyalko/client.py", line 45, in request
    async with async_timeout.timeout(20, loop=get_event_loop()):
TypeError: timeout() got an unexpected keyword argument 'loop'

What may be causing that issue?

jonkristian commented 1 year ago

Could be some deprecation, I will take a look and see if something needs changing. Can't promise but will try to find some time this week.

jonkristian commented 1 year ago

Can you please try the newest version, should appear as an upgrade in hacs pretty soon.

szerwi commented 1 year ago

@jonkristian Seems to be working now. It connected and found the device. Currently my mower is offline so I cannot test the full functionality - will test it as soon as the spring starts.

Thanks for the quick fix!

jonkristian commented 1 year ago

@szerwi Nice! Would you mind writing down a little note about what you did, so we could put it in the readme?

szerwi commented 1 year ago

@jonkristian do you mean the note how to get ID and secret from the app? Sure, I can write some summary later today.

jonkristian commented 1 year ago

Yeah, I mean would be nice to have some clearer steps in the readme, since their newest version doesn't work.

szerwi commented 1 year ago

As stated in issue #2, it is not possible to extract the credentials from recent AL-KO InTouch app (probably since version 4.0.0). In order to extract the credentials from the app, you need to download the older app version.

  1. Download and install older InTouch app from the any APK mirrors website. If you have the "official" InTouch app from Google Play installed, remember to unsinstall it first. Personally, I've tested it on v3.4.2 version downloaded from APKPure. Unfortunately, only .xapk file is available there, so you need to download APKPure app itself and then install InTouch v3.4.2 using the APKPure app.
  2. Log in to the app and enter "My devices" tab (to make sure that the app downloaded devices information).
  3. Proceed with further instructions regarding token extraction using adb and intouch-credentials.sh script.

@jonkristian Here you are, you can put the instructions in readme

MiG-41 commented 1 year ago

@szerwi , there is AL-KO inTouch v3.4.1 in APK format : https://m.apkpure.com/pl/al-ko-intouch-smart-garden/de.alko.intouch/download/2810-APK-ba9d063af8eae154f455c19ad4437675 should be good enough.

szerwi commented 1 year ago

@MiG-41 Yeah, I bet that should work too.