evcc-io / hassio-addon

Hass.io add-on for EVCC
97 stars 61 forks source link

eebus not working on hassio #99

Closed jomach closed 4 months ago

jomach commented 4 months ago

Hey, I got the eebus connection working locally on my mac for the evvc. When I try the same config inside of my hass then I do not get the log:

[eebus ] DEBUG 2024/07/15 13:35:20 incoming connection request from a9cfa5fac0e5631cb87f09ce726103519eXXXXX

I think the the wallbox cannot reach the evvc inside of hass due to the containers.

Logs from a working installation Local on my mac:

jorge@MacBook-Pro-4 ~/Downloads                                                                               [8:41:56]
> $ evcc -c evcc.yaml
[main  ] INFO 2024/07/17 08:42:06 evcc 0.128.2
[main  ] INFO 2024/07/17 08:42:06 using config file: evcc.yaml
[db    ] INFO 2024/07/17 08:42:06 using sqlite database: /Users/jorge/.evcc/evcc.db
[mqtt  ] INFO 2024/07/17 08:42:06 connecting evcc-1236254900 at tcp://homeassistant.local:1883
[mqtt  ] DEBUG 2024/07/17 08:42:06 tcp://homeassistant.local:1883 connected
[eebus ] INFO 2024/07/17 08:42:06 Local SKI:  9a46bcb42045efb7a5f449a89482621ca87eb4dc
[eebus ] DEBUG 2024/07/17 08:42:06 starting websocket server on :4712
[eebus ] DEBUG 2024/07/17 08:42:06 mdns: announce
[eebus ] DEBUG 2024/07/17 08:42:06 mdns: using zeroconf
[eebus ] DEBUG 2024/07/17 08:42:06 mdns: start search
[main  ] INFO 2024/07/17 08:42:06 listening at :7070
[main  ] FATAL 2024/07/17 08:43:36 cannot create charger 'wallbox3': cannot create charger type 'template': cannot create charger type 'eebus': i/o timeout
[main  ] FATAL 2024/07/17 08:43:36 will attempt restart in: 15m0s
[eebus ] DEBUG 2024/07/17 08:44:09 ski: a9cfa5fac0e5631cb87f09ce726103519eff0fa6 name: Livo-EVB-500-HIDDEN brand: EVBox model: Livo typ: ChargingStation identifier: EVBox-Livo-EVB-500-HIDDEN register: false host: EVB-500-HIDDEN.local. port: 4712 addresses: [192.168.1.219]
[eebus ] DEBUG 2024/07/17 08:44:09 trying to connect to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at EVB-500-HIDDEN.local.
[eebus ] DEBUG 2024/07/17 08:44:09 initiating connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at EVB-500-HIDDEN.local.:4712/ship/
[eebus ] DEBUG 2024/07/17 08:44:16 incoming connection request from a9cfa5fac0e5631cb87f09ce726103519eff0fa6
[eebus ] DEBUG 2024/07/17 08:44:16 Send:  read 1 NodeManagementDetailedDiscoveryData
[eebus ] DEBUG 2024/07/17 08:44:17 Recv: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN:NodeManagement to NodeManagement read 1 NodeManagementDetailedDiscoveryData
[eebus ] DEBUG 2024/07/17 08:44:17 Send: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN reply 2 1 NodeManagementDetailedDiscoveryData
[eebus ] DEBUG 2024/07/17 08:44:17 Recv: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN:NodeManagement to NodeManagement reply 3 1 NodeManagementDetailedDiscoveryData
[eebus ] DEBUG 2024/07/17 08:44:17 Send: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN call 3 NodeManagementSubscriptionRequestCall
[eebus ] DEBUG 2024/07/17 08:44:17 Send: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN read 4 NodeManagementUseCaseData
[eebus ] DEBUG 2024/07/17 08:44:17 Send: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN read 5 DeviceClassificationManufacturerData
[eebus ] DEBUG 2024/07/17 08:44:17 Send: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN read 6 DeviceDiagnosisStateData
[eebus ] DEBUG 2024/07/17 08:44:17 Recv: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN:NodeManagement to NodeManagement call 5 NodeManagementSubscriptionRequestCall
[eebus ] DEBUG 2024/07/17 08:44:17 Send: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN result 7 5 ResultData 0
[eebus ] DEBUG 2024/07/17 08:44:17 Recv: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN:NodeManagement to NodeManagement result 7 3 ResultData 0
[eebus ] DEBUG 2024/07/17 08:44:17 Recv: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN:NodeManagement to NodeManagement reply 9 4 NodeManagementUseCaseData
[eebus ] DEBUG 2024/07/17 08:44:17 Recv: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN:NodeManagement to NodeManagement read 13 NodeManagementDetailedDiscoveryData
[eebus ] DEBUG 2024/07/17 08:44:17 Send: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN reply 8 13 NodeManagementDetailedDiscoveryData
[eebus ] DEBUG 2024/07/17 08:44:18 Recv: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN:NodeManagement to NodeManagement read 15 NodeManagementDestinationListData
[eebus ] DEBUG 2024/07/17 08:44:18 Send: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN reply 9 15 NodeManagementDestinationListData
[eebus ] DEBUG 2024/07/17 08:44:18 Recv: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN:NodeManagement to NodeManagement read 17 NodeManagementUseCaseData
[eebus ] DEBUG 2024/07/17 08:44:18 Send: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN reply 10 17 NodeManagementUseCaseData
[eebus ] DEBUG 2024/07/17 08:44:18 Recv: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN:DeviceClassification to DeviceClassification reply 19 5 DeviceClassificationManufacturerData
[eebus ] DEBUG 2024/07/17 08:44:18 Recv: d:_i:47859_EVBox-Livo-EVB-500-HIDDEN:DeviceDiagnosis to DeviceDiagnosis reply 21 6 DeviceDiagnosisStateData
[eebus ] DEBUG 2024/07/17 08:44:19 connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 failed: dial tcp [fe80::ee5c:84ff:fe21:618a%en0]:4712: i/o timeout
[eebus ] DEBUG 2024/07/17 08:44:19 trying to connect to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at 192.168.1.219

Logs from HA:

starting evcc: 'EVCC_DATABASE_DSN=/data/evcc.db evcc --config /config/evcc.yaml'
[main  ] INFO 2024/07/17 08:49:11 evcc 0.128.2
[main  ] INFO 2024/07/17 08:49:11 using config file: /config/evcc.yaml
[db    ] INFO 2024/07/17 08:49:11 using sqlite database: /data/evcc.db
[mqtt  ] INFO 2024/07/17 08:49:11 connecting evcc-660314251 at tcp://homeassistant.local:1883
[mqtt  ] DEBUG 2024/07/17 08:49:11 tcp://homeassistant.local:1883 connected
[eebus ] INFO 2024/07/17 08:49:11 Local SKI:  9a46bcb42045efb7a5f449a89482621ca87eb4dc
[eebus ] DEBUG 2024/07/17 08:49:11 starting websocket server on :4712
[eebus ] DEBUG 2024/07/17 08:49:11 mdns: announce
[eebus ] DEBUG 2024/07/17 08:49:11 mdns: using zeroconf
[eebus ] DEBUG 2024/07/17 08:49:11 mdns: start search
[main  ] INFO 2024/07/17 08:49:11 listening at :7070
[eebus ] TRACE 2024/07/17 08:49:11 registering ski: a9cfa5fac0e5631cb87f09ce726103519eff0fa6
[main  ] FATAL 2024/07/17 08:50:41 cannot create charger 'wallbox3': cannot create charger type 'template': cannot create charger type 'eebus': i/o timeout
[main  ] FATAL 2024/07/17 08:50:41 will attempt restart in: 15m0s
[eebus ] DEBUG 2024/07/17 08:50:52 ski: a9cfa5fac0e5631cb87f09ce726103519eff0fa6 name: Livo-EVB-500-015-503 brand: EVBox model: Livo typ: ChargingStation identifier: EVBox-Livo-EVB-500-015-503 register: false host: EVB-500-015-503.local. port: 4712 addresses: [192.168.1.219]
[eebus ] DEBUG 2024/07/17 08:50:52 trying to connect to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at EVB-500-015-503.local.
[eebus ] DEBUG 2024/07/17 08:50:52 initiating connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at EVB-500-015-503.local.:4712/ship/
[eebus ] DEBUG 2024/07/17 08:51:02 connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 failed: dial tcp 192.168.1.219:4712: i/o timeout
[eebus ] DEBUG 2024/07/17 08:51:02 trying to connect to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at 192.168.1.219
[eebus ] DEBUG 2024/07/17 08:51:02 initiating connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at 192.168.1.219:4712/ship/
[eebus ] DEBUG 2024/07/17 08:51:12 connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 failed:  dial tcp 192.168.1.219:4712: i/o timeout
[eebus ] DEBUG 2024/07/17 08:51:12 mdns: announce
[eebus ] DEBUG 2024/07/17 08:51:12 mdns: using zeroconf

