Closed vsurkov closed 2 years ago
Hi there, I found a solution to this problem. In the esphome config file, wg initialization inside lambda cannot be specified without checking, because when the sntp are sync next time, the
wg.begin(local_ip,private_key,endpoint_address,public_key,endpoint_port);
function is called again and this leads to a crash application and reboot.
the correct configuration should be like this:
time:
- platform: sntp
on_time_sync:
then:
- lambda: |
static const char* TAG = "wireguard";
ESP_LOGD(TAG, "Starting...");
if( !wg.is_initialized() ) {
ESP_LOGD(TAG, "Initializing WG interface...");
if( !wg.begin(
local_ip,
private_key,
endpoint_address,
public_key,
endpoint_port) ) {
ESP_LOGD(TAG, "Failed to initialize WG interface.");
}
}
Hi, i use library with esphome firmware on ESP32 nodemcu 38 pin board (https://github.com/esphome/feature-requests/issues/1444#issuecomment-966295758) everything is great, but controller reboots approximately every 10 minutes. I found the error on ESP log and here is it:
All recommendations like disabling logging do not help, I have consistently tried disabling everything else, the problem is in WireGuard. One more thing. I think this is due to the period of sntp time synchronization, perhaps at this moment the initialization is called again and crash "[21:28:17][D][sntp:075]: Synchronized time: 2021-12-19 21:28:17"