Closed eengnr closed 8 months ago
Hmm, I remember this being an issue a while back. Unfortunately I wasn't able to reproduce it. I've only got Linux and apple devices at home, but I might be able to scrounge an Android device.
What android device are you using? You can normally access .local
domains without issue?
Do you have any devices running esphome, or home assistant on your network, that you can access from your android device?
I assume you're also seeing no abnormal logs coming over serial for the web server?
To not be dependent on mDNS, perhaps the web UI could load the API from the IP of the ESP32 instead of the mDNS .local domain?
Implementing this won't fix your issue though right, as you'll still have difficulty resolving the root domain (front end) http://winderoo.local
.
You should also be able to call the winder's API directly by substituting the ip.
Glancing at the old front-end logic, the url sanitization only happened when the FE was accessed during local development, where you access the FE from your dev box on localhost:4200
. This then interacts with the deployed web server on your network, http://winder.local/api/....
I'll see if I can sink some more time into this tomorrow.
Couple more follow-up questions.
Do you see anything from your android devices with the following urls:
http://winderoo.local/
- make sure the trailing slash is in the addresshttp://winderoo.local/api/status
- if you have a device on the network, this will provide you with the device's current state.Reading through Google's Android issue tracker, it looks like multicast dns was implemented in Android 12 and rolled out to Pixel devices. However, I can't say how that roll-out is handled by other manufacturers.
See here:
There's also a possibility that this change was not back-ported to older Android systems.
Thanks for the detailed feedback! I hope this answers your questions :)
Q: What android device are you using? A: Pixel 7 with stock Android 14. But issue also happens e.g. on a Pixel 3 XL with stock Android 12.
Q: You can normally access .local domains without issue?
A: This was never a use case for me, because all devices have a static IP in my network and I assign internal .home
domains with AdGuard Home as DNS. But it turned out that OpenHAB advertises itself with a .local
domain as well and I can access it from Android without a problem. The problem only exists for the ESP.
Q: Do you have any devices running esphome, or home assistant on your network, that you can access from your android device? A: No other ESP32 or Home Assistant. I'm using OpenHAB, see above :)
Q: I assume you're also seeing no abnormal logs coming over serial for the web server? A: Yes, looks ok:
[STATUS] - connected to saved network
[STATUS] - mDNS started
Q: Do you see anything from your android devices with the following urls A: No, I get DNS_PROBE_FINISHED_NXDOMAIN in Chrome and "Adress not found" in Firefox
Some additional comments:
Reading through Google's Android issue tracker, it looks like multicast dns was implemented in Android 12 and rolled out to Pixel devices
It seems to be part of the Play Services -> https://www.androidpolice.com/android-mdns-local-hostname/ Therefore it should be available on older Android versions, too.
Glancing at the old front-end logic, the url sanitization only happened when the FE was accessed during local development...
Rolling back to commit 8058d30
, the FE does the API call towards the IP if I load the FE from the IP http://192.168.0.120
(in my case) instead of http://winderoo.local
. I just flashed that commit to the ESP, no local FE development involved. With that, it's possible to use it from Android by accessing the FE with the IP of the ESP.
This has changed, since commit 6592d1b
the FE always does the API call towards http://winderoo.local
which breaks the FE on my Android devices completely.
For local development of the FE I think the API calls should go to winderoo.local
if the window.location.href
includes localhost
or 127.0.0.1
and not 192
.
Implementing this won't fix your issue though right, as you'll still have difficulty resolving the root domain (front end) http://winderoo.local.
That's right, but at least it would be possible to access a working FE from the IP of the ESP. Currently, the winderoo.local is hardcoded and if access is not possible, it breaks the FE even if the FE is loaded from the IP.
I'll see if I can sink some more time into this tomorrow.
Please don't put too much effort in it :slightly_smiling_face: It could still be an issue on my side - I just wanted to ask if it's reproducible for you (or perhaps someone else using Winderoo with Android).
I'll provide another PR which brings back the window.location.href
check and respects the localhost
/127.0.0.1
for local FE development. This should at least allow to load the FE from the IP or any custom domain name in case mDNS is not working.
Seeing as #40 is merged, i'm going to close this for now. In the future, we need to work out a better solution for android users.
It seems that mDNS doesn't work properly on Android which causes the Winderoo web UI to not work anymore after #36. At least I couldn't get it to work... 😅
It turned out that I cannot resolve
http://winderoo.local
on any Android device (7, 12, 13, 14). Before the change in #36, it was possible to access the web UI with the IP of the ESP32 on Android and the API call was then done towards the IP. With my change in #35, the API call would be done to any domain that was used for the UI (which is of course accessible, otherwise the UI would not load at all).But now since #36, the API call is always done to
http://winderoo.local
, even if the IP is used to load the UI or if a custom non-.local-domain name is used (I can set this with AdGuard Home in my LAN).I did some research and found some issues where this one seems to be quite similar to my problem: https://github.com/espressif/arduino-esp32/issues/9051
https://github.com/esphome/issues/issues/3003
I can access the
.local
domain which is broadcasted from a Raspberry Pi with OpenHAB, but I cannot access the.local
from the ESP32 on Android. On Linux or iOS it works fine.Long story short - @mwood77 do you observe the same with an Android device? Or does it work for you on Android? I'm currently not sure if it's an issue in my network or an issue in the combination Android + mDNS on ESP32.
To not be dependent on mDNS, perhaps the web UI could load the API from the IP of the ESP32 instead of the mDNS
.local
domain?