micropython-mqtt
micropython-mqtt copied to clipboard
Added config option to set dhcp_hostname
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.
I wil implement the changes/extension you propose. I'll look into it probably on the weekend.
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.
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()).