micropython-mqtt icon indicating copy to clipboard operation
micropython-mqtt copied to clipboard

Added config option to set dhcp_hostname

Open msinn opened this issue 5 years ago • 3 comments

As a standard the WLAN object in network registers ESP32 micro-controller with the hostname 'espressif' when getting an ip adress from the dhcp server.

This commit adds the attribute 'hostname' to the config dict. When 'hostname' is configured, it is handed as 'dchp_hostname' to the sta_if configuration. This way, each ESP32 microcontroller can set it's individual dns entry.

msinn avatar Oct 13 '19 18:10 msinn

I wil implement the changes/extension you propose. I'll look into it probably on the weekend.

msinn avatar Oct 17 '19 07:10 msinn

As a matter of interest does setting the hostname have any effect in station mode? I can't see any difference here, but perhaps that's my router/dhcp server being uninformative.

I look forward to your updated PR in due course.

peterhinch avatar Oct 17 '19 07:10 peterhinch

Setting the hostname in station mode works well. Your router might need a while to recognize the new hostname. I use this feature often lately so the hostname matches ubinascii.hexlify(machine.unique_id()).

kevinkk525 avatar Oct 19 '19 06:10 kevinkk525