Advice needed on broadcasting IP address of cam after connecting to WiFi

Hello there! I invested in the WiFi shield which I got a friend of mine to solder, and it’s working great :star_struck:. It connects to my WiFi seemlessly and I can see the IP address that it is getting and connect to the sample http server.

However, the latter assumes that I know the IP address which the Cam got. When connecting to other’s WiFi network this isn’t usually the case so I was thinking of a method to get the IP address after connecting.

One solution could be to use zeroconf/bonjour DNS to broadcast an available service on the network. However I don’t think there is a suitable micropython package for that.

Another solution (which I chose for now) is writing a small HTTP proxy on my laptop (whose IP is known) and put that in the config of my program on the cam. As soon as the cam connects, it sends it’s IP address via a HTTP post to my proxy and then I can connect back.

Anyone have a better idea to handle this? While the HTTP proxy thing works, it seems unnecessary complicated :slight_smile:

The documentation shows that one can set the dhcp_hostname for wlan.config bud sadly this doesn’t seem to work?

I noticed my cam uses the dhcp hostname ‘winc-f2-18’; which means I can connect to it with winc-f2-18.home or local depending on the dhcp server. Can this be changed at all?

Ah I see in the source:

@details
Sets the WINC device name. The name string is used as a device name in DHCP
hostname (option 12).
If a device is not set through this function a default name is assigned.
The default name is WINC-XX-YY, where XX and YY are the last 2 octets of the OTP
MAC address. If OTP (eFuse) is programmed, then the default name is WINC-00-00.

I don’t think this API is exposed in the python layer but at least I know it will always be the same hostname wherever I go. Seems that this will probably solve my problem in practice.