I would like to use sensors or other devices in another network than my Home Assistant server is. I try to do a proove of concept with an M5Stack Atom Lite ESP32 module.
My setup has a hassIO installation on a NUC and also as an addon the Wiregurad server. Home Assistant my own public IPv4 and is accessible via HTTPS.
I created an yaml with a NTP, LED and a button section and also the Wireguard client. And it connects now to another WLAN and also connects with Wireguard to my VPN.
Not working is the connection to ESPhome and to Home Assistant. So as I see it, the Home Assistant Integrations need the Home Assistant server to connect to the ESP and itās not the ESP that connects to HA and ESPhome. I also added the āuse_addressā parameter as mentioned here: WireGuard Component ā ESPHome
But this did also not help.
As I see it, there is no routing to from the Home Assistant / hassIO to the Wireguard network the device / Wireguard clients are in. And in the in the other direction, there is NAT, so I only see the IP of home assistant as source on for example my NAS. And on Home Assistant (in AddGuard) I see as source the IP of the Wireguard Docker container. So many issues to overcome, if you like to connect to the Wireguard client.
I did not yet try a MQTT sensor on the ESP that then connects to HomeAssistants MQTT broker. Probably that works, but there will be no management of the ESPhome device or OTA update possible.
Did anyone have a remote location with sensors connectiong via VPN up- and running ?
Hello Nick
I donāt know what this helps to post the ESPhome XML, but here it is.
Most probably a change in the Wireguard addon config is the way forward (donāt use NAT)
The setup of wireguard are quite complex. I was wondering about your netmask and other such stuff. I was also wondering if you had followed all the instructions.
So perhaps tell us more about what you have done, and how your network is set up.
Is it possible to run api and mqtt on same esphome device?
I just saw the warning
Warning
If you enable MQTT and you do not use the ānative APIā for Home Assistant, you must remove the api: line from your ESPHome configuration, otherwise the ESP will reboot every 15 minutes because no client connected to the native API.
Ok that answers that
I have API and MQTT enabled, but in MQTT i have discovery set to false and there is no problem.
If you have discovery set to true and API enabled, entities are duplicated
I did not know that MQTT implementation is so simple.
I got MQTT working, but not API and OTA. This works in my home LAN, but not outside. But this is a difficult issue, because the default Wireguard AddOn uses NAT and this eliminates the access from the LAN to a Wireguard client. NAT must be changed to a propper routing.
I disabled reboot on API not connected. I added a few options and took some inspiration from @bodychmarcin . So I have now a functional demo and can now get to serious applications.
I would like to be abled to do remote OTA and to use the API instead of MQTT. Is here an expert on Wireguard server configuration including hassio docker and routing setup ?
No, see last post just above yours. I still need help configuring the Wireguard Server AddOn differently (without NAT but with routing), probably from @frenck . But as I understand docker and Nnetworking, this can be tricky to route from an āinternalā VPN network like Wireguard has, to the āoutsideā and especially from my local LAN (and Home Assistant itself) to a VPN connected client.
Hello,
I had the same problem, ESP32 connected with wireguard VPN addon in HAOS.
Only MQTT work
I found that the problem is that ESPHOME is behind SSL Proxy
(additional settings for SSL proxy didnĀ“t work for me)
I solve it with second HA instance (on different machine which is not behind the proxy)
connected to my main HA instance via HACS custom component.
MQTT work
API work
bluetooth proxy on ESP also work so I am able to use BLE sensors on remote site as bonus
I know , the easier way is to set up SSL proxy, but I donĀ“t know how to do it
Hello glitch69. I have the same problem but not very expert. I wold appreciate if you can show me where did you calculate the a0d7b954. ? is an addres of what ?. thanks in advance