Wipy set wifi hostname

  • I have been reading some posts about the dhcp hostname but they are all a bit old.
    So instead of resurrecting one of those old posts I thought to create a new thread.

    Is it possible to change the wifi hostname of the wipy 3?
    Mine keeps showing up as 'espressif' and I would like to change that.

    Would be great to see the pybytes device name reflected as wifi hostname ;)



  • For the beta releases, we are working with the new idf. This requires some porting, so a lot of things do not work yet (changes in API by espressif). Im not sure whether the new IDF fixes the issue you are experiencing, but that is what I've seen around the other ESP32 fora (ie, changing the order of assigning).

    Im not that experienced with the whole DNS / DHCP scene and figured this was actually a solution.. Sorry about that, I cant help you any further :(


  • Thanks for the extra suggestion @Gijs.

    I have reproduced your steps (in the suggested order :) ) but unfortunately no luck. My setup is probably a bit different from yours. I think the key difference is the DNS setup. Mine is pretty simple: basically a DNS service linked to my DHCP server. Whenever something asks for a DHCP IP that hostname is registered in DNS with the provided DHCP IP. Definitely not a fully fledged DNS setup put pretty perfect for my home tinkering. I have zero work maintaining it :)

    For completensess I have a Wipy 3.0 running on a PySense 2.0 but I assume the DNS difference is going to be the dealbreaker here.
    My DNS setup only works if the hostname is reported through DHCP so I'll be stuck with the default espressif.

    I'm not entirely clear on the idf version upgrade. Is that something that would be backward compatible on my pycom hardware? If so I would love to get a feature request in to support a hostname change before dhcp connection is made :)

  • I was able to check it, the issue is in the order of operations
    If you do the following:

    wlan.connect(..., hostname='fipy2')

    It will not work, as the hostname is set before the connection is made
    But, when you set the hostname manually after connecting

    while not wlan.isconnected():
        print(".", end='')

    It will actually work:

    Gijs:pycom-tests pycom$ host
    Host not found: 3(NXDOMAIN)
    Gijs:pycom-tests pycom$ host domain name pointer fipy3.

    The actual issue is with the esp-idf as I suspected previously, but as we are planning to upgrade to idf 4.1, we're not planning to make any changes here..

  • I'll look more into it tomorrow, but from what I can see today, the hostname function should work fine.. (both in mdns and in the wlan modules) I did see some other issues about it from other sources, labelling it as a bug in the esp-idf, but I do not think we are suffering from that as well. I can imagine why it would be useful to have a correct hostname set, especially with multiple devices.

  • Thanks for the tip but I'm really looking for DNS hostname capability, not MDNS. My network runs completely on DHCP, I refuse to remember IP's :) I'm looking for some way to change the default espressif hostname to something else. I've read about earlier attempts to do this on the forum, summary findings so far:

    • There looks to have been a pull request back in 2017 from @illysky allowing to specify the hostname in the WLAN constructor.
      Unfortunately the latest pybytes firmware doesn't support that feature (throws an error).

    • There is a hostname parameter available on the WLAN connect method (see official doc here). I'm able to set the hostname and if I then connect through REPL and check the WLAN.hostname() it effectively reflects the hostname I set.
      Unfortunately this doesn't look to be propagated into the underlying wifi connection, on my DNS the device still shows up as espressif. This looks to be a bug to me?
      Extra attention point: This only works if you create the wifi connection yourself. The pybytes generated wifi connection actually closes and reconnects the wifi connection from boot.py. So I disable pybytes during these tests.

    • I did try the MDNS suggestion as well. I stuck it in my boot.py, it runs correctly but my mdns-scan is not showing anything (while being on the same subnet). I haven't gone much further with this since I'm not looking for MDNS.

    Like many other users I do connect frequently through telnet and ftp so a better dhcp hostname would really be grand.
    Being able to set it through pybytes would be even better.



  • I think this is possible through the MDNS layer, though I have no way of properly verifying that at the moment: https://docs.pycom.io/firmwareapi/pycom/network/mdns/#app

Log in to reply

Pycom on Twitter