leeyuentuen / alfen_wallbox

Alfen wallbox - Home Assistant Component
MIT License
63 stars 11 forks source link

Unexpected error creating device #100

Closed on4amg closed 7 months ago

on4amg commented 8 months ago

I can login to the wallbox using ACE Service Installer and also the app (credentials are ok and using admin for the integration) however setting up the integration in HA (core 2024.2.5) fails with an unexpected error creating device error. The Alfen Eve Single Pro has firmware 6.4.0 (I need the load balancing feature).

This error originated from a custom integration.

Logger: custom_components.alfen_wallbox.config_flow Source: custom_components/alfen_wallbox/config_flow.py:42 Integration: alfen_wallbox (documentation) First occurred: 5 March 2024 at 19:46:19 (2 occurrences) Last logged: 10:16:57

Unexpected error creating device Traceback (most recent call last): File "/config/custom_components/alfen_wallbox/config_flow.py", line 42, in _create_device await device.init() File "/config/custom_components/alfen_wallbox/alfen.py", line 42, in init await self.async_update() File "/config/custom_components/alfen_wallbox/alfen.py", line 64, in async_update await self._do_update() File "/config/custom_components/alfen_wallbox/alfen.py", line 93, in _do_update self._status = AlfenStatus(response_json, self._status) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alfen_wallbox/alfen.py", line 205, in init for prop in response["properties"]:


TypeError: 'NoneType' object is not subscriptable
N36 commented 8 months ago

I can login to the wallbox using ACE Service Installer and also the app (credentials are ok and using admin for the integration) however setting up the integration in HA (core 2024.2.5) fails with an unexpected error creating device error. The Alfen Eve Single Pro has firmware 6.4.0 (I need the load balancing feature).

This error originated from a custom integration.

Logger: custom_components.alfen_wallbox.config_flow Source: custom_components/alfen_wallbox/config_flow.py:42 Integration: alfen_wallbox (documentation) First occurred: 5 March 2024 at 19:46:19 (2 occurrences) Last logged: 10:16:57

Unexpected error creating device Traceback (most recent call last): File "/config/custom_components/alfen_wallbox/config_flow.py", line 42, in _create_device await device.init() File "/config/custom_components/alfen_wallbox/alfen.py", line 42, in init await self.async_update() File "/config/custom_components/alfen_wallbox/alfen.py", line 64, in async_update await self._do_update() File "/config/custom_components/alfen_wallbox/alfen.py", line 93, in _do_update self._status = AlfenStatus(response_json, self._status) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alfen_wallbox/alfen.py", line 205, in init for prop in response["properties"]: ~~~~^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not subscriptable

I had the same issue. Leave the 'admin' username as it is and just enter your password + friendly name. Then it logged in and worked :)

on4amg commented 8 months ago

I actually used the admin user (may be this was not entirely clear from my initial message). Even tried with aligning the friendly name with the real name of the box to no avail. I have removed the integration from HACS, rebooted and started over again, the error persists but I also noticed a warning message in the log:

This error originated from a custom integration.

Logger: py.warnings Source: custom_components/alfen_wallbox/alfen.py:84 integration: alfen_wallbox (documentation) First occurred: 12:52:35 (1 occurrences) Last logged: 12:52:35

