Change hostname.

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
kurtsik
Posts: 1
Joined: Sat Aug 13, 2016 10:34 am

Change hostname.

Post by kurtsik » Sat Aug 13, 2016 11:18 am

Hello.

I'm trying to change the board hostname but I can't. Please, could you tell my in which file is set?

Thanks in advance.

MODERATOR NOTE: I moved this to ESP8266 since I assume that's the board you're using?

User avatar
pythoncoder
Posts: 3543
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Change hostname.

Post by pythoncoder » Sun Aug 14, 2016 8:16 am

Peter Hinch

jms
Posts: 108
Joined: Thu May 05, 2016 8:29 pm
Contact:

Re: Change hostname.

Post by jms » Mon Aug 15, 2016 10:09 am

I don't understand what hostname is in this context. It is a concept more heavyweight operating systems have and the normal place to read it is through os.uname()

User avatar
deshipu
Posts: 1347
Joined: Thu May 28, 2015 5:54 pm

Re: Change hostname.

Post by deshipu » Mon Aug 15, 2016 12:48 pm

It means what the esp8266 sends to the DHCP server on the local network when requesting an IP address.

jms
Posts: 108
Joined: Thu May 05, 2016 8:29 pm
Contact:

Re: Change hostname.

Post by jms » Mon Aug 15, 2016 1:31 pm

Thanks. That's exactly the kind of answer that makes me happy.

Why not have the DHCP server key on MAC address instead ? The MAC addresses ought to be unique (if not you've got big trouble anyway) and all belong to a block issued to the manufacturer.

User avatar
deshipu
Posts: 1347
Joined: Thu May 28, 2015 5:54 pm

Re: Change hostname.

Post by deshipu » Mon Aug 15, 2016 1:57 pm

The DHCP server already gets the MAC address -- it's required by the protocol. The hostname is supposed to be a human-readable convenience, so that you can see on the router's side which address is which.

bguenthe
Posts: 11
Joined: Fri Jul 22, 2016 3:37 pm

Re: Change hostname.

Post by bguenthe » Mon Sep 05, 2016 10:53 am

Sorry, but I'm blind. I cannot find in the documentaion from pythoncoder (http://docs.micropython.org/en/latest/e ... ckref.html?) where I can set the hostname?

User avatar
deshipu
Posts: 1347
Joined: Thu May 28, 2015 5:54 pm

Re: Change hostname.

Post by deshipu » Mon Sep 05, 2016 12:18 pm

I don't think you can.

User avatar
pythoncoder
Posts: 3543
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Change hostname.

Post by pythoncoder » Tue Sep 06, 2016 8:02 am

Apologies. Looking again at the doc I referenced, there's nothing.
Peter Hinch

bguenthe
Posts: 11
Joined: Fri Jul 22, 2016 3:37 pm

Re: Change hostname.

Post by bguenthe » Thu Sep 08, 2016 10:44 am

No problem! I only wat to make shure that I didnÄt miss something.

After an internet research I found this: http://www.esp8266.com/viewtopic.php?p=22608 There is an function for setting the hostname in the ESP-SDK named wifi_station_set_hostname().

I think someone has to implement a new method in the ESP- or network- or WLAN-module? But to be hornest, this is not rellay important :D

Post Reply