drakhart / ha-super-soco-custom

Custom component for integrating your Super Soco or Vmoto Soco motorcycle into Home Assistant. It provides meaningful data like power status, battery percentage, location and a lot more.
MIT License
15 stars 3 forks source link

Failed to setup - 1.0.0 Beta 10 #8

Closed Xnygra closed 10 months ago

Xnygra commented 1 year ago

Got the initial setup to work, with getting a code and added successfully, but integration fails to setup.

image

Error fetching super_soco_custom data: 07:37:34 – (ERROR) Super Soco Custom (custom integration) - message first occurred at 07:21:58 and shows up 22 times 'NoneType' object is not subscriptable 07:37:34 – (ERROR) Super Soco Custom (custom integration) - message first occurred at 07:21:58 and shows up 22 times Config entry 'Super Soco Custom' for super_soco_custom integration not ready yet: None; Retrying in background 07:33:31 – (WARNING) config_entries.py - message first occurred at 07:22:57 and shows up 2 times Config entry 'SOCO' for ev_smart_charging integration not ready yet: Input sensors not ready.; Retrying in background 07:21:58 – (WARNING) config_entries.py - message first occurred at 07:11:19 and shows up 5 times

drakhart commented 1 year ago

Can you please try without combining it with the EV Smart Charging integration? Just to make sure it works standalone. Thanks in advance.

Rationale behind: I have the feeling that this other integration is trying to subscribe to events fired by Super Soco sensors even before they are ready. Here's what I'm talking about: https://github.com/jonasbkarlsson/ev_smart_charging/blob/main/custom_components/ev_smart_charging/coordinator.py#L363

Xnygra commented 1 year ago

Unfortunately no changes when removed the EV Smart Charging.

Logger: custom_components.super_soco_custom Source: custom_components/super_soco_custom/vmoto_soco_api.py:129 Integration: Super Soco Custom (documentation, issues) First occurred: 19:43:07 (1 occurrences) Last logged: 19:43:07

Traceback (most recent call last): File "/config/custom_components/super_soco_custom/vmoto_soco_api.py", line 130, in _api_wrapper res = await self._session.post(url, headers=headers, json=data) File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 560, in _request await resp.start(conn) File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 899, in start message, payload = await protocol.read() # type: ignore[union-attr] File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 616, in read await self._waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/config/custom_components/super_soco_custom/coordinator.py", line 174, in _async_update_data self._user_data = (await self._client.get_user())[DATA_DATA] File "/config/custom_components/super_soco_custom/vmoto_soco_api.py", line 64, in get_user return await self._api_wrapper(url, headers) File "/config/custom_components/super_soco_custom/vmoto_soco_api.py", line 129, in _api_wrapper async with async_timeout.timeout(TIMEOUT): File "/usr/local/lib/python3.10/site-packages/async_timeout/init.py", line 129, in aexit self._do_exit(exc_type) File "/usr/local/lib/python3.10/site-packages/async_timeout/init.py", line 212, in _do_exit raise asyncio.TimeoutError asyncio.exceptions.TimeoutError

drakhart commented 1 year ago

Ok, that's clearly a connection timeout error. I could increase the timeout, but I feel like the current 5 seconds limit is already very generous for an API request.

Do you usually experience connection issues with other stuff? Also, could you please try to ping app.vmotosoco-service.com from your Home Assistant host and report the delay here?

For reference, I'm getting a consistent 49ms delay.

Xnygra commented 1 year ago

image

drakhart commented 1 year ago

Honestly, I don't know why you're getting timeouts while fetching the data, you should be good with those ping figures.

If you happen to have the required knowledge you could try increasing the Vmoto Soco API timeout and restarting HA, until you find a limit that works for you. And if you find a suitable timeout I can then push it to the repo so it's available in general and doesn't mess your integration on every update.

The file to edit is config/custom_components/super_soco_custom/vmoto_soco_api.py and the timeout variable is just TIMEOUT, in line 15 (here's the link for reference). I believe that in HAOS the config folder is located under /mnt/data/supervisor/homeassistant/config, but I can't check that myself as I'm using HA Core on an Ubuntu box.

drakhart commented 1 year ago

I took the chance of releasing beta 11 with other fixes to also increase the API timeout to 10 seconds (instead of 5). Please let me know if that fixed the issue for you, or if you already managed to fix it by yourself increasing the timeout even more.

drakhart commented 1 year ago

Hi, @Xnygra. It's been more than one month since I replied to this thread, but I still haven't had any updates from you. Is the issue still happening? Thanks.

drakhart commented 10 months ago

Closing due to inactivity, assumed to be solved.