/config/custom_components/alfen_wallbox/alfen.py:84: RuntimeWarning: coroutine 'ClientSession._request' was never awaited self._session.request(

N36 commented 8 months ago

I actually used the admin user (may be this was not entirely clear from my initial message). Even tried with aligning the friendly name with the real name of the box to no avail. I have removed the integration from HACS, rebooted and started over again, the error persists but I also noticed a warning message in the log:

This error originated from a custom integration.

Logger: py.warnings Source: custom_components/alfen_wallbox/alfen.py:84 integration: alfen_wallbox (documentation) First occurred: 12:52:35 (1 occurrences) Last logged: 12:52:35

/config/custom_components/alfen_wallbox/alfen.py:84: RuntimeWarning: coroutine 'ClientSession._request' was never awaited self._session.request(

Perhaps update to latest HA version. For reference I manually uploaded my repo files into HA via Samba. Did a reboot before setting up the plugin. Have you updated your Eve firmware?

on4amg commented 8 months ago

Perhaps update to latest HA version. I always keep HA up to date Core 2024.3.0 Supervisor 2024.02.1 Operating System 12.0 Frontend 20240306.0 For reference I manually uploaded my repo files into HA via Samba. I downloaded mine via HACS and verified afterwards (all files are there and in the right directory) Did a reboot before setting up the plugin. Yes, did that too Have you updated your Eve firmware? It is on the before last official version (6.4.0) since 6.5.0 is buggy - 6.6.0 is expected to come out shortly

N36 commented 8 months ago

Perhaps update to latest HA version. I always keep HA up to date Core 2024.3.0 Supervisor 2024.02.1 Operating System 12.0 Frontend 20240306.0 For reference I manually uploaded my repo files into HA via Samba. I downloaded mine via HACS and verified afterwards (all files are there and in the right directory) Did a reboot before setting up the plugin. Yes, did that too Have you updated your Eve firmware? It is on the before last official version (6.4.0) since 6.5.0 is buggy - 6.6.0 is expected to come out shortly

Tried signing out of the Eve app? I'm not sure if it only allows one local LAN login at a time. I logged out to set mine up.

on4amg commented 8 months ago

I signed out of the EVE app and tried again - no luck, same error. This time I also checked the wallbox log file which shows no errors other than a ''TLS handshake failed (0x4e) for fd=2'' error. This made me think in giving it a go with another browser, I had been trying with the latest version of Brave and decided to switch over to MS Edge. The error remains however the HA log entry is completely different this time around:

This error originated from a custom integration.

Logger: custom_components.alfen_wallbox.config_flow Source: custom_components/alfen_wallbox/config_flow.py:42 integration: Alfen Wallbox (documentation) First occurred: 14:31:26 (1 occurrences) Last logged: 14:31:26

ClientError Traceback (most recent call last): File "/usr/local/lib/python3.12/asyncio/sslproto.py", line 560, in _do_handshake self._sslobj.do_handshake() File "/usr/local/lib/python3.12/ssl.py", line 917, in do_handshake self._sslobj.do_handshake() ssl.SSLWantReadError: The operation did not complete (read) (_ssl.c:1000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1147, in create_connection transport, protocol = await self._create_connection_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1180, in _create_connection_transport await waiter File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 1065, in write n = self._sock.send(data) ^^^^^^^^^^^^^^^^^^^^^ ConnectionResetError: [Errno 104] Connection reset by peer

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/alfen_wallbox/config_flow.py", line 42, in _create_device await device.init() File "/config/custom_components/alfen_wallbox/alfen.py", line 38, in init await self.async_get_info() File "/config/custom_components/alfen_wallbox/alfen.py", line 96, in async_get_info response = await self._session.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 578, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 911, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1235, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1204, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1000, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.13:443 ssl:<ssl.SSLContext object at 0x7f5b9bfc6150> [Connection reset by peer]

N36 commented 8 months ago

I'm not sure in that case I'm afraid. I'm no expert, just tinkerer. It worked for me on Chrome with uBlock and Adguard running.

on4amg commented 8 months ago

No worries, I appreciate your thinking along ;-)

N36 commented 8 months ago

No worries, I appreciate your thinking along ;-)

Interestingly, I found I had to log out of the charger in Eve and log out of the App entirely in order for HA to connect to it. Seems it only allows one logged in connection at a time. 73's :)

pergolafabio commented 8 months ago

Were you able to solve it? @N36 what firmware are you running?

Our Alfen will be installed next week, I wonder what firmware I should use

N36 commented 7 months ago

Were you able to solve it? @N36 what firmware are you running?

Our Alfen will be installed next week, I wonder what firmware I should use

Latest Alfen firmware version seems to work fine for me. I'm just activating it with a Loxone RFID chip so no backend account transactions happening. The HA plugin eventually logged in to it when I disconnected the app and logged out of the Alfen account entirely.

on4amg commented 7 months ago

I found the culprit and I have to admit the error was entirely due to myself. In the installation instructions in HACS it says search for Alfen using the + .... Doing that actually installs another fork! What needs to be done is to add a custom repository first in HACS, reboot HA and continue with the installation of the integration thereafter. Having done that, provide the correct ip address of the Alfen wallbox and the associated credentials (do not change the default user-id admin) and presto, no more errors, the box is now seen by HA. The devil is always in the detail....