swissalpine / GARMIN-xDrip-Spike-Nightscout-Watchface

19 stars 2 forks source link

Error 502 #4

Closed zehnBE closed 1 year ago

zehnBE commented 1 year ago

On wifi it works fine. On Mobile Data it shows only Error 502 All right are set to yes and in the Browser it works. Xdrip only is set. I have try all delay settings. Which setting are wrong? Latest Version of all (earlier xdrip does also not working. Can you help? Thx Martin

swissalpine commented 1 year ago

That it works with WIFI when xDrip is selected as setting is actually not possible ... As soon as xDrip is selected as source, an internal URL is called, which is not accessible via WiFi. Also, the error code -502 is not documented at Garmin (cf. https://developer.garmin.com/connect-iq/api-docs/Toybox/Communications.html). From therefore I am somewhat in the dark.

Regardless: In xDrip, the Web Service is enabled and the Open Web Service is disabled?

zehnBE commented 1 year ago

Yes, xdrip web Service ist enabled and open web Service is disabled.

zehnBE commented 1 year ago

Garmin watchface: Screenshot_2023-03-23-11-25-45-219_com garmin connectiq Screenshot_2023-03-23-11-25-53-822_com garmin connectiq

Xdrip: Screenshot_2023-03-23-11-27-07-108_com eveningoutpost dexdrip Debuggen for Webservice is activated and works in wifi: Screenshot_2023-03-23-11-27-20-536_com eveningoutpost dexdrip

If wifi disabled or out of range, no requests are loged in xdrip.

zehnBE commented 1 year ago

WiFi disabled: IMG_20230323_113209

swissalpine commented 1 year ago

WIFI must be disabled on some Garmin watches because the watchface must direct the web requests to Garmin Connect Mobile app. If WIFI is enabled it directs the request over WIFI network. Is the Garmin Connect Mobile App running in the background (dontkillmyapp.com) and the bluetooth connection reliable?

swissalpine commented 1 year ago

If I read your pictures correctly: It worked at 11:26 and fails 5 minutes later? Do you see a log entry at 11:31? If there isn't any there was no comunnication between Garmin Mobile App and xDrip+.

zehnBE commented 1 year ago

Sorry for the delay! When WiFi is on, i can see in xdrip Log the requests. But not when WiFi is Off. There comes no requests in in the xdrip Log. And all These Apps have all rights and can run complete time and are allowed to use mobile data. Is there a debug Output on logcat from the watchface?

swissalpine commented 1 year ago

What I don't understand: it should be impossible for my Watchface to connect to xDrip via WIFI! It asks for an internal IP of xDrip+, this can only be reached as follows: Watch -- via Bluetooth --> Garmin Connect Mobile App -- internal connection --> http://127.0.0.1:17580/sgv.json?count=18 @ xDrip+ This IP should not be reachable via WLAN, the router doesn't even know where to route this address to! A logcat there is not, everything happens on the watch. Also I never (!) see entries in xDrip+, I did not even know that xDrip+ logs the web service. Is there a trick to enable it? If Garmin Connect Mobile App is not subject to any restrictions, even the Bluetooth apps are not terminated in the background, I really unfortunately have no idea what is going wrong with you.

Do you have other apps accessing the internal server of xDrip+? Have you activated any firewall on your smartphone that blocks access? Are you rooted and have an app blocker that uses internal addresses for redirects to nowhere? If I take 502 seriously as a bad gateway error, it must be a communication problem between Garmin Connect Mobile and xDrip+ ...

Since I really don't know how to help you, I'm wondering if talking on the phone will do any good?

swissalpine commented 1 year ago

If you google error 502 and Garmin Connect, you will find issues with the amazon music app. Amazon has published a trouble shooting. Maybe there is something here that will help you? https://images-eu.ssl-images-amazon.com/images/I/817GgcTP9TS.pdf

swissalpine commented 1 year ago

And one last thought: Could it be that you are using Juggluco and have the Juggluco web server turned on? According to this post https://insulinclub.de/index.php?thread/34255-libre3-2-juggluco/&postID=686979#post686979 it responds to the same (!) web address as the xDrip+ web server ... (if I understood that correctly). This would of course also explain why the communication fails ...