See the missing line "incoming connection request" on the ha logs ?

goebelmeier commented 4 months ago

I think the the wallbox cannot reach the evvc inside of hass due to the containers

Hmmm, does EEBUS needs any ports additional to the ones we already pipe towards the evcc add-on container?

https://github.com/evcc-io/hassio-addon/blob/01046c17394f4c47be091c3b7857c14d53e7d17f/evcc/config.json#L30-L43

Maybe 4712/tcp?

https://github.com/evcc-io/evcc/blob/25470ace09f7a29c6224f87f666a48adfd894a8a/charger/eebus/eebus.go#L82

jomach commented 4 months ago

Ich denke schon das 4712 fehlt.

Weiß nicht ob es tcp ist. Ich werde heute Abend ein Nmap machen auf die lokal Installation dann kann ich dir Bescheid geben.

jomach commented 4 months ago

Also Habe es gestern abend nochmal probiert und dein Repo gefork. Hat nicht geklappt. mdns discovery vielleicht ?

goebelmeier commented 4 months ago

@andig ist aufgefallen, dass der EEBUS Port im Dockerfile auch überhaupt nicht exposed wurde. Somit hilft meine Add-On Config wenig, wenn der Port dennoch nicht herausgereicht wird. Sobald ein neues Release von evcc da ist, bin ich guten Mutes dass das klappt.

https://github.com/evcc-io/evcc/commit/dca361287ad37ff6b87cad6e04bce50accf08500

jomach commented 4 months ago

Aber im dockerfile sehe ich nicht 4712

andig commented 4 months ago

Sobald ein neues Release von evcc da ist, bin ich guten Mutes dass das klappt.

Das Dockerfile hat rein informativen Charakter, ändert funktional aber nichts.

goebelmeier commented 4 months ago

Das Dockerfile hat rein informativen Charakter, ändert funktional aber nichts.

Du hast Recht, das EXPOSE ändert funktional gar nichts. Dann ist das nicht das Problem. @jomach würdest du auf deinem Host wo es funktioniert dann vielleicht mal ein Packet Capture laufen lassen und mir zur Verfügung stellen, damit ich sehe was da noch gesprochen wird?

Auf macOS: ❯ networksetup -listallhardwareports um das richtige Interface herauszufinden

sudo tcpdump -i en0 -n host <IP-Adresse-der-Wallbox> -w trace.pcap

Und dann könntest du evcc auf deinem macOS starten und sobald evcc mit Wallbox gepaired ist das Packet Capture stoppen und das trace.pcap zur Verfügung stellen.

jomach commented 4 months ago

Mach ich. Ich denke es liegt and das mdns Protokoll der über Udp läuft.

goebelmeier commented 4 months ago

Ich denke es liegt and das mdns Protokoll der über Udp läuft.

Aber mDNS wird doch an den Container durchgereicht: https://github.com/evcc-io/hassio-addon/blob/01046c17394f4c47be091c3b7857c14d53e7d17f/evcc/config.json#L32

Du kannst auch über

log: info
levels:
  eebus: trace
  [...]

noch mal versuchen mehr aus dem Logging rauszukitzeln.

jomach commented 4 months ago

trace.pcap.zip

192.168.1.219 -> Meine wallbox 192.168.1.207 -> evcc lokal auf mein mac

Ich sehe von trace diesen ports:

port udp 5353 (MDNS port auf evcc) port tcp 4712 (eebus port auf evcc)

Ich denke das hier brauchen wir :

image

und aktuell wird es geblockt

jomach commented 4 months ago

@DerAndereAndi kannst du helfen ? Uns ist nicht 100% klar wie der netzwerk traffic für eebus funktioniert.

andig commented 4 months ago

mDNS braucht Multicast. In Docker braucht das i.A. den Host Mode. Wie es bei HA ist müsste mit HA geklärt werden.

goebelmeier commented 4 months ago

Der Host Mode ist bereits seit Januar 2023 an, fällt mir grad auf:

https://github.com/evcc-io/hassio-addon/blame/main/evcc/config.json#L26

➜  ~ docker inspect 5dd643b33a60 | jq '.[].NetworkSettings'
{
  "Bridge": "",
  "SandboxID": "eb58555aa1faf0c9fc648f1351a07613baf7e0b97b6f913e9b0b5a35c8962eab",
  "SandboxKey": "/var/run/docker/netns/default",
  "Ports": {},
  "HairpinMode": false,
  "LinkLocalIPv6Address": "",
  "LinkLocalIPv6PrefixLen": 0,
  "SecondaryIPAddresses": null,
  "SecondaryIPv6Addresses": null,
  "EndpointID": "",
  "Gateway": "",
  "GlobalIPv6Address": "",
  "GlobalIPv6PrefixLen": 0,
  "IPAddress": "",
  "IPPrefixLen": 0,
  "IPv6Gateway": "",
  "MacAddress": "",
  "Networks": {
    "host": {
      "IPAMConfig": null,
      "Links": null,
      "Aliases": null,
      "MacAddress": "",
      "NetworkID": "debcf04ad970548bf689f4c820495ef0358088f5a3e29c72460ce6f000e56c81",
      "EndpointID": "63ef54b34eb1ac210beca4d5d1e438e07196633bfac62a7947217cf594b7318b",
      "Gateway": "",
      "IPAddress": "",
      "IPPrefixLen": 0,
      "IPv6Gateway": "",
      "GlobalIPv6Address": "",
      "GlobalIPv6PrefixLen": 0,
      "DriverOpts": null,
      "DNSNames": null
    }
  }
}
jomach commented 4 months ago

Also liegt es doch an mDNS

goebelmeier commented 4 months ago

Um das noch mal genau aufzudröseln, magst du mal trace Logging für EEBUS in deinem evcc auf HA aktivieren und hier pasten? Damit wir genau sehen, wo es hängt? Und idealerweise als Vergleich das gleiche von deinem macOS auch?

DerAndereAndi commented 4 months ago

Ein paar Gedanken:

Vielleicht versuchst es erst mal auf dem Mac korrekt zum Laufen zu bekommen, bevor du den Container nutzt. Da gibt es zu vielen potenzielle Fehlerquellen von der Box selbst und auch von der Container Config.

DerAndereAndi commented 4 months ago

Another note: the mDNS Entry of the Box is not visible at startup of evcc in both cases. It took multiple minutes. It should be visible at all times -> Problem in the Box?

jomach commented 4 months ago

