Cannot get esp32 into Home assistant via wireguard on esphome

Hello everyone, this is my first post here, please tell me if I have done anything wrong.
I am trying to set up an esp32 that connects and sends data to my home assistant instance from another network over Wireguard. The esp seems to connect to the wireguard server that I have running in home assistant, but I cannot add it as an integration nor ping it. Here are the configuration files:
Esphome:

wireguard:
  address: "10.8.0.2"
  private_key: "..."
  peer_endpoint: "My_public_ip"
  peer_public_key: "..."
  peer_persistent_keepalive: 25s
  peer_allowed_ips:
    - 0.0.0.0/0
  netmask: 0.0.0.0

And the config on the wireguard add on, the post_up and post_down parts are added because I found that suggestion elsewhere, but it still does not work:

server:
  host: public_ip
  addresses:
    - 10.8.0.1
  dns:
    - 192.168.2.225
    - 192.168.2.220
  post_up: >-
    iptables -t nat -A POSTROUTING -o wg0 -j MASQUERADE; iptables -A FORWARD -i
    wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -m conntrack --ctstate
    RELATED,ESTABLISHED -j ACCEPT
  post_down: >-
    iptables -t nat -D POSTROUTING -o wg0 -j MASQUERADE; iptables -D FORWARD -i
    wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -m conntrack --ctstate
    RELATED,ESTABLISHED -j ACCEPT
peers:
  - name: esp32
    addresses:
      - 10.8.0.2/32
    allowed_ips: []
    client_allowed_ips: []

The esp logs show that the connection to the server succeeded and the handshake renews every couple of minutes.

[15:07:47][V][wireguard:082]: enabled=1, connected=1, peer_up=1, handshake: current=1769090798 latest=1769090798 updated=0
[15:07:47][D][wireguard:100]: Remote peer is online (latest handshake 2026-01-22 15:06:38 CET)

I know that the wireguard server works, when I connect to it with my phone or laptop I can use my local network and internet just fine, I just cannot ping the esp from home assistant nor add it manually by entering the address 10.8.0.2.
I am running Home Assistant OS in proxmox via the helper script, Core 2026.1.2, Supervisor 2026.01.1, Esphome version 2026.1.0.

esp32:
  board: esp32-c6-devkitc-1
  framework:
    type: esp-idf

Could someone please help me? I have been struggling to fix this for 2 days and feel like I am going insane. Thank you!

Update:
Believe it or not, I figured it out! Found the IP address of the wireguard docker container and added a static route in the terminal (ip route add 10.8.0.0/24 via 172.30.33.## (docker ip)). It works now!