How can I determine the hostname of another machine on the local network?
For that, you'd need a local DNS server on your local network, which gets updated by the DHCP server assigning the IP to that machine (many routers offer this feature).

You can then tell your Android device to use that DNS as primary when connected to your WiFi network, while leaving the secondary as-is (so the latter would still resolve everything outside your network). This option is located in the WiFi APN settings: Long-press the entry for your home WiFi, select to edit it, enable "advanced options".