From d7d1121f7dfe1fd5935ccf4a278f23d422f526f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Mon, 23 Nov 2020 17:22:23 +0100 Subject: [PATCH] Force enable interface if configured (#7785) --- .../dialogs/network/dialog-hassio-network.ts | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/hassio/src/dialogs/network/dialog-hassio-network.ts b/hassio/src/dialogs/network/dialog-hassio-network.ts index c019bc0032..382cc0ede3 100644 --- a/hassio/src/dialogs/network/dialog-hassio-network.ts +++ b/hassio/src/dialogs/network/dialog-hassio-network.ts @@ -391,25 +391,30 @@ export class DialogHassioNetwork extends LitElement nameservers: this._toArray(this._interface![version]?.nameservers), }; } - if (this._wifiConfiguration) { - interfaceOptions = { - ...interfaceOptions, - enabled: true, - wifi: { - ssid: this._wifiConfiguration.ssid, - mode: this._wifiConfiguration.mode, - auth: this._wifiConfiguration.auth || "open", - }, - }; - if (interfaceOptions.wifi!.auth !== "open") { - interfaceOptions.wifi = { - ...interfaceOptions.wifi, - psk: this._wifiConfiguration.psk, - }; - } - } }); + if (this._wifiConfiguration) { + interfaceOptions = { + ...interfaceOptions, + wifi: { + ssid: this._wifiConfiguration.ssid, + mode: this._wifiConfiguration.mode, + auth: this._wifiConfiguration.auth || "open", + }, + }; + if (interfaceOptions.wifi!.auth !== "open") { + interfaceOptions.wifi = { + ...interfaceOptions.wifi, + psk: this._wifiConfiguration.psk, + }; + } + } + + interfaceOptions.enabled = + this._wifiConfiguration !== undefined || + interfaceOptions.ipv4?.method !== "disabled" || + interfaceOptions.ipv6?.method !== "disabled"; + try { await updateNetworkInterface( this.hass,