Ein paar Gedanken:

  • Auf macOS sieht die Box evcc via mDNS, unter HA nicht. Entweder geht das announcement nicht raus, oder die Box hat einen Bug. Einen ähnlichen gibt es in der Elli Wallbox (auch von EVBox, da half jemandem das WLAN Netzwerkinterface zu aktivieren. (Warum auch immer)
  • Auf HA sieht evcc die Box, unter HA auch
  • Die Box macht nur einen Verbindungsaufbau wenn sie evcc sieht
  • Man kann mit dem Discovery Tool auf dem Mac oder mit avahi in einem Terminal in Linux herausfinden ob das mDNS Announcement sichtbar ist. Discovery starten, evcc im Container starten -> Sichtbar ja/nein? Wenn nein, mögliches Container Konfig Problem.
  • evcc macht unter HA einen Verbindungsaufbau, da keiner von der Box initiert wird. Und selbst der scheitert: connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 failed: dial tcp 192.168.1.219:4712: i/o timeout -> Entweder ist die Netzwerkadresse nicht erreichbar oder der Port unter der Netzwerkadresse nicht offen -> Kann ein Problem in der Box oder im Container sein

Vielleicht versuchst es erst mal auf dem Mac korrekt zum Laufen zu bekommen, bevor du den Container nutzt. Da gibt es zu vielen potenzielle Fehlerquellen von der Box selbst und auch von der Container Config.

Hi, danke für die Tipps. Also Lokal auf mein Mac klappt alles. Ich sehe es dann in der UI und sehe die anpassung. Die timeouts die du kommentiert hast sind nur einmal danach geht es irgenwie (retry ? ).

nochmal auf mein macbook klappt alles, nur auf hassio nicht. Wie kann ich avahi innerhalb von evcc container in hassio testen ? Weiß jemand ob es überhaupt geht ? Müssen wir mDNS nutzen ?

thecem commented 4 months ago

Die einfachste Methode den Container zugänglich zu machen ist das portainer Addon. Damit lässt sich der Addon Container direkt über den Browser in HA öffnen.

https://github.com/alexbelgium/hassio-addons

jomach commented 4 months ago

puff ganz schon viel aufwand gerade...

goebelmeier commented 4 months ago

Hi, danke für die Tipps. Also Lokal auf mein Mac klappt alles. Ich sehe es dann in der UI und sehe die anpassung. Die timeouts die du kommentiert hast sind nur einmal danach geht es irgenwie (retry ? ).

nochmal auf mein macbook klappt alles, nur auf hassio nicht. Wie kann ich avahi innerhalb von evcc container in hassio testen ? Weiß jemand ob es überhaupt geht ? Müssen wir mDNS nutzen ?

EEBUS muss mDNS nutzen, ja. Avahi im Container musst du nicht testen. Ob die mDNS Messages in evcc ankommen, siehst du wenn du TRACE logging an eebus anschaltest. Ob evcc mDNS Messages rausschreibt kannst du mit Discovery für macOS https://itunes.apple.com/us/app/discovery-dns-sd-browser/id1381004916?mt=12 testen

Discovery starten, evcc starten und gucken ob die evcc mDNS Einträge in Discovery aufploppen.

thecem commented 4 months ago

@jomach teste bitte mal: https://github.com/evcc-io/hassio-addon/tree/thecem-patch-mDNS-Test

jomach commented 4 months ago

@jomach teste bitte mal: https://github.com/evcc-io/hassio-addon/tree/thecem-patch-mDNS-Test

Very similar but I think it now has ipv6 in the mix. Not sure.

starting evcc: 'EVCC_DATABASE_DSN=/data/evcc.db evcc --config /config/evcc.yaml'
[main  ] INFO 2024/07/17 20:08:52 evcc 0.128.2
[main  ] INFO 2024/07/17 20:08:52 using config file: /config/evcc.yaml
[db    ] INFO 2024/07/17 20:08:52 using sqlite database: /data/evcc.db
[mqtt  ] INFO 2024/07/17 20:08:52 connecting evcc-935579942 at tcp://homeassistant.local:1883
[mqtt  ] DEBUG 2024/07/17 20:08:52 tcp://homeassistant.local:1883 connected
[eebus ] INFO 2024/07/17 20:08:52 Local SKI:  9a46bcb42045efb7a5f449a89482621ca87eb4dc
[eebus ] DEBUG 2024/07/17 20:08:52 starting websocket server on :4712
[eebus ] DEBUG 2024/07/17 20:08:52 mdns: announce
[eebus ] DEBUG 2024/07/17 20:08:52 mdns: using zeroconf
[eebus ] DEBUG 2024/07/17 20:08:52 mdns: start search
[main  ] INFO 2024/07/17 20:08:52 listening at :7070
[eebus ] TRACE 2024/07/17 20:08:52 registering ski: a9cfa5fac0e5631cb87f09ce726103519eff0fa6
[eebus ] DEBUG 2024/07/17 20:08:52 ski: a9cfa5fac0e5631cb87f09ce726103519eff0fa6 name: Livo-EVB-500-HIDDEN brand: EVBox model: Livo typ: ChargingStation identifier: EVBox-Livo-EVB-500-HIDDEN register: false host: EVB-500-HIDDEN.local. port: 4712 addresses: [192.168.1.219]
[eebus ] DEBUG 2024/07/17 20:08:52 trying to connect to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at EVB-500-HIDDEN.local.
[eebus ] DEBUG 2024/07/17 20:08:52 initiating connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at EVB-500-HIDDEN.local.:4712/ship/
[eebus ] DEBUG 2024/07/17 20:08:52 connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 failed: dial tcp [fe80::ee5c:84ff:fe21:618a]:4712: connect: invalid argument
[eebus ] DEBUG 2024/07/17 20:08:52 trying to connect to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at 192.168.1.219
[eebus ] DEBUG 2024/07/17 20:08:52 initiating connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at 192.168.1.219:4712/ship/
[eebus ] DEBUG 2024/07/17 20:09:02 connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 failed:  dial tcp 192.168.1.219:4712: i/o timeout
[eebus ] DEBUG 2024/07/17 20:09:02 mdns: announce
[eebus ] DEBUG 2024/07/17 20:09:02 mdns: using zeroconf
[eebus ] DEBUG 2024/07/17 20:09:49 ski: a9cfa5fac0e5631cb87f09ce726103519eff0fa6 name: Livo-EVB-500-HIDDEN brand: EVBox model: Livo typ: ChargingStation identifier: EVBox-Livo-EVB-500-HIDDEN register: false host: EVB-500-HIDDEN.local. port: 4712 addresses: [192.168.1.219]
[eebus ] DEBUG 2024/07/17 20:09:49 trying to connect to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at EVB-500-HIDDEN.local.
[eebus ] DEBUG 2024/07/17 20:09:49 initiating connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at EVB-500-HIDDEN.local.:4712/ship/
[eebus ] DEBUG 2024/07/17 20:09:49 connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 failed: dial tcp [fe80::ee5c:84ff:fe21:618a]:4712: connect: invalid argument
[eebus ] DEBUG 2024/07/17 20:09:49 trying to connect to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at 192.168.1.219
[eebus ] DEBUG 2024/07/17 20:09:49 initiating connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at 192.168.1.219:4712/ship/
jomach commented 4 months ago

@thecem you merged while is it not working ?

thecem commented 4 months ago

Could you please try, pls deinstall the Addon an then reinstall, make sure before starting EVCC:

jomach commented 4 months ago

Just did. I also restart hassio. No effect

thecem commented 4 months ago

Did you re couple the box with your HA EVCC configuration?

jomach commented 4 months ago

yes. It is Definitely a problem on hassio. The wallbox cannot reach evcc . I would like to know who framework logs this:

[eebus ] DEBUG 2024/07/17 08:44:16 incoming connection request from a9cfa5fac0e5631cb87f09ce726103519eff0fa6

As I do not get this message on hassio, only locally. It needs to be a webstocket right ?

thecem commented 4 months ago

Which installation Method of HA do you use? HAOS on a dedicated device like x86-64, Raspberry or Odroid?

If so, HAOS takes care to receive the trafic and forward it to the Add-on container (EVCC). The message above is only recognised by EVCC in the docker container. HA could not work with EEBus up to now.

jomach commented 4 months ago

Raspberry Pi

thecem commented 4 months ago

Under Settings → System → Network → Network adapter make sure to enable any additional network interface you need.

thecem commented 4 months ago

Could you

I know this is a lot of effort, but helps us to understand where the problem could be. thx

jomach commented 4 months ago

I already installed portainer. I'm going to vacations on Friday for 1 week. So I think I will not very active on this.

@thecem I already added a tcpdump from a working installation above.

thecem commented 4 months ago

thx, the working tcpdump is for me only one part, we need a non working from the HA evcc container.

jomach commented 4 months ago

@thecem here is the tcpdump from evcc running in hassio as container. FYI: When I setup the energy manager on my wallbox I can see the energy manager and it accepts the connection. Only then on refresh it says it is not connected. This happen already before we did changes on the port.

evcchassio.pcap.zip

thecem commented 4 months ago

I guess energy manager is an part SW from the UI of the Wallbox?

thecem commented 4 months ago
network:
  # schema is the HTTP schema
  # setting to `https` does not enable https, it only changes the way URLs are generated
  schema: http
  # host is the hostname or IP address
  # if the host name contains a `.local` suffix, the name will be announced on MDNS
  # docker: MDNS announcements don't work. host must be set to the docker host's name.
  host: homeassistant.local
  # port is the listening port for UI and api
  # evcc will listen on all available interfaces
  port: 7070

Pls post your config.

you don’t use any kind of DNS (DuckDNS) in HA ?

jomach commented 4 months ago

open evcc at http://evcc.local:7070

network: schema: http host: homeassistant.local # .local suffix announces the hostname on MDNS port: 7070

log: debug levels: eebus: trace cache: error

No DuckDNS

thecem commented 4 months ago

Fact:

  1. no response from evcc to wallbox via mDNS
  2. mDNS query from wallbox has not the hostname of ha or even of the configured name in EVCC (assumed the config was right and as described above, while tracing)
  3. tcpdump to mac evcc conection show the right mdns name.

Assumption:

  1. no answering since the wallbox is asking the wrong name:
    49686a9f-evcc.local: type AAAA, class IN, "QM" question
    Name: 49686a9f-evcc.local
    [Name Length: 19]
    [Label Count: 2]
    Type: AAAA (28) (IP6 Address)
    .000 0000 0000 0001 = Class: IN (0x0001)
    0... .... .... .... = "QU" question: False

    -> Should be homeassistant.local

  2. The DNS/mDNS name given in Wallbox Energy Manager is wrong or the (m)DNS resolution is wrong.

Solution: Clarify why the name of the Wallbox mDNS query has the wrong name Try to use IP-Adresses instead of HostNames Try to use host-names with suffix .local Try to use 49686a9f-evcc.local as hostname in HA EVCC config Try to use 49686a9f-evcc as hostname for HA Try to use homeassistant as hostname in HA EVCC config What is the resolve of hostname 49686a9f-evcc.local, homeassistant and homeassistant.local in your network?

DerAndereAndi commented 4 months ago

The EEBUS Stack in evcc tries all possible variants to connect to the wallbox.

This can be seen in the log:

[eebus ] DEBUG 2024/07/17 20:08:52 ski: a9cfa5fac0e5631cb87f09ce726103519eff0fa6 name: Livo-EVB-500-HIDDEN brand: EVBox model: Livo typ: ChargingStation identifier: EVBox-Livo-EVB-500-HIDDEN register: false host: EVB-500-HIDDEN.local. port: 4712 addresses: [192.168.1.219]
[eebus ] DEBUG 2024/07/17 20:08:52 trying to connect to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at EVB-500-HIDDEN.local.
[eebus ] DEBUG 2024/07/17 20:08:52 initiating connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at EVB-500-HIDDEN.local.:4712/ship/
[eebus ] DEBUG 2024/07/17 20:08:52 connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 failed: dial tcp [fe80::ee5c:84ff:fe21:618a]:4712: connect: invalid argument
[eebus ] DEBUG 2024/07/17 20:08:52 trying to connect to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at 192.168.1.219
[eebus ] DEBUG 2024/07/17 20:08:52 initiating connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 at 192.168.1.219:4712/ship/
[eebus ] DEBUG 2024/07/17 20:09:02 connection to a9cfa5fac0e5631cb87f09ce726103519eff0fa6 failed:  dial tcp 192.168.1.219:4712: i/o timeout

But even the connections via the IPv4 address time out.

thecem commented 4 months ago

@DerAndereAndi: You assume we have to see the messeages out of the log as mDNS packets in the trace? (from EVCC to Wallbox) The last trace shows only some TCP Packets from .216 to Wallbox.

@jomach: pls tell your tcpdump command parameter

jomach commented 4 months ago

Just used tcpdump -n -w file.pcap

DerAndereAndi commented 4 months ago

E.g. if the network is not routable, you might not see anything. The code tries to do a connection and gets a timeout after 10s. See the timestamps.

jomach commented 4 months ago

Connections timeouts I also get running it lokal. But then there seems to be a retry and the connection ist establish.

I looked at the code and I cannot find the "log" statement from incoming connection. Is this on another library and not on evcc?

DerAndereAndi commented 4 months ago

This is all in the eebus packages, this is not part of evcc. You should not need a retry, this rather also hints at a problem of the wallbox.

I would really recommend getting it to run without a container in the first place. Because you are adding to much complexity and possible error scenarios.

Looking at the log (using macOS) in the first post:

Overall: your setup does not run properly outside of a container as well.

jomach commented 4 months ago

Sorry but it does. I see it charging and with different loads. I tested it by turning devices on and off and I see that the car does not receive so many kWh .

So locally it is definitely working. :/

DerAndereAndi commented 4 months ago

It is not working as it should be. It should not take 2 minutes to get a connection.

jomach commented 4 months ago

It takes 16 seconds

DerAndereAndi commented 4 months ago

See the macOS log in the first post here: https://github.com/evcc-io/hassio-addon/issues/99#issue-2408914546

jomach commented 4 months ago

How can I prove that this is a eebus issue on the wallbox side ?