I’m trying to get a portable esphome device to stay connected to my home assistant when I’m travelling.
I set it up to use wireguard client when it’s connected to other WiFi networks, it works and I can see it connected to my wireguard server whenever it’s connected to a different WiFi.
However, when connected to wireguard, the device is neither available in home assistant nor it is accessible via it’s peer IP 10.10.10.13 from home assistant container.
I’m using WireGuard app (addon) as the server. And I added a static route on the home assistant host to route traffic to 10.10.10.0/24 via wireguard container.
me@homeassistant ~ $ sudo ip route add 10.10.10.0/24 via 172.30.33.10
Has anyone run into a similar problem? If so, how did you solve it?
here is snippet of the config I’m using
esphome:
name: my_device
friendly_name: My Device
esp32:
variant: ESP32S3
board: esp32-s3-devkitc-1
flash_size: 16MB
framework:
type: esp-idf
wifi:
ssid: ${home_ssid}
password: !secret wifi_password
power_save_mode: high
reboot_timeout: 0s
ap:
ssid: MyDeviceFallback
password: !secret ap_password
use_psram: true
on_connect:
- lambda: |-
if (wifi::global_wifi_component->wifi_ssid() == "${home_ssid}") {
id(my_wireguard).disable();
} else {
id(my_wireguard).enable();
}
on_disconnect:
- lambda: |-
id(my_wireguard).disable();
captive_portal:
time:
- platform: sntp
id: sntp_time
timezone: Europe/Atlantis
wireguard:
id: my_wireguard
address: 10.10.10.13
netmask: 255.255.255.0
private_key: !secret wireguard_private_key
peer_endpoint: vpn.my.com
peer_port: 51820
peer_public_key: !secret wireguard_server_public_key
peer_allowed_ips:
- 10.10.10.0/24
peer_persistent_keepalive: 25s
reboot_timeout: 0s