-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Brainstorming on new setup_priority::VPN
#4
Comments
I would definitely leave this for later development |
But simply setting wireguard priority to It should because WiFi component blocks the setup step until the connection is esablished so during Do you agree? @bgamari, @thomas0bernard |
It wouldn't, because the SNTP component is set to And since we need time sync for WG, the whole thing doesn't work. |
Yes, you are right. I have coded a sort of workaround that requires, however, the change of SNTP priority, but if you like this solution I can send the PR for SNTP. This is the workaround: the priority of wireguard has been increased to Could you test it from external_components:
- source:
type: git
url: https://github.com/droscy/esphome
ref: ft/wg/priority
components:
- wireguard
wireguard:
address: 172.16.34.100
netmask: 255.255.255.0
[...]
peer_allowed_ips:
- 172.16.34.0/24
require_connection_to_proceed: true
mqtt:
broker: 172.16.34.5
[...] Of course you have to manually change the priority of SNTP (line 25 of file |
It works, with the SNTP priority set to But, I like the addition of this parameter, since it prevents from trying to resolve the MQTT broker's address before WG is connected. My use case resolves that with a local DNS that is only available after WG is connected, so I appreciate that! |
@thomas0bernard could you test again? I've merged the |
Everything works for me! |
The change to sntp has been merged and I merged the new parameter to external_components:
- source:
type: git
url: https://github.com/droscy/esphome
ref: wireguard/dev
components:
- wireguard
- wireguard_status
- wireguard_handshake
- sntp # don't forget sntp here! |
Tested arduino and idf again, all good for me. |
Code merged to official PR, I'll this issue. Thanks @thomas0bernard for your tests. |
In order to have mqtt working through wireguard tunnel we have to change the available setup priorities. This may affect any other component that uses
AFTER_WIFI
.The patch suggested by @bgamari here bgamari@ec905b6 is wonderful but I don't think it can be introduced in ESPHome through wireguard because it is "core" and not directly related to wireguard.
I suggest creating a PR to official ESPHome repo with the following changes:
VPN
andCONNECTION
(as done in the commit)AFTER_WIFI
(as done in the commit, rising float value)CONNECTION
the priority of any component that establishes a remote connection and that currently has priority set toAFTER_WIFI
(mqtt is one, but can be others)So we have the scaffold for wireguard, where
can_proceed()
can return true only after having reached the remote peer (as described here esphome#4256 (comment)).What do you think? @lhoracek, @bgamari, @thomas0bernard
Backref:
The text was updated successfully, but these errors were encountered: