skot / ESP-Miner

A bitcoin ASIC miner for the ESP32
GNU General Public License v3.0
254 stars 91 forks source link

Add support for mDNS to have pretty dashboard URL #233

Open skot opened 4 weeks ago

skot commented 4 weeks ago

ESP-IDF apparently supports mDNS which would potentially allow us to have the the AxeOS dashboard have a URL like bitaxeAB02.local instead of the IP address.

I suggest using the last 4 hex digits of the WiFi MAC address appended (like we do for the setup AP SSID) so that there are not problems with multiple Bitaxe on the same network. Of course if there is a better way to do this, that would be awesome too.

skot commented 4 weeks ago

@tbd3 maybe you'd be interested in looking into this?

mutatrum commented 4 weeks ago

What's the difference between this and #165? I can access the dashboard with the hostname configured.

skot commented 4 weeks ago

Really? Can you access AxeOS from your browser with http://<hostname>.local? Or something else besides the IP?

mutatrum commented 4 weeks ago

Yes, I set the hostname, restart and it works:

image

image

Same for API access:

image

skot commented 4 weeks ago

🤯 what is this network magic!? Mine doesn't work like that.

mutatrum commented 4 weeks ago

Always has been? I can access all my devices by their hostnames on my LAN.

Two things I can think of: my main machine is a linux machine, maybe that's better with these things? But AFAIK this also works from the Windows machines in the house, and it also works from mobile phones. Second thing I can think of is I have the router as DNS (192.168.1.1) so that will resolve locally first, and only forwards to an external DNS when that fails. But isn't that is totally standard? Do you access everything on your LAN by IP?

image

pixeldoc2000 commented 4 weeks ago

@skot The Firmware (esp) send its hostname with the DHCP Request to the Router.

If the Router DHCP Server update the DNS Server of the Router, the Hostname will be resolved to the device IP. But this depends on the Router to implement it.

grafik

mDNS work independently via broadcast. Having mDNS may be nice to have, but I think there are more important issues to fix before getting into creature comfort stuff?

skot commented 4 weeks ago

Ah, I did not have my router as DNS on this machine. Changed and it works! pretty cool. I did not know you could do that.

As @pixeldoc2000 says, this is not universal, so we probably can't remove the IP from the screen.

Definitely a nice-to-have feature for future. You're right there are other pressing issues.

skot commented 4 weeks ago

We should prolly set the default hostname to bitaxeXXXX with X being the last 4 of the WiFi MAC