esphome / esphome/issues

mdns wifi on start disabled error

Open
#5,943 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
313
Forks
40
PR merge metrics
No merged PRs in 30d

Description

### The problem

### Problem Description

When I use the following configuration in my ESPHome YAML:

YAML

wifi:
enable_on_boot: False

And then manually connect to the network in STA mode using the code:

WiFi.disconnect();
WiFi.mode(WIFI_STA);
WiFi.begin("$staNameSTR", "$staPassSTR");

The device name, instead of being the one specified in the esphome section:

YAML

esphome:
name: electrowaterpool

changes to esp32-54391C.local. This causes an ESPHome API error and a connection error to the smart home system. I believe this issue is due to mDNS and related services not being configured correctly.
- [api.connection:078] | : Network unavailable, disconnecting

### Steps to Reproduce

1. Use the following configuration in ESPHome YAML:

YAML

wifi:
enable_on_boot: False
esphome:
name: electrowaterpool

2. Manually connect to Wi-Fi in STA mode with the following code:

C++

WiFi.disconnect();
WiFi.mode(WIFI_STA);
WiFi.begin("$staNameSTR", "$staPassSTR");

3. Observe that the device name changes to esp32-54391C.local instead of electrowaterpool.local.

### Expected Behavior

The device should retain the name specified in the esphome section (electrowaterpool.local).

### Additional Information

It seems that mDNS and related services are not being configured correctly when manually connecting to Wi-Fi in STA mode. How can this be fixed?

### Which version of ESPHome has the issue?

2024.6.1

### What type of installation are you using?

Home Assistant Add-on

### Which version of Home Assistant has the issue?

all versions

### What platform are you using?

ESP32

### Board

esp32dev

### Component causing the issue

mdns

### Example YAML snippet

```yaml
esphome:
name: electrowaterpool

wifi:
enable_on_boot: False
....
on_click:
then:...
WiFi.disconnect();
WiFi.mode(WIFI_STA);
WiFi.begin("$staNameSTR", "$staPassSTR");
```

### Anything in the logs that might be useful for us?

```txt
- [api.connection:078] | : Network unavailable, disconnecting
```

### Additional information

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.