Qrome / marquee-scroller

Marquee Scroller Clock News Weather and More
https://www.thingiverse.com/thing:2867294
MIT License
331 stars 158 forks source link

Can we have Fixed Hostname. #188

Closed Neeraj-Ch closed 2 years ago

Neeraj-Ch commented 3 years ago

Can we have a Fixed Host name, instead of typing ESP's IP Address in browser? It is somewhat tricky to obtain IP address when ESP is connected to a new WiFi Router. So that's it.

k7bbr commented 3 years ago

It's already there. Look in the marquee.ino file. Line 32: #define HOSTNAME "CLOCK-"

You can change the "CLOCK-" to whatever you'd like. The code also appends the last 6 characters of your ESP's mac address to the defined hostname. For example, if my ESP's mac address was "12:34:56:ab:cd:df", the hostname would be "clock-abcdef" . I can type http://clock-abcdef.local/ into my browser address board and the interface comes up.

You could modify your local version of the code to not append the partial mac address to the hostname if you wanted. (See line 270 of marquee.ino: hostname += String(ESP.getChipId(), HEX); Comment that out, and the hostname will be whatever you set it to in line 32. If you comment out line 270, just be careful if you have more than one marquee. You'll then have two devices with the same hostname unless you changed line 32 for each board.

Neeraj-Ch commented 3 years ago

Tried this, Not working. Web Interface only available by IP address. Re: Working OK on Windows PC but No luck on Android.

sprior commented 2 years ago

The host name you're talking about is the MDNS hostname, not the regular DNS hostname. It seems that Android doesn't support MDNS (see https://issuetracker.google.com/issues/140786115) so there's really nothing that can be done in the code here. If you have a real DNS and DHCP server inside your network and your DHCP server points clients to it then you can set up what you want without using MDNS by assigning a permanent IP address to the scroller and then set up a DNS hostname for that address on your DNS server, but that's nontrivial (it's what I have set up).

sprior commented 2 years ago

As it happens I just found out that Android did add support for MDNS recently and didn't mention it. Here's an article that just came out about it: https://www.androidpolice.com/android-mdns-local-hostname/