leeyuentuen / alfen_wallbox

Alfen wallbox - Home Assistant Component
MIT License
64 stars 12 forks source link

Documentation #83

Open phulstaert opened 11 months ago

phulstaert commented 11 months ago

This is a great plugin to use, but the learning curve is very steep. Some documentation could ease the integration pain. I am willing to help with this, but I will need help myself.

And it begins with the simple stuff like:

Other stuff I don't know yet are:

Aside from very long form posts and a few lists in the github wiki, there is no sign of a much needed manual.

leeyuentuen commented 11 months ago

good question,

there is a kind of charging limit between 1 and 3 phase describe in this discussion: https://github.com/leeyuentuen/alfen_wallbox/discussions/43

but if you want, you can always write something in the wiki page: https://github.com/leeyuentuen/alfen_wallbox/wiki

I've put my automation here in the wiki: https://github.com/leeyuentuen/alfen_wallbox/wiki/My-automation-for-charging

phulstaert commented 11 months ago

I'll figure out how to write on the wiki later this week. Thank you for your automation examples.

I see that you use a state platform on your P1 Power consumption. This is a value that changes every few seconds. Is it good for your car/charging station to change the amperage that frequently?

Also, another question; the service "set_current_limit", does it check if the current_limit is already this value and only pushes it when needed, or does it always pushes this value? This would simplify the automation a bit if it did the checks for me.

leeyuentuen commented 11 months ago

I'll figure out how to write on the wiki later this week. Thank you for your automation examples.

I see that you use a state platform on your P1 Power consumption. This is a value that changes every few seconds. Is it good for your car/charging station to change the amperage that frequently?

Also, another question; the service "set_current_limit", does it check if the current_limit is already this value and only pushes it when needed, or does it always pushes this value? This would simplify the automation a bit if it did the checks for me.

first one: normally it is just a value change on the device. don't think it will be a big issue. i've use the for a while

second one: no, but on the automation, i check what for value i have as condition.

jaques-sam commented 4 months ago

Also it asks for a usename and password. This is the username "admin" alongside the "Owner" password. Simple information, but together with the first point, makes a hell in trying to find out why it will not connect.

Thanks @phulstaert for this info, still it doesn't work for me :-( (even the service installer is closed) It would be nice to have more information (logging?) on why this issue happens...

phulstaert commented 4 months ago

I'm sad to hear it does not work for you.

What error do you get? Can you post a screenshot? Are you certain about the hostname/IP? Can you ping it? Have you set the IP as fixed in either your router (as a static DHCP lease) or in your Wallbox? Are you certain about the Owner password? Does that work in the ACE Service Installer?

If i'm not mistaken, you can set the default logging level of home assistant higher; this would catch an error when adding the integration. Just don't forget to turn if off again after you are done.

jaques-sam commented 4 months ago

Thanks for your quick reply.

I'm 100% certain about the IP, and it works with the ACE Service Installer. I also added a firewall rule for 502 (TCP, destination port), but I still get the same error.

image

Here are the logs that appear, simply a connection issue :-(:

2024-07-08 07:20:05.018 ERROR (MainThread) [custom_components.alfen_wallbox.config_flow] ClientError
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1025, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1120, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1102, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1005, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.80.30', 443)

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 53, in _create_device
    await device.init()
  File "/config/custom_components/alfen_wallbox/alfen.py", line 105, in init
    await self.get_info()
  File "/config/custom_components/alfen_wallbox/alfen.py", line 128, in get_info
    response = await self._session.get(
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 581, 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 944, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1257, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1226, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1033, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.80.30:443 ssl:<ssl.SSLContext object at 0x7f771ae73cd0> [Connect call failed ('192.168.80.30', 443)]
phulstaert commented 4 months ago

Hi Sam,

Do you have any special firewall rules? (like blocking everything incomming and outgoing?) I ask this because you specify port 502 on the destination IP (I guess you are talking about the firewall on your HA instance? or on the hypervisor?)

If so, the Alfen Wallbox uses modbus (502) but a lot of commands are send by websocket (https / port 443). If you disabled all ports, you also have to allow this one) [Connect call failed ('192.168.80.30', 443)]

jaques-sam commented 4 months ago

Yeah, I know. But it doesn't even work with the firewall disabled :smiling_face_with_tear: I'm using HASS in docker on my synology. I tried again today, still without luck...

leeyuentuen commented 4 months ago

to be sure that you don't have other active instance? because the alfen wallbox support only 1 connection.

so if ace installer or myeve is logged in, then HA can't log in

phulstaert commented 4 months ago

There is only one websocket connection allowed. Try rebooting the wallbox, wait a minute and retry. This should have disconnected all other connections. Does the logging give the same error now as before? (the 443 connection failed one)

jaques-sam commented 4 months ago

Thanks! I had upgraded the Wallbox to 7.0 and made it reboot. I guess that's what did it... I tried numbers of times!