← index #4748Issue #5492
Related · high · value 0.677
QUERY · ISSUE

[ESP32] DHCP Hostname not working correctly

openby gentleadamopened 2019-05-04updated 2021-01-10
port-esp32

I can't put my finger on which version this stopped working or if it's just my code that's the issue.

def ConnectNetwork(NetworkName, Password):
    import network

    wlan = network.WLAN()
    wlan.active(True)
    wlan.config(dhcp_hostname="testname")
    wlan.ifconfig(('192.168.0.210', '255.255.255.0', '192.168.0.1', '8.8.8.8'))

    if not wlan.isconnected():
        print('connecting to network...')
        wlan.connect(NetworkName, Password)

    print('Network Config:', wlan.ifconfig())
    print('DHCP Hostname:', wlan.config('dhcp_hostname'))


ConnectNetwork("SSID", "Password")

When the device is connected to my router it is showing as UNKNOWN name. I am unable to ping the device using its name. Sometimes the name does show up on the router but disappears quickly after.

I have tested this in another home with a different board (same model) and a different router/network. Same things seem to happen.

This is part of some larger code, but pulled this snippet out for testing this issue. I have attempted to use different MicroPython versions below...

  • esp32-bluetooth.bin (latest)
  • esp32-20190504-v1.10-323-g906fb89fd.bin
  • esp32-20180511-v1.9.4.bin

I have also tried removing this line but the same issue happens.
wlan.ifconfig(('192.168.0.210', '255.255.255.0', '192.168.0.1', '8.8.8.8'))

Thanks in advance!

CANDIDATE · ISSUE

ESP32 Static IP not being assigned despite using ifconfig()

closedby ekendra-nzopened 2020-01-04updated 2020-05-14
port-esp32

Using ESP32 Devkit flashed with MP Build 2 Jan 2020.

I'm trying to get a static IP from the router. I'm using the tuple param:

wlan.ifconfig(("192.168.1.77", "255.255.255.0", "xxx.xxx.x.xx", "8.8.8.8"))

Connects to LAN but DHCP is still just assigning it an IP and ignoring the requested static IP 192.168.1.77

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied