Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4146

MicroPython • Re: Convert WiFi codebase from CircuitPython - mDNS issue

$
0
0
I can sorta-kinda get it to work, but something is messy with my internal LAN so I don't get the .local address I expect.

Using MicroPython v1.23.0-preview.324.gd11ca092f on 2024-04-17: the latest nightly

Immediately after loading the network module, but before starting any network services, I set the hostname:

Code:

    import network    network.hostname("picowX")    ...
The Pico W reports the following network details:

Code:

network config: ('192.168.2.138', '255.255.255.0', '192.168.2.1', '192.168.2.1')hostname      : picowX
picowX.local doesn't resolve, though. But looking through resolvectl output, I see my DNS Domain is ht.home. Worth a try ...

Code:

ping picowX.ht.homePING picowX.ht.home (192.168.2.138) 56(84) bytes of data.64 bytes from picowX.ht.home (192.168.2.138): icmp_seq=1 ttl=255 time=293 ms64 bytes from picowX.ht.home (192.168.2.138): icmp_seq=2 ttl=255 time=123 ms64 bytes from picowX.ht.home (192.168.2.138): icmp_seq=3 ttl=255 time=145 ms...
So a qualified success, and I hope it's enough for you to go on with.

Key details:
  1. set your hostname early. Apparently the hostname is only advertised once immediately after the network is initialized. So you have to set the hostname before the network starts.
  2. You may need to use a MicroPython nightly build. I wasn't able to get 1.22 to work, but I can't guarantee that was the cause.

Statistics: Posted by scruss — Fri Apr 19, 2024 12:02 am



Viewing all articles
Browse latest Browse all 4146

Trending Articles